mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 15:01:59 +00:00
ref: adjust the search screen empty state ui
This commit is contained in:
parent
1a0738551f
commit
cf1bd1613b
1 changed files with 45 additions and 37 deletions
|
|
@ -285,53 +285,61 @@ fun SearchScreen(
|
|||
onPosterLongClick = onPosterLongClick,
|
||||
)
|
||||
} else {
|
||||
when {
|
||||
uiState.isLoading && uiState.sections.isEmpty() -> {
|
||||
items(2) {
|
||||
HomeSkeletonRow(modifier = Modifier.padding(horizontal = homeSectionPadding))
|
||||
val normalizedQuery = query.trim()
|
||||
val isWaitingForSearch = normalizedQuery.isNotBlank() && lastRequestedQuery != normalizedQuery
|
||||
when {
|
||||
isWaitingForSearch -> {
|
||||
items(2) {
|
||||
HomeSkeletonRow(modifier = Modifier.padding(horizontal = homeSectionPadding))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uiState.sections.isEmpty() -> {
|
||||
item {
|
||||
SearchEmptyStateCard(
|
||||
reason = uiState.emptyStateReason,
|
||||
errorMessage = uiState.errorMessage,
|
||||
networkCondition = networkStatusUiState.condition,
|
||||
onRetry = {
|
||||
val normalizedQuery = query.trim()
|
||||
if (normalizedQuery.isNotBlank()) {
|
||||
NetworkStatusRepository.requestRefresh(force = true)
|
||||
SearchRepository.search(
|
||||
query = normalizedQuery,
|
||||
addons = addonsUiState.addons,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
uiState.isLoading && uiState.sections.isEmpty() -> {
|
||||
items(2) {
|
||||
HomeSkeletonRow(modifier = Modifier.padding(horizontal = homeSectionPadding))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
items(
|
||||
items = uiState.sections.withDuplicateSafeLazyKeys { section -> section.key },
|
||||
key = { section -> section.lazyKey },
|
||||
) { keyedSection ->
|
||||
val section = keyedSection.value
|
||||
HomeCatalogRowSection(
|
||||
section = section,
|
||||
modifier = Modifier.padding(bottom = 12.dp),
|
||||
watchedKeys = watchedUiState.watchedKeys,
|
||||
onPosterClick = onPosterClick,
|
||||
onPosterLongClick = onPosterLongClick,
|
||||
)
|
||||
uiState.sections.isEmpty() -> {
|
||||
item {
|
||||
SearchEmptyStateCard(
|
||||
reason = uiState.emptyStateReason,
|
||||
errorMessage = uiState.errorMessage,
|
||||
networkCondition = networkStatusUiState.condition,
|
||||
onRetry = {
|
||||
if (normalizedQuery.isNotBlank()) {
|
||||
NetworkStatusRepository.requestRefresh(force = true)
|
||||
SearchRepository.search(
|
||||
query = normalizedQuery,
|
||||
addons = addonsUiState.addons,
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.padding(horizontal = homeSectionPadding),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
items(
|
||||
items = uiState.sections.withDuplicateSafeLazyKeys { section -> section.key },
|
||||
key = { section -> section.lazyKey },
|
||||
) { keyedSection ->
|
||||
val section = keyedSection.value
|
||||
HomeCatalogRowSection(
|
||||
section = section,
|
||||
modifier = Modifier.padding(bottom = 12.dp),
|
||||
watchedKeys = watchedUiState.watchedKeys,
|
||||
onPosterClick = onPosterClick,
|
||||
onPosterLongClick = onPosterLongClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun discoverColumnCountForWidth(screenWidth: Dp): Int =
|
||||
when {
|
||||
|
|
|
|||
Loading…
Reference in a new issue