loading: one loading card on the grids, not a full fake grid (#31)

My videos, Subscriptions, History and the channel pages painted two whole rows
of placeholder cards on first open, and Channels painted two stub rows. Show a
single loading card instead, matching the Home rows.
This commit is contained in:
Jeena 2026-10-15 14:20:35 +00:00
parent 9f69cabf79
commit 0ca17cfd00
2 changed files with 16 additions and 26 deletions

View file

@ -317,10 +317,8 @@ fun ChannelsScreen(
when { when {
viewModel.loading && viewModel.userRows.isEmpty() -> viewModel.loading && viewModel.userRows.isEmpty() ->
// Placeholder rows while the channels load (issue #19): header stub // One row header stub + a single loading card, not a fake grid (#31).
// + a row of shimmer card-shaped placeholders, twice.
androidx.compose.foundation.layout.Column { androidx.compose.foundation.layout.Column {
repeat(2) {
Box(Modifier.padding(start = 16.dp, top = 12.dp, bottom = 4.dp)) { Box(Modifier.padding(start = 16.dp, top = 12.dp, bottom = 4.dp)) {
Box( Box(
Modifier Modifier
@ -330,8 +328,7 @@ fun ChannelsScreen(
.background(Color(0xFF232323)), .background(Color(0xFF232323)),
) )
} }
ShimmerRow() ShimmerRow(size = 1)
}
} }
viewModel.error != null && viewModel.userRows.isEmpty() -> viewModel.error != null && viewModel.userRows.isEmpty() ->
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {

View file

@ -211,21 +211,14 @@ fun VideoListScreen(
// VideoListScreen (My videos, Search, Subscriptions, History, channel pages). // VideoListScreen (My videos, Search, Subscriptions, History, channel pages).
item(key = "initial-placeholders", span = { androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }) { item(key = "initial-placeholders", span = { androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }) {
LaunchedEffect(source) { viewModel.loadMore(force = true) } LaunchedEffect(source) { viewModel.loadMore(force = true) }
androidx.compose.foundation.layout.Column { // A single loading card, not a full fake grid (issue #31).
repeat(2) {
androidx.compose.foundation.layout.Row {
repeat(cardsPerRow) {
ShimmerCard( ShimmerCard(
modifier = Modifier modifier = Modifier
.padding(6.dp) .padding(6.dp)
.width(rowCardWidth()), .width(rowCardWidth() - 12.dp),
) )
} }
} }
}
}
}
}
itemsIndexed(items, key = { _, item -> itemStableKey(item) }) { index, item -> itemsIndexed(items, key = { _, item -> itemStableKey(item) }) { index, item ->
val video: VideoDto = when (item) { val video: VideoDto = when (item) {
is VideoListItem.HistoryEntry -> item.history.video is VideoListItem.HistoryEntry -> item.history.video