mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-17 15:32:01 +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,
|
onPosterLongClick = onPosterLongClick,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
when {
|
val normalizedQuery = query.trim()
|
||||||
uiState.isLoading && uiState.sections.isEmpty() -> {
|
val isWaitingForSearch = normalizedQuery.isNotBlank() && lastRequestedQuery != normalizedQuery
|
||||||
items(2) {
|
when {
|
||||||
HomeSkeletonRow(modifier = Modifier.padding(horizontal = homeSectionPadding))
|
isWaitingForSearch -> {
|
||||||
|
items(2) {
|
||||||
|
HomeSkeletonRow(modifier = Modifier.padding(horizontal = homeSectionPadding))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
uiState.sections.isEmpty() -> {
|
uiState.isLoading && uiState.sections.isEmpty() -> {
|
||||||
item {
|
items(2) {
|
||||||
SearchEmptyStateCard(
|
HomeSkeletonRow(modifier = Modifier.padding(horizontal = homeSectionPadding))
|
||||||
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,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
uiState.sections.isEmpty() -> {
|
||||||
items(
|
item {
|
||||||
items = uiState.sections.withDuplicateSafeLazyKeys { section -> section.key },
|
SearchEmptyStateCard(
|
||||||
key = { section -> section.lazyKey },
|
reason = uiState.emptyStateReason,
|
||||||
) { keyedSection ->
|
errorMessage = uiState.errorMessage,
|
||||||
val section = keyedSection.value
|
networkCondition = networkStatusUiState.condition,
|
||||||
HomeCatalogRowSection(
|
onRetry = {
|
||||||
section = section,
|
if (normalizedQuery.isNotBlank()) {
|
||||||
modifier = Modifier.padding(bottom = 12.dp),
|
NetworkStatusRepository.requestRefresh(force = true)
|
||||||
watchedKeys = watchedUiState.watchedKeys,
|
SearchRepository.search(
|
||||||
onPosterClick = onPosterClick,
|
query = normalizedQuery,
|
||||||
onPosterLongClick = onPosterLongClick,
|
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 =
|
private fun discoverColumnCountForWidth(screenWidth: Dp): Int =
|
||||||
when {
|
when {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue