Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nbradbury committed Oct 3, 2024
1 parent 7e8dbe4 commit 59585ca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ import org.wordpress.android.ui.compose.theme.M3Theme
* These composables were created for the self-hosted users feature but were written to be reusable
* in other projects.
*/

/**
* A composable that displays a user's avatar image, optionally with a click listener.
* This is suitable for use in a list of users, such as in the self-hosted users feature.
*/
@Composable
fun UserAvatar(
avatarUrl: String?,
Expand Down Expand Up @@ -82,6 +87,9 @@ fun UserAvatar(
}
}

/**
* A composable that displays a user's large avatar image at the maximum size
*/
@Composable
fun UserLargeAvatar(avatarUrl: String) {
AsyncImage(
Expand All @@ -98,6 +106,9 @@ fun UserLargeAvatar(avatarUrl: String) {
)
}

/**
* A composable that displays a message when there are no users
*/
@Composable
fun UserEmptyView() {
UserMessageView(
Expand All @@ -106,6 +117,9 @@ fun UserEmptyView() {
)
}

/**
* A composable that displays a message when there's no network connection
*/
@Composable
fun UserOfflineView() {
UserMessageView(
Expand All @@ -115,6 +129,10 @@ fun UserOfflineView() {
)
}

/**
* A composable that displays a title with an icon above it and an optional
* message below it
*/
@Composable
private fun UserMessageView(
@DrawableRes iconRes: Int,
Expand Down Expand Up @@ -148,6 +166,9 @@ private fun UserMessageView(
}
}

/**
* A composable that displays a screen with a top bar and a content area
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun UserScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class SelfHostedUsersViewModel @Inject constructor(
}

/**
* Called when the avatar of a user is clicked in the detail screen
* Called when a user's avatar is clicked in the detail screen
*/
fun onUserAvatarClick(avatarUrl: String?) {
avatarUrl?.let {
Expand Down

0 comments on commit 59585ca

Please sign in to comment.