|
|
@ -70,7 +70,7 @@ fun TopicRoute(
|
|
|
|
val newsUiState: NewsUiState by viewModel.newUiState.collectAsStateWithLifecycle()
|
|
|
|
val newsUiState: NewsUiState by viewModel.newUiState.collectAsStateWithLifecycle()
|
|
|
|
|
|
|
|
|
|
|
|
TopicScreen(
|
|
|
|
TopicScreen(
|
|
|
|
topicState = topicUiState,
|
|
|
|
topicUiState = topicUiState,
|
|
|
|
newsUiState = newsUiState,
|
|
|
|
newsUiState = newsUiState,
|
|
|
|
modifier = modifier,
|
|
|
|
modifier = modifier,
|
|
|
|
onBackClick = onBackClick,
|
|
|
|
onBackClick = onBackClick,
|
|
|
@ -82,7 +82,7 @@ fun TopicRoute(
|
|
|
|
@VisibleForTesting
|
|
|
|
@VisibleForTesting
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
internal fun TopicScreen(
|
|
|
|
internal fun TopicScreen(
|
|
|
|
topicState: TopicUiState,
|
|
|
|
topicUiState: TopicUiState,
|
|
|
|
newsUiState: NewsUiState,
|
|
|
|
newsUiState: NewsUiState,
|
|
|
|
onBackClick: () -> Unit,
|
|
|
|
onBackClick: () -> Unit,
|
|
|
|
onFollowClick: (Boolean) -> Unit,
|
|
|
|
onFollowClick: (Boolean) -> Unit,
|
|
|
@ -96,7 +96,7 @@ internal fun TopicScreen(
|
|
|
|
item {
|
|
|
|
item {
|
|
|
|
Spacer(Modifier.windowInsetsTopHeight(WindowInsets.safeDrawing))
|
|
|
|
Spacer(Modifier.windowInsetsTopHeight(WindowInsets.safeDrawing))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
when (topicState) {
|
|
|
|
when (topicUiState) {
|
|
|
|
Loading -> item {
|
|
|
|
Loading -> item {
|
|
|
|
NiaLoadingWheel(
|
|
|
|
NiaLoadingWheel(
|
|
|
|
modifier = modifier,
|
|
|
|
modifier = modifier,
|
|
|
@ -109,14 +109,14 @@ internal fun TopicScreen(
|
|
|
|
TopicToolbar(
|
|
|
|
TopicToolbar(
|
|
|
|
onBackClick = onBackClick,
|
|
|
|
onBackClick = onBackClick,
|
|
|
|
onFollowClick = onFollowClick,
|
|
|
|
onFollowClick = onFollowClick,
|
|
|
|
uiState = topicState.followableTopic,
|
|
|
|
uiState = topicUiState.followableTopic,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TopicBody(
|
|
|
|
TopicBody(
|
|
|
|
name = topicState.followableTopic.topic.name,
|
|
|
|
name = topicUiState.followableTopic.topic.name,
|
|
|
|
description = topicState.followableTopic.topic.longDescription,
|
|
|
|
description = topicUiState.followableTopic.topic.longDescription,
|
|
|
|
news = newsUiState,
|
|
|
|
news = newsUiState,
|
|
|
|
imageUrl = topicState.followableTopic.topic.imageUrl,
|
|
|
|
imageUrl = topicUiState.followableTopic.topic.imageUrl,
|
|
|
|
onBookmarkChanged = onBookmarkChanged
|
|
|
|
onBookmarkChanged = onBookmarkChanged
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -246,7 +246,7 @@ fun TopicScreenPopulated() {
|
|
|
|
NiaTheme {
|
|
|
|
NiaTheme {
|
|
|
|
NiaBackground {
|
|
|
|
NiaBackground {
|
|
|
|
TopicScreen(
|
|
|
|
TopicScreen(
|
|
|
|
topicState = TopicUiState.Success(FollowableTopic(previewTopics[0], false)),
|
|
|
|
topicUiState = TopicUiState.Success(FollowableTopic(previewTopics[0], false)),
|
|
|
|
newsUiState = NewsUiState.Success(
|
|
|
|
newsUiState = NewsUiState.Success(
|
|
|
|
previewNewsResources.mapIndexed { index, newsResource ->
|
|
|
|
previewNewsResources.mapIndexed { index, newsResource ->
|
|
|
|
SaveableNewsResource(
|
|
|
|
SaveableNewsResource(
|
|
|
@ -271,7 +271,7 @@ fun TopicScreenLoading() {
|
|
|
|
NiaTheme {
|
|
|
|
NiaTheme {
|
|
|
|
NiaBackground {
|
|
|
|
NiaBackground {
|
|
|
|
TopicScreen(
|
|
|
|
TopicScreen(
|
|
|
|
topicState = TopicUiState.Loading,
|
|
|
|
topicUiState = TopicUiState.Loading,
|
|
|
|
newsUiState = NewsUiState.Loading,
|
|
|
|
newsUiState = NewsUiState.Loading,
|
|
|
|
onBackClick = {},
|
|
|
|
onBackClick = {},
|
|
|
|
onFollowClick = {},
|
|
|
|
onFollowClick = {},
|
|
|
|