Files
Klottr/shared/src/commonMain/kotlin/app/klottr/ui/MapPanelShell.kt
Fabian Norlin 4e2d062329 KMP/UI: shared scrollbars, common “Nearby” open resolver, and map panel shell — wired into app
shared(ui): FoundList fills its space and adds a lightweight, material-free scrollbar thumb; expose optional LazyListState.
shared(ui): Harden FoundList scrollbar math (non-negative weights, safe totals) and use Color.takeOrElse for color fallback to avoid startup crash.
shared(ui): NearbyList fills its space and adds the same lightweight scrollbar; optional LazyListState support.

shared(nearby): Add resolveNearbyOpenAction for Nearby entries; map to FoundOpenAction (Klotter/Wiki/Fornsok/DM); fix import placement and remove unused import.
shared(ui): NearbyContent now fills its space (remove 420dp height cap) and delegates onEntryClick to resolveNearbyOpenAction.

shared(ui): Add material-free MapPanelShell to host title/main/footers above map and reuse across platforms.

app(ui): Use MapPanelShell for the main “Senaste” panel in KlottrApp — move header, FoundContent area, and login/logout row into the shared shell; main area is full-height.
app(ui): Use MapPanelShell inside NearbyDialog and set a sensible max height (~80% of screen) so content is clearly scrollable; keep AlertDialog title/buttons.
2025-09-14 17:55:43 +02:00

72 lines
2.2 KiB
Kotlin

package app.klottr.ui
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.foundation.text.BasicText
/**
* Material-fritt skal för en panel ovanpå en karta.
* Innehåller valfri titel/överdel, en huvudyta som fyller resten av höjden,
* samt en valfri fotrad (t.ex. knappar).
*/
@Composable
fun MapPanelShell(
modifier: Modifier = Modifier,
title: String? = null,
titleTextStyle: TextStyle,
topRightContent: (@Composable () -> Unit)? = null,
mainContent: @Composable () -> Unit,
footerContent: (@Composable () -> Unit)? = null
) {
Column(modifier = modifier.fillMaxSize()) {
if (title != null || topRightContent != null) {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 12.dp)
) {
if (title != null) {
BasicText(
text = title,
style = titleTextStyle
)
}
if (topRightContent != null) {
Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.CenterEnd
) {
topRightContent()
}
}
}
}
Box(
modifier = Modifier
.weight(1f)
.fillMaxWidth()
) {
mainContent()
}
if (footerContent != null) {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 12.dp, vertical = 8.dp)
) {
footerContent()
}
}
}
}