From a8ebd40f7eb702dd216c384146a839790f2e6d40 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 13:21:26 +0000 Subject: [PATCH] feat(app): edit layout with grid and list side by side in expanded width (TAB-5) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01XSah6ajRrmDuPE8GSmyvsx --- docs/code-index.md | 2 + docs/concept.md | 3 +- .../feature/entities/ui/EditLayoutScreen.kt | 74 +++++++++++++++---- 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/docs/code-index.md b/docs/code-index.md index 86c4098..ee5abfc 100644 --- a/docs/code-index.md +++ b/docs/code-index.md @@ -1671,6 +1671,8 @@ Lists every class and function of the app with signature, file and a one-line KD | `EditTile` | `private fun EditTile(tile: Tile, actions: EditActions, modifier: Modifier, lifted: Boolean)` | `feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditGrid.kt` | A tile of the edit grid: handle, remove badge, name with pencil and size label; [lifted] while dragged. | | `AddTile` | `private fun AddTile(onAdd: () -> Unit, modifier: Modifier)` | `feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditGrid.kt` | The dashed *Add entities* tile at the end of the grid (M-06). | | `EditLayoutScreen` | `fun EditLayoutScreen(onClose: () -> Unit, onAddEntities: (String) -> Unit, viewModel: EditLayoutViewModel = hiltViewModel())` | `feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt` | Edit layout of a room (M-06, M-07, concept 7.2): *Close* discards (after asking when something changed), *Done* | +| `GridAndList` | `private fun GridAndList(state: EditLayoutUiState, actions: EditActions)` | `feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt` | Expanded (concept 15.7): the grid on the left and the list beside it for good, so there is no Grid/List switch. | +| `ArrangeHint` | `private fun ArrangeHint(@StringRes text: Int)` | `feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt` | The one-line instruction above the grid or the list. | | `TopBar` | `private fun TopBar(state: EditLayoutUiState, onClose: () -> Unit, onDone: () -> Unit)` | `feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt` | Close*, "Edit Living room" and *Done*. | | `ModeRow` | `private fun ModeRow(mode: ArrangeMode, onMode: (ArrangeMode) -> Unit)` | `feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt` | Grid* or *List* (M-07). | | `Rename` | `private fun Rename(tile: Tile, viewModel: EditLayoutViewModel, onDismiss: () -> Unit)` | `feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt` | The rename dialog of M-07 for [tile]; saved at once. | diff --git a/docs/concept.md b/docs/concept.md index c1e1d8f..df7c3cd 100644 --- a/docs/concept.md +++ b/docs/concept.md @@ -1341,7 +1341,8 @@ Between portrait and landscape most tablets cross 840 dp. Rooms, Places and Sche - *Add entities* is a dialog of at most 720 × 640 dp (90 % of a smaller window) on a normal destination, so the screen behind it shows only the plain background, not the room. - The lock screen stays a centred card of 480 dp; the two-column form is only built for sign-in. -- Not built yet: the permanent list beside the grid in the edit layout (T-08; Grid/List remains a switch), the layout for windows below 480 dp height, and keyboard and mouse operation of the grid (arrow keys, right click). +- The edit layout shows the grid and the list side by side from Expanded (T-08, list pane 380 dp, no Grid/List switch); in Medium and Compact the switch stays. +- Not built yet: the layout for windows below 480 dp height, and keyboard and mouse operation of the grid (arrow keys, right click). - The mockups T-01 to T-09 stay in place until real screenshots exist. ![T-01 Rooms, landscape](mockups/png/T-01-rooms-landscape.png) ![T-02 Tile details, landscape](mockups/png/T-02-rooms-detail-landscape.png) ![T-03 Rooms, portrait](mockups/png/T-03-rooms-portrait.png) ![T-04 Tile details, portrait](mockups/png/T-04-rooms-sheet-portrait.png) ![T-05 Places, landscape](mockups/png/T-05-places-landscape.png) diff --git a/feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt b/feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt index 49f94ce..d472ee0 100644 --- a/feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt +++ b/feature/entities/src/main/kotlin/com/stacknoise/haac/feature/entities/ui/EditLayoutScreen.kt @@ -1,14 +1,18 @@ package com.stacknoise.haac.feature.entities.ui import androidx.activity.compose.BackHandler +import androidx.annotation.StringRes import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.AlertDialog @@ -36,6 +40,9 @@ import androidx.compose.ui.unit.dp import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.stacknoise.haac.core.common.ui.ErrorMessage +import com.stacknoise.haac.core.common.ui.LocalWindowWidthClass +import com.stacknoise.haac.core.common.ui.WindowWidthClass +import com.stacknoise.haac.core.common.ui.theme.HaacColors import com.stacknoise.haac.core.common.ui.theme.HaacShapes import com.stacknoise.haac.core.common.ui.theme.haacButtonColors import com.stacknoise.haac.core.common.ui.theme.haacSegmentedColors @@ -69,21 +76,20 @@ fun EditLayoutScreen( ) Column(modifier = Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)) { TopBar(state, onClose = close, onDone = viewModel::onDone) - Column(modifier = Modifier.verticalScroll(rememberScrollState()).padding(horizontal = 20.dp)) { - ModeRow(state.mode, viewModel::onMode) - state.error?.let { ErrorMessage(it) } - val hint = if (state.mode == ArrangeMode.GRID) R.string.edit_hint_grid else R.string.edit_hint_list - Text( - stringResource(hint), - style = MaterialTheme.typography.bodyMedium, - color = secondaryColor(), - modifier = Modifier.padding(vertical = 12.dp), - ) - if (draft != null && draft.tiles.isEmpty() && state.mode == ArrangeMode.LIST) { - Text(stringResource(R.string.edit_empty), style = MaterialTheme.typography.bodyLarge) - } - draft?.let { - if (state.mode == ArrangeMode.GRID) EditGrid(it.tiles, actions) else ArrangeList(it.tiles, actions) + if (LocalWindowWidthClass.current == WindowWidthClass.Expanded) { + GridAndList(state, actions) + } else { + Column(modifier = Modifier.verticalScroll(rememberScrollState()).padding(horizontal = 20.dp)) { + ModeRow(state.mode, viewModel::onMode) + state.error?.let { ErrorMessage(it) } + val hint = if (state.mode == ArrangeMode.GRID) R.string.edit_hint_grid else R.string.edit_hint_list + ArrangeHint(hint) + if (draft != null && draft.tiles.isEmpty() && state.mode == ArrangeMode.LIST) { + Text(stringResource(R.string.edit_empty), style = MaterialTheme.typography.bodyLarge) + } + draft?.let { + if (state.mode == ArrangeMode.GRID) EditGrid(it.tiles, actions) else ArrangeList(it.tiles, actions) + } } } } @@ -92,6 +98,44 @@ fun EditLayoutScreen( if (asking) DiscardDialog(onDiscard = onClose, onKeep = { asking = false }) } +/** Expanded (concept 15.7): the grid on the left and the list beside it for good, so there is no Grid/List switch. */ +@Composable +private fun GridAndList(state: EditLayoutUiState, actions: EditActions) { + val tiles = state.draft?.tiles + Row(Modifier.fillMaxSize()) { + Column(Modifier.weight(1f).fillMaxHeight().verticalScroll(rememberScrollState()).padding(horizontal = 20.dp)) { + state.error?.let { ErrorMessage(it) } + ArrangeHint(R.string.edit_hint_grid) + tiles?.let { EditGrid(it, actions) } + } + Box(Modifier.width(1.dp).fillMaxHeight().background(HaacColors.Outline)) + Column( + modifier = Modifier + .width(DetailPaneWidth) + .fillMaxHeight() + .verticalScroll(rememberScrollState()) + .padding(horizontal = 20.dp), + ) { + ArrangeHint(R.string.edit_hint_list) + if (tiles != null && tiles.isEmpty()) { + Text(stringResource(R.string.edit_empty), style = MaterialTheme.typography.bodyLarge) + } + tiles?.let { ArrangeList(it, actions) } + } + } +} + +/** The one-line instruction above the grid or the list. */ +@Composable +private fun ArrangeHint(@StringRes text: Int) { + Text( + stringResource(text), + style = MaterialTheme.typography.bodyMedium, + color = secondaryColor(), + modifier = Modifier.padding(vertical = 12.dp), + ) +} + /** *Close*, "Edit Living room" and *Done*. */ @Composable private fun TopBar(state: EditLayoutUiState, onClose: () -> Unit, onDone: () -> Unit) {