fix: make shared page bodies full width

This commit is contained in:
2026-10-18 21:58:24 +01:00
parent a9e0e742bc
commit 149ff0e06a
4 changed files with 43 additions and 21 deletions
@@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.material.icons.Icons
@@ -42,7 +41,6 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import net.awan.pipelines.ui.theme.DETAIL_MAX_WIDTH_DP
import net.awan.pipelines.ui.theme.ICON_RAIL_DP
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
@@ -215,9 +213,9 @@ private fun RailTab(tab: DetailTab, selected: Boolean, onClick: () -> Unit) {
}
/**
* Constrains a text tab's single scroll container to a comfortable reading width
* on a wide window (centred) instead of letting lines run edge to edge; on a
* narrow window the content simply fills the tab.
* Gives a tab body the complete safe-area width supplied by its page container.
* Internal content remains responsible for any narrower, purpose-specific layout
* such as chat bubbles.
*/
@Composable
fun DetailTabBody(
@@ -225,18 +223,7 @@ fun DetailTabBody(
modifier: Modifier = Modifier,
content: @Composable (Modifier) -> Unit,
) {
if (wide) {
Box(modifier.fillMaxSize(), contentAlignment = Alignment.TopCenter) {
content(
Modifier
.fillMaxHeight()
.widthIn(max = DETAIL_MAX_WIDTH_DP.dp)
.fillMaxWidth(),
)
}
} else {
content(modifier.fillMaxSize())
}
content(modifier.fillMaxSize())
}
/**
@@ -94,14 +94,11 @@ internal val DESTINATION_PILL_RESERVE = 88.dp
*/
internal val ATTENTION_CHIP_RESERVE = SPACING_XXL + SPACING_M
// ---- Detail rail and max content width (ui/components/DetailTabs.kt) -------
// ---- Detail rail (ui/components/DetailTabs.kt) ------------------------------
/** The always-visible wide section rail's width (icons with labels). */
internal const val WIDE_RAIL_WIDTH_DP = 200
/** Comfortable max text width for a tab body on a wide window. */
const val DETAIL_MAX_WIDTH_DP = 840
// ---- Workflow graph geometry (ui/graph/WorkflowGraph.kt) -------------------
// The graph's node, edge and legend geometry. These are named here like every
// other app dimension so the graph file imports them instead of writing raw dp
@@ -1,6 +1,7 @@
package net.awan.pipelines.ui.components
import androidx.compose.runtime.mutableStateOf
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
@@ -66,4 +67,17 @@ class DetailTabsTest {
state.toggle("evidence-4")
assertFalse(state.isExpanded("evidence-4"))
}
@Test
fun detailTabBodyUsesThePageSafeAreaWithoutAnArtificialWideCap() {
val source = File(
System.getProperty("user.dir"),
"src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt",
).readText()
assertTrue(source.contains("content(modifier.fillMaxSize())"))
assertFalse(source.contains("DETAIL_MAX_WIDTH_DP"))
assertFalse(source.contains("widthIn(max"))
assertFalse(source.contains("contentAlignment = Alignment.TopCenter"))
}
}
+24
View File
@@ -0,0 +1,24 @@
# Full-width shared page body
## What changed
`android/app/src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt` no longer
centres wide `DetailTabBody` content inside the artificial `DETAIL_MAX_WIDTH_DP` cap.
The body now passes its page modifier through at the available safe-area width for
Runs, Pipelines, Chats and Settings. Insets, scroll padding and narrower internal
layouts (including chat bubbles) remain owned by their respective callers.
The wide navigation rail and pane-stack policy were not changed. The obsolete
`DETAIL_MAX_WIDTH_DP` token was removed from `ui/theme/Dimens.kt`; no dependency or
server change is involved.
`DetailTabsTest` pins the full-width body implementation and guards against restoring
the centered cap. Device rendering on compact and wide windows remains for the UI
review stage.
## Documentation now stale (for `docs-fold`)
- `android/README.md` near the detail-tabs geometry/token description still names
`DETAIL_MAX_WIDTH_DP` as the wide page-body cap. Remove that token from the
description and state that shared page bodies use the available safe-area width;
keep any separate navigation-rail width description unchanged.