From 2a5e95f4cf4824c3f28f6e2c32a827614c5aed12 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 14 May 2026 13:26:47 +0000 Subject: [PATCH] fix: standardize ScheduledPosts nav-shell behavior ScheduledPostsScreen used a plain Scaffold with no bottom bar and an unconditional back arrow, so a user who pinned it to the bottom nav got a back arrow and no bottom bar instead of the standard tab-root shell. Add AppBottomBar(Route.ScheduledPosts) and gate the back arrow on nav.canPop(), matching every other bottom-nav-eligible screen: back arrow + no bottom bar when entered from the drawer, no back arrow + bottom bar when entered from the bottom nav. https://claude.ai/code/session_01WZXxqCGYT4JEQBwwBNiUjm --- .../scheduledposts/ScheduledPostsScreen.kt | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/scheduledposts/ScheduledPostsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/scheduledposts/ScheduledPostsScreen.kt index 26d972ac8..1a9fe3143 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/scheduledposts/ScheduledPostsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/scheduledposts/ScheduledPostsScreen.kt @@ -46,6 +46,7 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Button @@ -98,6 +99,7 @@ import com.vitorpamplona.amethyst.service.scheduledposts.ScheduledPostStatus import com.vitorpamplona.amethyst.service.scheduledposts.ScheduledPostWorker import com.vitorpamplona.amethyst.ui.components.SwipeToDeleteWithConfirmation import com.vitorpamplona.amethyst.ui.components.util.setText +import com.vitorpamplona.amethyst.ui.navigation.bottombars.AppBottomBar import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.routes.Route import com.vitorpamplona.amethyst.ui.navigation.topbars.ShorterTopAppBar @@ -130,6 +132,8 @@ fun ScheduledPostsScreen( val totalActive by viewModel.totalActive.collectAsStateWithLifecycle() val context = LocalContext.current var expandedId by remember { mutableStateOf(null) } + val listState = rememberLazyListState() + val scope = rememberCoroutineScope() // Tick once per minute so relative-time strings ("publishes in 2h 13m") // refresh on a long-open list instead of being frozen at first composition. @@ -183,10 +187,23 @@ fun ScheduledPostsScreen( } }, navigationIcon = { - IconButton(onClick = { nav.popBack() }) { ArrowBackIcon() } + // Suppress the back arrow when this is the bottom of the back stack + // (i.e. the user landed here via the bottom nav, which clears the stack). + if (nav.canPop()) { + IconButton(onClick = { nav.popBack() }) { ArrowBackIcon() } + } }, ) }, + bottomBar = { + AppBottomBar(Route.ScheduledPosts, nav, accountViewModel) { route -> + if (route == Route.ScheduledPosts) { + scope.launch { listState.animateScrollToItem(0) } + } else { + nav.navBottomBar(route) + } + } + }, ) { padding -> if (groups.isEmpty()) { EmptyState(onCompose = { nav.nav(Route.NewShortNote()) }, modifier = Modifier.padding(padding)) @@ -194,6 +211,7 @@ fun ScheduledPostsScreen( val today = remember(nowSec) { LocalDate.now(ZoneId.systemDefault()) } LazyColumn( modifier = Modifier.fillMaxSize().padding(padding), + state = listState, contentPadding = PaddingValues(vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp), ) {