Fold the columns away while reading settings are open

On a large screen the settings panel opens on the left while the poets
and book columns sit on the right, which left the page squeezed between
them. The columns now step aside while the panel is open and come back
when it closes, but only if they were showing: this is a transient flag
(LocalSidePanelOpen), never the saved reader-view choice. The floating
show-the-list button stays hidden while the panel is open too.

Updates wireframe 8 and the ColumnBrowser notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhmDdrN5hgWrgRcFLAMsV6
This commit is contained in:
Claude 2026-10-07 16:00:55 +00:00
parent f21f4fa727
commit aab8b2e3e1
No known key found for this signature in database
4 changed files with 20 additions and 3 deletions

View File

@ -61,6 +61,7 @@ import androidx.compose.material3.VerticalDivider
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.Stable
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.runtime.mutableIntStateOf
@ -156,6 +157,12 @@ private val CatEntry.url
is CatEntry.Poem -> poem.fullUrl
}
/**
* True while a side panel (the reading settings) is open beside the page on a large screen.
* The columns step aside for it, so the page keeps its room, and come back when it closes.
*/
val LocalSidePanelOpen = compositionLocalOf { false }
/**
* The columns beside [content]. [expanded] (840dp and up) shows up to three list columns;
* narrower, only the newest one, with a way back up in its header.
@ -174,7 +181,11 @@ fun ColumnBrowser(
content: @Composable (toggle: @Composable () -> Unit) -> Unit,
) {
val settings = LocalSettings.current
val hidden = settings.value.columnsHidden
// Hidden by the reader (reader view, remembered) or only while the settings panel is open.
// The second never touches the saved choice, so closing the panel puts back exactly what
// was there: the columns if they were showing, reader view if it was on.
val makingRoom = LocalSidePanelOpen.current
val hidden = settings.value.columnsHidden || makingRoom
val columns = remember(url, isPoem) { columnUrls(url, isPoem) }
// What is selected in each column: the next step of the path, down to the open poem.
val path = if (isPoem) columns + url else columns
@ -219,13 +230,14 @@ fun ColumnBrowser(
Box(Modifier.weight(1f).fillMaxHeight()) {
content {
// Hiding is in the top bar; bringing them back is the floating button below,
// which is there whenever they are hidden.
// which is there whenever the reader has hidden them.
if (!hidden) ColumnsToggle { settings.update { it.copy(columnsHidden = true) } }
}
// Reader view: the page has the whole screen, and one button, at the edge the
// columns went to, brings them back as they were.
// Not while the settings panel is open: the columns would stay away for it anyway.
ShowColumnsButton(
visible = hidden,
visible = hidden && !makingRoom,
onShow = { settings.update { it.copy(columnsHidden = false) } },
modifier = Modifier
.align(Alignment.BottomStart)

View File

@ -112,7 +112,10 @@ fun GanjoorApp() {
// On a large screen reading settings open in a panel on the left, where the dictionary
// opens, so the page stays in view and shows each change as it is made.
Row(Modifier.fillMaxSize()) {
// The columns fold away while the settings panel is open, so the page doesn't end up
// squeezed between them and the panel.
Box(Modifier.weight(1f)) {
CompositionLocalProvider(LocalSidePanelOpen provides (wide && settingsOpen)) {
NavHost(
navController = nav,
startDestination = PoetsRoute,
@ -237,6 +240,7 @@ fun GanjoorApp() {
}
}
}
}
if (wide) {
AnimatedVisibility(
visible = settingsOpen,

View File

@ -51,6 +51,7 @@ On large screens, tapping a word opens **WordPanel** on the left instead of the
On large screens the gear opens **ReadingSettingsPanel** on the left, where the dictionary opens, instead of the bottom sheet:
- It has the same width and surface as the dictionary panel, with a "Reading settings" header and a ✕ button. The settings and their order are the same as in the sheet.
- The page stays in view beside the panel, so a change of theme, font, weight or size shows on the poem as it's made.
- While the panel is open, the poets and list columns fold away so the page keeps its room. When it closes they come back, but only if they were showing before: this never changes the saved reader-view choice, and the floating "show the list" button stays hidden while the panel is open.
- ✕ or Back closes it. Phones keep the bottom sheet.
## Loading

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 107 KiB