shared(ui): FoundContent – add isBold param and forward to FoundList
app(found): pass isBold using !FoundStore.isAway(...) in FoundContent call
This commit is contained in:
77
shared/src/commonMain/kotlin/app/klottr/ui/FoundContent.kt
Normal file
77
shared/src/commonMain/kotlin/app/klottr/ui/FoundContent.kt
Normal file
@@ -0,0 +1,77 @@
|
||||
package app.klottr.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.foundation.text.BasicText
|
||||
import app.klottr.util.FoundEntry
|
||||
import app.klottr.nearby.foundSubtitle
|
||||
import app.klottr.nearby.layerDisplayName
|
||||
|
||||
/**
|
||||
* Material-fritt innehåll för "Hittat".
|
||||
* - Visar "Inga fynd ännu." om listan är tom.
|
||||
* - Annars renderar listan via FoundList med delegater för label/undertext/klick.
|
||||
*/
|
||||
@Composable
|
||||
fun FoundContent(
|
||||
entries: List<FoundEntry>,
|
||||
currentLat: Double?,
|
||||
currentLon: Double?,
|
||||
showCoords: Boolean,
|
||||
// Förbättrade etiketter (klotter): nyckel = "layer|id"
|
||||
labelOverrides: Map<String, String>,
|
||||
// Avgör om rad ska vara klickbar (lagerstyrt)
|
||||
isClickable: (FoundEntry) -> Boolean,
|
||||
// Klickhantering (öppna detalj etc.)
|
||||
onEntryClick: (FoundEntry) -> Unit,
|
||||
isBold: (FoundEntry) -> Boolean,
|
||||
// Plattformens formatterare (Android skickar ::formatDistance/::formatCoords)
|
||||
distanceFormatter: (Int) -> String,
|
||||
coordsFormatter: (Double, Double) -> String,
|
||||
rowTextStyle: TextStyle
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(max = 420.dp)
|
||||
.padding(0.dp)
|
||||
) {
|
||||
if (entries.isEmpty()) {
|
||||
BasicText("Inga fynd ännu.", style = rowTextStyle)
|
||||
} else {
|
||||
FoundList(
|
||||
entries = entries,
|
||||
labelFor = { f ->
|
||||
val key = "${f.layer}|${f.id}"
|
||||
val base = labelOverrides[key] ?: f.label
|
||||
if (base.isBlank()) {
|
||||
when (layerDisplayName(f.layer)) {
|
||||
"Klotter" -> "Okänt klotter"
|
||||
else -> layerDisplayName(f.layer)
|
||||
}
|
||||
} else base
|
||||
},
|
||||
subtitleFor = { f ->
|
||||
foundSubtitle(
|
||||
entry = f,
|
||||
currentLat = currentLat,
|
||||
currentLon = currentLon,
|
||||
showCoords = showCoords,
|
||||
distanceFormatter = distanceFormatter,
|
||||
coordsFormatter = coordsFormatter
|
||||
)
|
||||
},
|
||||
isClickable = isClickable,
|
||||
onEntryClick = onEntryClick,
|
||||
isBold = isBold,
|
||||
rowTextStyle = rowTextStyle
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user