Skip to content

Commit

Permalink
empty comments list
Browse files Browse the repository at this point in the history
  • Loading branch information
slartus committed Apr 15, 2024
1 parent 213621c commit 89f55ec
Showing 1 changed file with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ internal fun PostScreen(component: PostComponent) {
Scaffold(
topBar = {
TopAppBar(
title = { },
title = { Text("Комментарии") },
navigationIcon = {
IconButton(onClick = {
component.onBackClicked()
Expand Down Expand Up @@ -83,21 +83,37 @@ internal fun PostScreen(component: PostComponent) {
PostViewState.ProgressState.Loading -> LoaderView()

is PostViewState.ProgressState.Loaded ->
CommentsView(
comments = state.comments,
hasMore = state.hasMoreComments,
onMoreClick = {
component.onMoreCommentsClicked()
},
onMoreRepliesClick = {
component.onMoreRepliesClicked(it)
}
)
if (state.comments.isEmpty())
EmptyCommentsView()
else
CommentsView(
comments = state.comments,
hasMore = state.hasMoreComments,
onMoreClick = {
component.onMoreCommentsClicked()
},
onMoreRepliesClick = {
component.onMoreRepliesClicked(it)
}
)
}
}
}
}

@Composable
private fun EmptyCommentsView() {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(
text = "Список комментариев пуст",
style = MaterialTheme.typography.bodyMedium
)
}
}

@Composable
private fun CommentsView(
comments: ImmutableList<CommentItem>,
Expand Down

0 comments on commit 89f55ec

Please sign in to comment.