shared(nearby): add layerDisplayName and wire into subtitleFor;
app(found): use shared layerDisplayName for Hittat subtitle (no UI change)
This commit is contained in:
12
shared/src/commonMain/kotlin/app/klottr/nearby/LayerNames.kt
Normal file
12
shared/src/commonMain/kotlin/app/klottr/nearby/LayerNames.kt
Normal file
@@ -0,0 +1,12 @@
|
||||
package app.klottr.nearby // Samlad namngivning av lager
|
||||
|
||||
import app.klottr.util.FoundStore // Lagerkonstanter
|
||||
|
||||
// Visningsnamn för lager (svenska)
|
||||
fun layerDisplayName(layer: String): String = when (layer) {
|
||||
FoundStore.LAYER_WIKI -> "Wikipedia" //
|
||||
FoundStore.LAYER_DM -> "DigitaltMuseum" //
|
||||
FoundStore.LAYER_FORNSOK -> "Fornsök" //
|
||||
FoundStore.LAYER_KLOTTER -> "Klotter" //
|
||||
else -> "Plats" //
|
||||
}
|
||||
@@ -4,15 +4,7 @@ import app.klottr.util.FoundStore // För lagerkonstanter (WIKI, DM, FO
|
||||
import app.klottr.nearby.NearbyEntryShared // Vår delade radmodell
|
||||
|
||||
// Bygg undertext: "<Lager-namn> • <avstånd> m"
|
||||
fun subtitleFor(entry: NearbyEntryShared): String = buildString { //
|
||||
append(
|
||||
when (entry.layer) {
|
||||
FoundStore.LAYER_WIKI -> "Wikipedia"
|
||||
FoundStore.LAYER_DM -> "DigitaltMuseum"
|
||||
FoundStore.LAYER_FORNSOK -> "Fornsök"
|
||||
FoundStore.LAYER_KLOTTER -> "Klotter"
|
||||
else -> "Plats"
|
||||
}
|
||||
)
|
||||
fun subtitleFor(entry: NearbyEntryShared): String = buildString { //
|
||||
append(layerDisplayName(entry.layer)) // Använd delad namngivare istället för inline-when
|
||||
append(" • ${entry.distanceM} m")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user