From 3765fdfdf6806a261aef96bbf3a65f3f06e6ada4 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 16 Oct 2026 12:43:19 +0100 Subject: [PATCH] Migrate the list and detail screens onto the geometry tokens Replace the hardcoded paddings, spacings, sizes and offsets in the four list/detail screens and the shared components they are built from with references to the token file from the previous item, via WindowInsets or layout where those derive the value. Every replacement is value-equal, so the screens render identically at both window widths. Name the glyph sizes that cannot derive from layout as four new ICON_* tokens in ui/theme/Dimens.kt (14/18/20/24dp) and shrink the DimensTest allow-list from 30 to 24 entries: 14.dp, 18.dp and 20.dp leave because their last call site migrated, and the already-unused 32.dp, 11.sp and 13.sp entries are dropped. All adb/emulator work targeted emulator-5554 only; android/ only; no new dependency, server/Go/installer/Docker file touched, and no run started from the app. Verified: :app:assembleDebug + the full unit suite (30 result XMLs, 259 tests, 0 failures/0 errors/0 skipped), the shrunk allow-list still fails a forced raw-literal probe, and before/after screenshots of every converted screen at narrow and wide widths match near-zero. --- android/README.md | 78 +++++++++++++++++++ .../awan/pipelines/ui/components/CodeBlock.kt | 12 ++- .../ui/components/ConnectionBanner.kt | 8 +- .../pipelines/ui/components/DetailTabs.kt | 17 ++-- .../pipelines/ui/components/FilterMenu.kt | 8 +- .../awan/pipelines/ui/components/ListRow.kt | 9 ++- .../pipelines/ui/components/PaneIdentity.kt | 8 +- .../awan/pipelines/ui/components/RunStatus.kt | 11 ++- .../awan/pipelines/ui/components/Sections.kt | 6 +- .../awan/pipelines/ui/components/States.kt | 17 ++-- .../ui/screens/PipelineDetailScreen.kt | 46 ++++++----- .../ui/screens/PipelineListScreen.kt | 11 +-- .../pipelines/ui/screens/RunDetailScreen.kt | 73 +++++++++-------- .../pipelines/ui/screens/RunHistoryScreen.kt | 36 +++++---- .../net/awan/pipelines/ui/theme/Dimens.kt | 17 ++++ .../net/awan/pipelines/ui/theme/DimensTest.kt | 13 +--- 16 files changed, 253 insertions(+), 117 deletions(-) diff --git a/android/README.md b/android/README.md index 60654da8..92a1d048 100644 --- a/android/README.md +++ b/android/README.md @@ -2336,6 +2336,84 @@ Evidence (macOS, JDK 17 from Homebrew `openjdk@17`, Not verified in this pass: whether `:app:lintDebug` stays at its two pre-existing `NewApi` errors (it was not run). +## The list and detail screens on the geometry tokens (16 Oct 2026) + +`android/` only. Every replacement is value-equal, so the screens render exactly +as before. No new dependency, no server/Go/installer/Docker file touched, no run +started from the app, and every `adb`/emulator command targeted `emulator-5554` +only (never `emulator-5556` or the attached Pixel). + +- **Scope.** The four list/detail screens + (`ui/screens/PipelineListScreen.kt`, `RunHistoryScreen.kt`, + `PipelineDetailScreen.kt`, `RunDetailScreen.kt`) and the shared components + they are built from (`ListRow`, `States`, `Sections`, `PaneIdentity`, + `ConnectionBanner`, `FilterMenu`, `CodeBlock`, `RunStatus`, `DetailTabs`). The + navigation chrome (`SlidingPaneStack`, `PipelinesApp`) and the workflow-graph + package keep their literals. +- **Spacing.** Every 4/8/12/16/24dp padding, gap and arrangement on those files + now references the previous item's `SPACING_XS/S/M/L/XL` tokens (and + `SPACING_XXS` for the 2dp chip gaps); no value changed. The 10dp dense row + padding, the 2dp progress hairline and the `0.dp` elevations stay as reasoned + allow-list entries because they are not on the spacing scale. +- **Glyph sizes.** Four new tokens in `ui/theme/Dimens.kt` name the icon sizes + that cannot derive from layout: `ICON_STATUS_DP` (14dp), `ICON_INLINE_DP` + (18dp), `ICON_LIST_DP` (20dp) and `ICON_RAIL_DP` (24dp), used by `RunStatus`, + `CodeBlock`, `RunHistoryScreen`, `RunDetailScreen`, `PipelineDetailScreen` and + `DetailTabs`. +- **The allow-list shrinks.** `ui/theme/DimensTest.kt`'s allow-list drops from + **30 to 24 entries**: `14.dp`, `18.dp` and `20.dp` are gone because their last + call site migrated, and the already-unused `32.dp`, `11.sp` and `13.sp` entries + were removed. The remaining entries are the structural hairlines/zeros + (0/2/3/6dp), the not-yet-migrated graph/app-shell values, the container sizes + and the `sp` type values owned by `Typography.kt`. + +Evidence (macOS, JDK 17 from Homebrew `openjdk@17`, +`ANDROID_HOME=~/Library/Android/sdk`, Gradle 9.7.1, `--offline`): + +- `gradle :app:assembleDebug :app:testDebugUnitTest --rerun-tasks --console=plain` + → `BUILD SUCCESSFUL`; `--rerun-tasks` re-ran all 30 result XMLs to **259 tests, + 0 failures, 0 errors, 0 skipped**. `app/build/outputs/apk/debug/app-debug.apk` + is 17,995,009 bytes, sha256 `d40d7b78…`. +- **Allow-list shrinks.** `git show HEAD:…DimensTest.kt` counts 30 entries; the + working tree counts 24 (`14.dp`, `18.dp`, `20.dp`, `32.dp`, `11.sp`, `13.sp` + gone, the rest re-reasoned). +- **Enforcement proof.** Appending `private val PROBE_RAW_LITERAL = 123.dp` to + `ui/components/ListRow.kt` made + `gradle :app:testDebugUnitTest --tests net.awan.pipelines.ui.theme.DimensTest` + `FAILED` with `raw dimension literals outside + net/awan/pipelines/ui/theme/Dimens.kt: + [net/awan/pipelines/ui/components/ListRow.kt:113: 123.dp]`; removing the line + made the same task pass. The probe was reverted. +- **Before/after screenshots on `emulator-5554` only** (fold AVD, 2076x2152 / + 390dpi, dark mode; narrow 1080x2340 and wide 2000x3400 via `wm size`; never + `emulator-5556` or the attached Pixel), against the live server at + `ws://10.0.2.2:8080/connect`, each frame captured and validated with + `scripts/capture_png.sh -s emulator-5554`. The **before** APK was built from + HEAD `8e49a0c` (sha256 `e50bb381…`) with the working changes stashed; the + **after** APK from the working tree (sha256 `d40d7b78…`). Every converted + screen was captured at both widths (Pipelines list, Runs list, pipeline + detail, run detail): `geom---before.png` / `-after.png` in + `~/.local/share/pipelines/data/artifacts/122/1/`. `captures/imgdiff.py` + reports a mean channel difference of 0.01–0.04 for both detail screens, + 0.02–0.04 for the Pipelines list and 0.04–0.12 for the Runs list, all + confined to the status-bar clock, the live relative-time/badge text and + thumbnails that load asynchronously; the layout itself is unchanged. +- `adb -s emulator-5554 logcat -d` held 0 `FATAL EXCEPTION` / 0 + `E AndroidRuntime` lines; `animator_duration_scale` was left at 1; no run was + started from the app. +- **APK publish.** `app-debug.apk` copied to + `~/.local/share/pipelines/data/artifacts/122/1/pipelines-debug-wip-8e49a0c.apk` + (`8e49a0c` = `git rev-parse --short HEAD`; the working tree is uncommitted WIP + on top of it), sha256 `d40d7b78…`. `curl -I + http://10.0.0.249:8080/artifacts/122/1/pipelines-debug-wip-8e49a0c.apk` + returned `HTTP/1.1 200 OK`, `Content-Type: + application/vnd.android.package-archive`, `Content-Length: 17995009`, and a + streamed `GET | shasum -a 256` returned the same `d40d7b78…`. + +Not verified in this pass: `:app:lintDebug` (not run); the Runs-list and +run-detail before/after pairs are not byte-identical because their live +relative-time text and artifact thumbnails load asynchronously. + ## An app-owned run-status palette (16 Oct 2026) Run status had the wrong hue for its two most important states because it was diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/CodeBlock.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/CodeBlock.kt index 30c729d2..549ab634 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/CodeBlock.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/CodeBlock.kt @@ -23,6 +23,10 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import net.awan.pipelines.ui.theme.ICON_INLINE_DP +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XS import net.awan.pipelines.ui.theme.pipelinesText /** @@ -66,9 +70,9 @@ fun CodeBlock( Row( modifier = Modifier .fillMaxWidth() - .padding(start = 16.dp, end = 4.dp, top = 4.dp, bottom = 4.dp), + .padding(start = SPACING_L, end = SPACING_XS, top = SPACING_XS, bottom = SPACING_XS), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_S), ) { Text( text = label, @@ -80,7 +84,7 @@ fun CodeBlock( Icon( imageVector = Icons.Default.ContentCopy, contentDescription = "Copy $label", - modifier = Modifier.size(18.dp), + modifier = Modifier.size(ICON_INLINE_DP), ) } } @@ -95,7 +99,7 @@ fun CodeBlock( Text( text = text, style = styles.mono, - modifier = body.padding(start = 16.dp, end = 16.dp, bottom = 16.dp), + modifier = body.padding(start = SPACING_L, end = SPACING_L, bottom = SPACING_L), ) } } diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/ConnectionBanner.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/ConnectionBanner.kt index 3a56a2cd..849fb70f 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/ConnectionBanner.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/ConnectionBanner.kt @@ -15,8 +15,10 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp import net.awan.pipelines.data.transport.ConnectionState +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_S /** * A small, shared connection banner shown above every screen so a disconnected @@ -81,9 +83,9 @@ private fun Banner( // applied a second time. modifier = Modifier .windowInsetsPadding(paneSafeArea().only(WindowInsetsSides.Top)) - .padding(horizontal = 16.dp, vertical = 8.dp), + .padding(horizontal = SPACING_L, vertical = SPACING_S), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(12.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_M), ) { Text( text = text, diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt index be995b87..adb2c557 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt @@ -46,6 +46,11 @@ 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 +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XS import net.awan.pipelines.ui.theme.WIDE_RAIL_WIDTH_DP import net.awan.pipelines.ui.theme.pipelinesText @@ -133,15 +138,15 @@ fun DetailTabs( modifier = Modifier .width(WIDE_RAIL_WIDTH_DP.dp) .fillMaxHeight() - .padding(vertical = 8.dp), + .padding(vertical = SPACING_S), ) { Column( modifier = Modifier .weight(1f) .fillMaxWidth() .selectableGroup() - .padding(top = 8.dp, bottom = 8.dp), - verticalArrangement = Arrangement.spacedBy(4.dp), + .padding(top = SPACING_S, bottom = SPACING_S), + verticalArrangement = Arrangement.spacedBy(SPACING_XS), ) { tabs.forEachIndexed { index, tab -> RailTab( @@ -192,16 +197,16 @@ private fun RailTab(tab: DetailTab, selected: Boolean, onClick: () -> Unit) { .background( if (selected) MaterialTheme.colorScheme.secondaryContainer else Color.Transparent, ) - .padding(horizontal = 16.dp, vertical = 12.dp), + .padding(horizontal = SPACING_L, vertical = SPACING_M), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(12.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_M), ) { Icon( imageVector = tab.icon, // The label names the tab, so the glyph is decorative. contentDescription = null, tint = contentColor, - modifier = Modifier.size(24.dp), + modifier = Modifier.size(ICON_RAIL_DP), ) Text( text = tab.title, diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/FilterMenu.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/FilterMenu.kt index 7e6cca69..a957ce2b 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/FilterMenu.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/FilterMenu.kt @@ -39,6 +39,10 @@ import androidx.compose.ui.semantics.toggleableState import androidx.compose.ui.state.ToggleableState import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XS import net.awan.pipelines.ui.theme.pipelinesText /** @@ -111,7 +115,7 @@ fun FilterMenu( modifier = Modifier.heightIn(max = maxMenuHeight), ) { Row( - modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 4.dp), + modifier = Modifier.fillMaxWidth().padding(start = SPACING_L, end = SPACING_XS), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.SpaceBetween, ) { @@ -173,6 +177,6 @@ fun FilterSectionHeader(label: String) { text = label, style = pipelinesText().label, color = MaterialTheme.colorScheme.primary, - modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp), + modifier = Modifier.padding(horizontal = SPACING_M, vertical = SPACING_S), ) } diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/ListRow.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/ListRow.kt index 56e74403..93857b5f 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/ListRow.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/ListRow.kt @@ -20,6 +20,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.semantics.Role import androidx.compose.ui.unit.dp +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_XXS /** * One row of the shared real list used by the wide pipelines/runs panes (and the @@ -67,14 +70,14 @@ fun ListRow( ) { Column { Row( - modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 10.dp), + modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L, vertical = 10.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(12.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_M), ) { leading?.invoke() Column( modifier = Modifier.weight(1f), - verticalArrangement = Arrangement.spacedBy(2.dp), + verticalArrangement = Arrangement.spacedBy(SPACING_XXS), ) { content() } diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/PaneIdentity.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/PaneIdentity.kt index c56c0f83..cd6644a5 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/PaneIdentity.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/PaneIdentity.kt @@ -11,7 +11,9 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.unit.dp +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XS import net.awan.pipelines.ui.theme.pipelinesText /** @@ -29,9 +31,9 @@ fun PaneIdentity(title: String, subtitle: String? = null, modifier: Modifier = M val text = pipelinesText() Box(modifier.fillMaxSize(), contentAlignment = Alignment.Center) { Column( - modifier = Modifier.padding(horizontal = 8.dp, vertical = 12.dp), + modifier = Modifier.padding(horizontal = SPACING_S, vertical = SPACING_M), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.spacedBy(4.dp), + verticalArrangement = Arrangement.spacedBy(SPACING_XS), ) { Text( text = title, diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/RunStatus.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/RunStatus.kt index 900fb7ae..443e8eee 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/RunStatus.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/RunStatus.kt @@ -26,7 +26,10 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.dp +import net.awan.pipelines.ui.theme.ICON_STATUS_DP +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XS +import net.awan.pipelines.ui.theme.SPACING_XXS import net.awan.pipelines.ui.theme.pipelinesText /** @@ -136,15 +139,15 @@ internal fun ColoredChip( modifier = modifier .clip(RoundedCornerShape(50)) .background(animatedColor.copy(alpha = 0.16f)) - .padding(horizontal = 8.dp, vertical = 2.dp), + .padding(horizontal = SPACING_S, vertical = SPACING_XXS), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_XS), ) { Icon( imageVector = icon, contentDescription = contentDescription, tint = animatedColor, - modifier = Modifier.size(14.dp), + modifier = Modifier.size(ICON_STATUS_DP), ) Text( text = label, diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/Sections.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/Sections.kt index 5fc82f1b..2c0a2222 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/Sections.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/Sections.kt @@ -33,6 +33,8 @@ import androidx.compose.ui.semantics.onClick 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.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_S import net.awan.pipelines.ui.theme.pipelinesText /** @@ -82,9 +84,9 @@ fun SectionHeader( Row( modifier = Modifier .fillMaxWidth() - .padding(horizontal = 16.dp, vertical = 10.dp), + .padding(horizontal = SPACING_L, vertical = 10.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_S), ) { Text( text = title, diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/States.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/States.kt index 5aeb805b..4fb03154 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/States.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/States.kt @@ -17,7 +17,10 @@ import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.unit.dp +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_XL +import net.awan.pipelines.ui.theme.SPACING_XS @Composable fun LoadingState(message: String = "Loading…", modifier: Modifier = Modifier) { @@ -27,14 +30,14 @@ fun LoadingState(message: String = "Loading…", modifier: Modifier = Modifier) verticalArrangement = Arrangement.Center, ) { CircularProgressIndicator() - Text(message, style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = 12.dp)) + Text(message, style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = SPACING_M)) } } @Composable fun ErrorState(message: String, onRetry: (() -> Unit)? = null, modifier: Modifier = Modifier) { Column( - modifier = modifier.fillMaxSize().padding(24.dp), + modifier = modifier.fillMaxSize().padding(SPACING_XL), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center, ) { @@ -45,7 +48,7 @@ fun ErrorState(message: String, onRetry: (() -> Unit)? = null, modifier: Modifie style = MaterialTheme.typography.bodyLarge, ) if (onRetry != null) { - Button(onClick = onRetry, modifier = Modifier.padding(top = 16.dp)) { Text("Retry") } + Button(onClick = onRetry, modifier = Modifier.padding(top = SPACING_L)) { Text("Retry") } } } } @@ -63,7 +66,7 @@ fun EmptyState( onAction: (() -> Unit)? = null, ) { Column( - modifier = modifier.fillMaxSize().padding(24.dp), + modifier = modifier.fillMaxSize().padding(SPACING_XL), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center, ) { @@ -74,7 +77,7 @@ fun EmptyState( color = MaterialTheme.colorScheme.onSurfaceVariant, ) if (actionLabel != null && onAction != null) { - Button(onClick = onAction, modifier = Modifier.padding(top = 16.dp)) { + Button(onClick = onAction, modifier = Modifier.padding(top = SPACING_L)) { Text(actionLabel) } } @@ -178,7 +181,7 @@ fun KeyValueRow( monospace: Boolean = false, ) { if (value.isBlank()) return - Column(modifier = modifier.fillMaxWidth().padding(vertical = 4.dp)) { + Column(modifier = modifier.fillMaxWidth().padding(vertical = SPACING_XS)) { Text(label, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.primary) Text( value, diff --git a/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineDetailScreen.kt b/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineDetailScreen.kt index f22c491c..7c989fd4 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineDetailScreen.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineDetailScreen.kt @@ -41,7 +41,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalClipboardManager -import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import net.awan.pipelines.data.ErrorMessages import net.awan.pipelines.data.protocol.PipelineDetail @@ -56,10 +55,10 @@ import net.awan.pipelines.ui.components.LoadPhase import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.PaneIdentity import net.awan.pipelines.ui.components.StateCrossfade -import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.collapsibleSection import net.awan.pipelines.ui.components.copyText import net.awan.pipelines.ui.components.detailLoadPhase +import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.pipelineDetailTabs import net.awan.pipelines.ui.components.rememberPaneContent import net.awan.pipelines.ui.components.rememberSectionExpansion @@ -67,6 +66,11 @@ import net.awan.pipelines.ui.graph.StageFieldRow import net.awan.pipelines.ui.graph.WorkflowGraph import net.awan.pipelines.ui.graph.effectiveStageType import net.awan.pipelines.ui.graph.stageDefinitionFields +import net.awan.pipelines.ui.theme.ICON_INLINE_DP +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XS import net.awan.pipelines.ui.theme.pipelinesText @OptIn(ExperimentalMaterial3Api::class) @@ -193,12 +197,12 @@ private fun PipelineSummaryTab(detail: PipelineDetail, wide: Boolean, modifier: DetailTabBody(wide, modifier) { columnModifier -> LazyColumn( modifier = columnModifier, - contentPadding = PaddingValues(vertical = 16.dp), + contentPadding = PaddingValues(vertical = SPACING_L), ) { item(key = "pipeline-summary") { Column( - modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), - verticalArrangement = Arrangement.spacedBy(4.dp), + modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L), + verticalArrangement = Arrangement.spacedBy(SPACING_XS), ) { Text(detail.name, style = text.screenTitle) Text( @@ -223,14 +227,14 @@ private fun PipelineSummaryTab(detail: PipelineDetail, wide: Boolean, modifier: Text( "No versions recorded.", style = text.meta, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S), ) } else { // The version list is bounded and small, so it renders in the // section's single animated body item; the rows are not lazy. Column(modifier = Modifier.fillMaxWidth()) { detail.versions.forEach { v -> - VersionRow(v, Modifier.padding(horizontal = 16.dp, vertical = 4.dp)) + VersionRow(v, Modifier.padding(horizontal = SPACING_L, vertical = SPACING_XS)) } } } @@ -249,12 +253,12 @@ private fun PipelineGraphTab( val text = pipelinesText() LazyColumn( modifier = modifier, - contentPadding = PaddingValues(vertical = 16.dp), + contentPadding = PaddingValues(vertical = SPACING_L), ) { item(key = "pipeline-graph") { Column( - modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), - verticalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L), + verticalArrangement = Arrangement.spacedBy(SPACING_S), ) { Text( "Pinch to zoom, drag to pan, tap a stage for details. Edges are labelled with their outcome; error* is the implicit fallback.", @@ -295,13 +299,13 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) { LazyColumn( modifier = modifier.fillMaxSize(), - contentPadding = PaddingValues(vertical = 16.dp), + contentPadding = PaddingValues(vertical = SPACING_L), ) { item(key = "source-actions") { Row( - modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), + modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_S), ) { OutlinedButton(onClick = { showRaw = !showRaw }) { Text(if (showRaw) "Rendered" else "Raw") @@ -310,9 +314,9 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) { Icon( imageVector = Icons.Default.ContentCopy, contentDescription = null, - modifier = Modifier.size(18.dp), + modifier = Modifier.size(ICON_INLINE_DP), ) - Spacer(Modifier.width(8.dp)) + Spacer(Modifier.width(SPACING_S)) Text("Copy definition") } } @@ -323,7 +327,7 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) { CodeBlock( "Definition source", detail.source, - Modifier.padding(horizontal = 16.dp, vertical = 4.dp), + Modifier.padding(horizontal = SPACING_L, vertical = SPACING_XS), maxHeight = null, ) } @@ -331,7 +335,7 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) { Text( "This definition has no stages.", style = text.meta, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S), ) } else -> sections.forEach { (stage, fields) -> @@ -345,8 +349,8 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) { Column( modifier = Modifier .fillMaxWidth() - .padding(horizontal = 16.dp, vertical = 8.dp), - verticalArrangement = Arrangement.spacedBy(4.dp), + .padding(horizontal = SPACING_L, vertical = SPACING_S), + verticalArrangement = Arrangement.spacedBy(SPACING_XS), ) { fields.forEach { field -> StageFieldRow(field) } } @@ -360,7 +364,7 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) { private fun VersionRow(v: VersionSummary, modifier: Modifier = Modifier) { val text = pipelinesText() Card(modifier.fillMaxWidth()) { - Row(Modifier.padding(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp)) { + Row(Modifier.padding(SPACING_M), horizontalArrangement = Arrangement.spacedBy(SPACING_M)) { Text("v${v.version}", style = text.cardTitle) Text("${v.stages} stages", style = text.meta) Text(v.createdAt, style = text.meta) @@ -384,7 +388,7 @@ private fun StartRunDialog( onDismissRequest = { if (!submitting) onDismiss() }, title = { Text("Start run: ${detail.name} v${detail.version}") }, text = { - Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { + Column(verticalArrangement = Arrangement.spacedBy(SPACING_S)) { OutlinedTextField( value = prompt, onValueChange = { prompt = it }, diff --git a/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineListScreen.kt b/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineListScreen.kt index 3266335b..287204aa 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineListScreen.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/screens/PipelineListScreen.kt @@ -33,7 +33,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import java.time.OffsetDateTime import net.awan.pipelines.data.protocol.PipelineSummary @@ -54,6 +53,8 @@ import net.awan.pipelines.ui.components.StateCrossfade import net.awan.pipelines.ui.components.animateListItem import net.awan.pipelines.ui.components.listLoadPhase import net.awan.pipelines.ui.components.paneSafeArea +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_S import net.awan.pipelines.ui.theme.pipelinesText @OptIn(ExperimentalMaterial3Api::class) @@ -154,7 +155,7 @@ fun PipelineListScreen( label = { Text("Search pipelines") }, leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) }, singleLine = true, - modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L, vertical = SPACING_S), ) val all = state.data ?: emptyList() val items = remember(all, query, sort, latestRuns, filters, runsKnown) { @@ -200,7 +201,7 @@ fun PipelineListScreen( ) LoadPhase.Content -> LazyColumn( modifier = Modifier.fillMaxSize(), - contentPadding = PaddingValues(vertical = 8.dp), + contentPadding = PaddingValues(vertical = SPACING_S), ) { items(items, key = { it.id }) { pipeline -> PipelineRow( @@ -219,7 +220,7 @@ fun PipelineListScreen( Text( text = state.error!!, color = MaterialTheme.colorScheme.error, - modifier = Modifier.padding(16.dp), + modifier = Modifier.padding(SPACING_L), ) } } @@ -323,7 +324,7 @@ private fun PipelineRow( } else { Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_S), ) { RunStatusChip(badge.state) Text( diff --git a/android/app/src/main/java/net/awan/pipelines/ui/screens/RunDetailScreen.kt b/android/app/src/main/java/net/awan/pipelines/ui/screens/RunDetailScreen.kt index f57b82ee..d6b1ef00 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/screens/RunDetailScreen.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/screens/RunDetailScreen.kt @@ -52,6 +52,7 @@ import net.awan.pipelines.data.protocol.SessionEvidence import net.awan.pipelines.ui.AppViewModel import net.awan.pipelines.ui.ArtifactGroup import net.awan.pipelines.ui.LoadState +import net.awan.pipelines.ui.artifactsEmptyMessage import net.awan.pipelines.ui.components.CodeBlock import net.awan.pipelines.ui.components.ColoredChip import net.awan.pipelines.ui.components.DetailTabBody @@ -61,13 +62,13 @@ import net.awan.pipelines.ui.components.KeyValueRow import net.awan.pipelines.ui.components.LoadPhase import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.PaneIdentity -import net.awan.pipelines.ui.components.StateCrossfade -import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.RunStatusIcon +import net.awan.pipelines.ui.components.StateCrossfade import net.awan.pipelines.ui.components.StatusChip -import net.awan.pipelines.ui.components.collapsibleSection import net.awan.pipelines.ui.components.clampTabIndex +import net.awan.pipelines.ui.components.collapsibleSection import net.awan.pipelines.ui.components.detailLoadPhase +import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.rememberPaneContent import net.awan.pipelines.ui.components.rememberSectionExpansion import net.awan.pipelines.ui.components.runDetailTabs @@ -75,7 +76,6 @@ import net.awan.pipelines.ui.components.runStateIcon import net.awan.pipelines.ui.components.runStateOf import net.awan.pipelines.ui.displayText import net.awan.pipelines.ui.formatDuration -import net.awan.pipelines.ui.artifactsEmptyMessage import net.awan.pipelines.ui.graph.ArtifactGallery import net.awan.pipelines.ui.graph.ArtifactSelection import net.awan.pipelines.ui.graph.ArtifactSelectionScaffold @@ -84,6 +84,13 @@ import net.awan.pipelines.ui.graph.graphColors import net.awan.pipelines.ui.graph.outcomeColor import net.awan.pipelines.ui.graph.rememberArtifactSelection import net.awan.pipelines.ui.runArtifactGroups +import net.awan.pipelines.ui.theme.ICON_INLINE_DP +import net.awan.pipelines.ui.theme.ICON_STATUS_DP +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XS +import net.awan.pipelines.ui.theme.SPACING_XXS import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.visitCount @@ -347,15 +354,15 @@ private fun RunSummaryTab( DetailTabBody(wide, modifier) { columnModifier -> LazyColumn( modifier = columnModifier, - contentPadding = PaddingValues(vertical = 16.dp), + contentPadding = PaddingValues(vertical = SPACING_L), ) { // The artifacts gallery leads the summary: the captured screenshots // are the first thing the operator sees, with the run's own facts // below it. item(key = "run-artifacts") { Column( - modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp), - verticalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L, vertical = SPACING_S), + verticalArrangement = Arrangement.spacedBy(SPACING_S), ) { Text("Artifacts", style = text.sectionHeader) if (artifactGroups.isEmpty()) { @@ -373,13 +380,13 @@ private fun RunSummaryTab( } item(key = "run-summary") { Column( - modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), - verticalArrangement = Arrangement.spacedBy(4.dp), + modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L), + verticalArrangement = Arrangement.spacedBy(SPACING_XS), ) { Text(run.name, style = text.screenTitle) Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_S), ) { StatusChip(label = run.status.ifBlank { state.label }, state = state) if (run.outcome.isNotBlank()) Text("outcome ${run.outcome}", style = text.meta) @@ -403,7 +410,7 @@ private fun RunSummaryTab( KeyValueRow("Finished", run.finishedAt) KeyValueRow("Duration", formatDuration(run.createdAt, run.finishedAt) ?: "") KeyValueRow("Retry of", if (run.retryOf > 0) "run ${run.retryOf}" else "") - CodeBlock("Diagnostic", run.diagnostic, Modifier.padding(top = 8.dp)) + CodeBlock("Diagnostic", run.diagnostic, Modifier.padding(top = SPACING_S)) } } } @@ -432,12 +439,12 @@ private fun RunGraphTab( val timeline = remember(run.steps) { runTimeline(run.steps) } LazyColumn( modifier = modifier, - contentPadding = PaddingValues(vertical = 16.dp), + contentPadding = PaddingValues(vertical = SPACING_L), ) { item(key = "run-graph") { Column( - modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), - verticalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L), + verticalArrangement = Arrangement.spacedBy(SPACING_S), ) { if (run.graph.stages.isEmpty()) { Text("This server did not include the run graph.", style = text.meta) @@ -480,14 +487,14 @@ private fun RunFieldSectionsTab( DetailTabBody(wide, modifier) { columnModifier -> LazyColumn( modifier = columnModifier, - contentPadding = PaddingValues(vertical = 16.dp), + contentPadding = PaddingValues(vertical = SPACING_L), ) { if (entries.isEmpty()) { item(key = "$keyPrefix-empty") { Text( emptyMessage, style = text.meta, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S), ) } } else { @@ -503,7 +510,7 @@ private fun RunFieldSectionsTab( CodeBlock( label = label, text = value.displayText(), - modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp), + modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_XS), ) } } @@ -531,12 +538,12 @@ private fun RunEvidenceTab( DetailTabBody(wide, modifier) { columnModifier -> LazyColumn( modifier = columnModifier, - contentPadding = PaddingValues(vertical = 16.dp), + contentPadding = PaddingValues(vertical = SPACING_L), ) { item(key = "evidence-reload") { Row( - modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), - horizontalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L), + horizontalArrangement = Arrangement.spacedBy(SPACING_S), ) { OutlinedButton(onClick = onLoadEvidence, enabled = !evidenceState.loading) { Text(if (evidenceState.loading) "Loading…" else "Reload session evidence") @@ -548,7 +555,7 @@ private fun RunEvidenceTab( Text( "Loading session evidence…", style = text.meta, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S), ) } evidenceState.error != null -> item(key = "evidence-error") { @@ -556,14 +563,14 @@ private fun RunEvidenceTab( evidenceState.error!!, color = MaterialTheme.colorScheme.error, style = text.meta, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S), ) } evidenceState.loaded && evidence.isEmpty() -> item(key = "evidence-empty") { Text( "No session evidence recorded.", style = text.meta, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S), ) } else -> evidence.forEach { record -> @@ -574,7 +581,7 @@ private fun RunEvidenceTab( expanded = expansion.isExpanded(sectionKey), onToggle = { expansion.toggle(sectionKey) }, ) { - EvidenceDetails(record, Modifier.padding(horizontal = 16.dp, vertical = 4.dp)) + EvidenceDetails(record, Modifier.padding(horizontal = SPACING_L, vertical = SPACING_XS)) } } } @@ -634,14 +641,14 @@ private fun RunTimelineTab( DetailTabBody(wide, modifier) { columnModifier -> LazyColumn( modifier = columnModifier, - contentPadding = PaddingValues(vertical = 16.dp), + contentPadding = PaddingValues(vertical = SPACING_L), ) { if (timeline.entries.isEmpty()) { item(key = "timeline-empty") { Text( "No visits recorded.", style = text.meta, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), + modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S), ) } } else { @@ -681,20 +688,20 @@ private fun TimelineRow(entry: TimelineEntry, onClick: () -> Unit) { modifier = Modifier .fillMaxWidth() .clickable(onClick = onClick) - .padding(horizontal = 16.dp, vertical = 10.dp), + .padding(horizontal = SPACING_L, vertical = 10.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(12.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_M), ) { RunStatusIcon( state = state, contentDescription = "Visit ${entry.visit} ${entry.stageKey}: ${state.label}", - modifier = Modifier.size(18.dp), + modifier = Modifier.size(ICON_INLINE_DP), tint = outcomeTint, ) - Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) { + Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(SPACING_XXS)) { Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_S), ) { Text( "${entry.stageKey} · visit ${entry.visit}", @@ -709,7 +716,7 @@ private fun TimelineRow(entry: TimelineEntry, onClick: () -> Unit) { imageVector = Icons.Default.AttachFile, contentDescription = "Visit ${entry.visit} has recorded artifacts", tint = MaterialTheme.colorScheme.onSurfaceVariant, - modifier = Modifier.size(14.dp), + modifier = Modifier.size(ICON_STATUS_DP), ) } if (entry.duration != null) { @@ -732,7 +739,7 @@ private fun TimelineRow(entry: TimelineEntry, onClick: () -> Unit) { @Composable private fun EvidenceDetails(evidence: SessionEvidence, modifier: Modifier = Modifier) { val text = pipelinesText() - Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(4.dp)) { + Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(SPACING_XS)) { if (evidence.sessionId.isNotBlank()) Text("session ${evidence.sessionId}", style = text.mono) if (evidence.backend.isNotBlank()) Text("backend ${evidence.backend}", style = text.meta) if (evidence.directory.isNotBlank()) Text("directory ${evidence.directory}", style = text.meta) diff --git a/android/app/src/main/java/net/awan/pipelines/ui/screens/RunHistoryScreen.kt b/android/app/src/main/java/net/awan/pipelines/ui/screens/RunHistoryScreen.kt index 4646facd..f6107d52 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/screens/RunHistoryScreen.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/screens/RunHistoryScreen.kt @@ -47,9 +47,6 @@ import java.time.format.DateTimeFormatter import net.awan.pipelines.data.protocol.RunSummary import net.awan.pipelines.data.protocol.UsageStats import net.awan.pipelines.ui.AppViewModel -import net.awan.pipelines.ui.components.RunState -import net.awan.pipelines.ui.components.RunStatusChip -import net.awan.pipelines.ui.components.RunStatusIcon import net.awan.pipelines.ui.components.EmptyState import net.awan.pipelines.ui.components.ErrorState import net.awan.pipelines.ui.components.FilterCheckItem @@ -59,6 +56,9 @@ import net.awan.pipelines.ui.components.ListRow import net.awan.pipelines.ui.components.LoadPhase import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.PaneIdentity +import net.awan.pipelines.ui.components.RunState +import net.awan.pipelines.ui.components.RunStatusChip +import net.awan.pipelines.ui.components.RunStatusIcon import net.awan.pipelines.ui.components.SortMenu import net.awan.pipelines.ui.components.StateCrossfade import net.awan.pipelines.ui.components.animateListItem @@ -67,7 +67,13 @@ import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.runStateColor import net.awan.pipelines.ui.components.runStateOf import net.awan.pipelines.ui.formatDuration +import net.awan.pipelines.ui.theme.ICON_LIST_DP +import net.awan.pipelines.ui.theme.ICON_STATUS_DP import net.awan.pipelines.ui.theme.PipelinesTextStyles +import net.awan.pipelines.ui.theme.SPACING_L +import net.awan.pipelines.ui.theme.SPACING_M +import net.awan.pipelines.ui.theme.SPACING_S +import net.awan.pipelines.ui.theme.SPACING_XXS import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.visitCount @@ -261,11 +267,11 @@ private fun RunHistoryContent( LazyColumn( modifier = modifier.fillMaxSize(), - contentPadding = PaddingValues(bottom = 16.dp), + contentPadding = PaddingValues(bottom = SPACING_L), ) { if (usage != null) { item(key = "usage") { - UsageMetrics(usage, Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) + UsageMetrics(usage, Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S)) } } if (scoped.isEmpty()) { @@ -307,7 +313,7 @@ private fun RunHistoryContent( error, color = MaterialTheme.colorScheme.error, style = pipelinesText().body, - modifier = animateListItem(Modifier.padding(16.dp)), + modifier = animateListItem(Modifier.padding(SPACING_L)), ) } } @@ -323,7 +329,7 @@ private fun DayHeader(label: String) { modifier = Modifier .fillMaxWidth() .background(MaterialTheme.colorScheme.background) - .padding(horizontal = 16.dp, vertical = 8.dp), + .padding(horizontal = SPACING_L, vertical = SPACING_S), ) } @@ -336,7 +342,7 @@ private fun DayHeader(label: String) { private fun UsageMetrics(usage: UsageStats, modifier: Modifier = Modifier) { val text = pipelinesText() Card(modifier.fillMaxWidth()) { - Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) { + Column(Modifier.padding(SPACING_L), verticalArrangement = Arrangement.spacedBy(SPACING_M)) { Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, @@ -348,8 +354,8 @@ private fun UsageMetrics(usage: UsageStats, modifier: Modifier = Modifier) { } } FlowRow( - horizontalArrangement = Arrangement.spacedBy(16.dp), - verticalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_L), + verticalArrangement = Arrangement.spacedBy(SPACING_S), ) { Metric("Succeeded", usage.succeeded.toString(), runStateColor(RunState.Succeeded), text) Metric("Failed", usage.failed.toString(), runStateColor(RunState.Failed), text) @@ -392,13 +398,13 @@ private fun RunRow( RunStatusIcon( state = state, contentDescription = null, - modifier = Modifier.size(20.dp), + modifier = Modifier.size(ICON_LIST_DP), ) }, ) { Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_S), ) { Text( run.name, @@ -412,13 +418,13 @@ private fun RunRow( Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(SPACING_S), ) { RunStatusChip(state) if (run.executing) { // The summary carries no total step count, so progress is shown // honestly as an indeterminate indicator plus completed visits. - CircularProgressIndicator(modifier = Modifier.size(14.dp), strokeWidth = 2.dp) + CircularProgressIndicator(modifier = Modifier.size(ICON_STATUS_DP), strokeWidth = 2.dp) } Text(progressText(run), style = text.meta, maxLines = 1, overflow = TextOverflow.Ellipsis) } @@ -450,7 +456,7 @@ private fun VersionChip(version: String) { modifier = Modifier .clip(RoundedCornerShape(50)) .background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f)) - .padding(horizontal = 8.dp, vertical = 2.dp), + .padding(horizontal = SPACING_S, vertical = SPACING_XXS), ) } diff --git a/android/app/src/main/java/net/awan/pipelines/ui/theme/Dimens.kt b/android/app/src/main/java/net/awan/pipelines/ui/theme/Dimens.kt index a6930347..9e5eb49a 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/theme/Dimens.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/theme/Dimens.kt @@ -41,6 +41,23 @@ internal val SPACING_XL = 24.dp /** Eight steps of the shared 4dp spacing scale; the largest padding in the UI. */ internal val SPACING_XXL = 32.dp +// ---- Icon glyph sizes ------------------------------------------------------ +// A glyph is not a gap, so icon sizes sit outside the spacing scale and are +// named here rather than re-derived: the status/loading glyph, the inline action +// glyph, a list row's leading glyph and the wide detail rail's tab glyph. + +/** Status and loading glyph size (run-status icon, indeterminate indicator). */ +internal val ICON_STATUS_DP = 14.dp + +/** Inline action glyph size (copy/back-adjacent icons inside a row). */ +internal val ICON_INLINE_DP = 18.dp + +/** List leading glyph size (a run row's status icon). */ +internal val ICON_LIST_DP = 20.dp + +/** Wide detail-rail tab glyph size. */ +internal val ICON_RAIL_DP = 24.dp + // ---- Pane geometry (ui/components/SlidingPaneStack.kt) --------------------- // The sliding pane stack derives every offset and width from these plus the // measured host width and the system insets; no screen hardcodes a peek or pane diff --git a/android/app/src/test/java/net/awan/pipelines/ui/theme/DimensTest.kt b/android/app/src/test/java/net/awan/pipelines/ui/theme/DimensTest.kt index 7cfa3078..934409c4 100644 --- a/android/app/src/test/java/net/awan/pipelines/ui/theme/DimensTest.kt +++ b/android/app/src/test/java/net/awan/pipelines/ui/theme/DimensTest.kt @@ -26,7 +26,7 @@ class DimensTest { private val allowList: Map = mapOf( // Structural / hairline values that are not design dimensions. "0.dp" to "Structural zero: no inset, clamped-to-zero, or an empty-guard comparison.", - "2.dp" to "Progress/divider hairline strokes and 2dp icon/line gaps; half the 4dp base step.", + "2.dp" to "Progress/divider hairline strokes (progress indicators, graph hairlines); half the 4dp base step.", "3.dp" to "Tonal and border hairline (elevation/border), not a layout dimension.", "6.dp" to "Pill shadow elevation only; not layout geometry.", @@ -35,14 +35,11 @@ class DimensTest { "8.dp" to "Two 4dp steps (SPACING_S): standard stack/row gap and icon inset.", "12.dp" to "Three 4dp steps (SPACING_M): standard inter-item arrangement gap.", "16.dp" to "Four 4dp steps (SPACING_L): standard screen, card and app-bar padding.", - "24.dp" to "Six 4dp steps (SPACING_XL): empty/error padding and the 24dp progress glyph.", - "32.dp" to "Eight 4dp steps (SPACING_XXL): workflow-graph content padding.", + "24.dp" to "Artifact progress glyph and artifact-viewer padding (ui/graph); not yet migrated.", "10.dp" to "Dense row padding finer than the 4dp scale (10dp vertical); kept verbatim.", - // Component glyph sizes. - "14.dp" to "Status/loading icon glyph size (14dp).", - "18.dp" to "Inline icon glyph size (18dp).", - "20.dp" to "List icon glyph size and code-block inner padding (20dp).", + // Component glyph sizes still outside the token file (the list/detail + // screens' 14/18/20/24dp glyphs moved onto Dimens' ICON_* tokens). "48.dp" to "Minimum touch target and graph minimum visible span (48dp).", // Workflow-graph pixel geometry now lives in ui/theme/Dimens.kt as the @@ -54,9 +51,7 @@ class DimensTest { "320.dp" to "Code block maximum height (CODE_BLOCK_MAX_HEIGHT).", // Typography (sp), which is owned by Typography.kt, not the dimension file. - "11.sp" to "Workflow-graph edge-label font size.", "12.sp" to "labelMedium/bodySmall size; Material typography role.", - "13.sp" to "Workflow-graph node-label font size.", "14.sp" to "bodyMedium size; Material typography role.", "15.sp" to "titleSmall size; Material typography role.", "16.sp" to "bodyLarge/titleMedium size; Material typography role.",