Show recent finds under "Hem" tab in new UI using reused KlottrHomeContent logic
This commit is contained in:
@@ -2,6 +2,7 @@ package app.klottr
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
@@ -321,8 +322,8 @@ fun KlottrAppShell(
|
||||
label = { Text("Lager") }
|
||||
)
|
||||
NavigationBarItem(
|
||||
selected = false,
|
||||
onClick = { /* TODO Nära */ },
|
||||
selected = (selectedTab == "nearby"),
|
||||
onClick = { selectedTab = "nearby" },
|
||||
icon = { Icon(Icons.Filled.Place, contentDescription = "Nära") },
|
||||
label = { Text("Nära") }
|
||||
)
|
||||
@@ -421,6 +422,50 @@ fun KlottrAppShell(
|
||||
footer = { /* tom i nya layouten */ }
|
||||
)
|
||||
}
|
||||
"nearby" -> {
|
||||
Column(modifier = Modifier.padding(innerPadding)) {
|
||||
// Övre halvan: karta
|
||||
Box(modifier = Modifier.weight(1f).fillMaxWidth()) {
|
||||
MapDialog(
|
||||
onClose = { /* inget, vi stänger inte i nya UI */ },
|
||||
onKlotterClick = { id, la, lo, label ->
|
||||
openKlotter = OpenKlotter(id = id, lat = la, lon = lo, label = label)
|
||||
},
|
||||
onOpenUrl = { _, url -> AppNavigator.openUrl(url) },
|
||||
isKnownNote = { noteId ->
|
||||
FoundStore.getAll().any { it.layer == LAYER_KLOTTER && it.id == noteId.toString() }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Nedre halvan: närliggande-lista
|
||||
Box(modifier = Modifier.weight(1f).fillMaxWidth()) {
|
||||
NearbyDialog(
|
||||
loading = nearbyLoading,
|
||||
error = nearbyError,
|
||||
lat = lastKnownLat,
|
||||
lon = lastKnownLon,
|
||||
entries = nearbyBundle?.entries.orEmpty(),
|
||||
dm = nearbyBundle?.dm.orEmpty(),
|
||||
forn = nearbyBundle?.forn.orEmpty(),
|
||||
onOpenAction = { action ->
|
||||
when (action) {
|
||||
is FoundOpenAction.Klotter ->
|
||||
openKlotter = OpenKlotter(action.id, action.lat, action.lon, action.label)
|
||||
is FoundOpenAction.Wiki ->
|
||||
openWiki = OpenWiki(action.pageId, action.lat, action.lon)
|
||||
is FoundOpenAction.Fornsok ->
|
||||
openFornsok = OpenFornsok(action.item)
|
||||
is FoundOpenAction.DigitaltMuseum ->
|
||||
openDm = action.item
|
||||
FoundOpenAction.None -> Unit
|
||||
}
|
||||
},
|
||||
onClose = { /* inget i nya UI */ }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
Box(modifier = Modifier.padding(innerPadding)) {
|
||||
Text("Här kommer ${selectedTab}-sidan")
|
||||
|
||||
Reference in New Issue
Block a user