Merge fix/one-side-panel-at-a-time

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
anas 2026-10-07 18:28:34 +02:00
commit bcdad2e699
2 changed files with 18 additions and 1 deletions

View File

@ -97,6 +97,14 @@ fun PoemScreen(
// finds, so the couplet's own actions live at its foot rather than behind a tap between words.
var tapped by remember { mutableStateOf<WordTap?>(null) }
// One side panel at a time. The dictionary and the reading settings both want the left of the
// screen, and opening the second put two panels there at once — or, where there was no longer
// room for two, left the dictionary as a sheet in the middle of the page while the settings
// sat beside it. Either way the reader is asked to look in two places. The settings replace
// the dictionary instead; closing them leaves the poem, which is where the reader was.
val sidePanelOpen = LocalSidePanelOpen.current
LaunchedEffect(sidePanelOpen) { if (sidePanelOpen) tapped = null }
Load(
key = fullUrl,
block = { Ganjoor.poem(fullUrl) },

View File

@ -48,6 +48,15 @@ import com.ganjoor.android.data.LocalAssistant
import com.ganjoor.android.data.Pronunciation
import com.ganjoor.android.ui.theme.readingStyle
/**
* How wide the dictionary sits beside the poem.
*
* Narrower than the reading settings, deliberately: the settings fold the columns away and take
* the room that frees, while the dictionary is read *against* the line it came from, so the verse
* keeps the width instead. A definition is short; a hemistich is not.
*/
val DictionaryPanelWidth = 216.dp
/** English prose inside an otherwise right-to-left sheet. */
@Composable
private fun LeftToRight(content: @Composable () -> Unit) {
@ -102,7 +111,7 @@ fun WordPanel(word: String, onDismiss: () -> Unit, passage: Bookmark? = null) {
BackHandler(onBack = onDismiss)
Surface(
color = MaterialTheme.colorScheme.surfaceContainerLow,
modifier = Modifier.width(360.dp).fillMaxHeight(),
modifier = Modifier.width(DictionaryPanelWidth).fillMaxHeight(),
) {
Column(Modifier.statusBarsPadding()) {
Row(