myTeamSpeak: account items under Identities and Bookmarks
The items the account synchronises are listed in an Identities and a Bookmarks section, each with a Select all / Deselect all button on its heading line, on desktop and Android. The desktop tables drop the Type column and name the details column Nickname or Address. FormPanel.sectionHeader and addSection take an optional trailing component. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,7 @@ import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@@ -184,15 +185,31 @@ fun MyTeamSpeakScreen(vm: SessionController, onBack: () -> Unit) {
|
||||
style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary)
|
||||
}
|
||||
}
|
||||
items(rows, key = { it.item.uuid() }) { row ->
|
||||
val toggle = { rows = rows.map { if (it === row) it.copy(selected = !it.selected) else it } }
|
||||
ListItem(
|
||||
headlineContent = { Text(name(row.item), maxLines = 1, overflow = TextOverflow.Ellipsis) },
|
||||
supportingContent = { Text(details(row.item), maxLines = 1, overflow = TextOverflow.Ellipsis) },
|
||||
leadingContent = { Checkbox(row.selected, { toggle() }) },
|
||||
trailingContent = if (row.imported) ({ Text("Imported", style = MaterialTheme.typography.labelMedium) }) else null,
|
||||
modifier = Modifier.clickable(onClick = toggle),
|
||||
)
|
||||
for ((title, section) in listOf(
|
||||
"Identities" to rows.filter { it.item is SyncItem.Identity },
|
||||
"Bookmarks" to rows.filter { it.item is SyncItem.Bookmark },
|
||||
)) {
|
||||
if (section.isEmpty()) continue
|
||||
item {
|
||||
val select = section.any { !it.selected }
|
||||
Row(Modifier.padding(start = 16.dp, top = 8.dp, end = 8.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(title, Modifier.weight(1f),
|
||||
style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
TextButton(onClick = {
|
||||
rows = rows.map { if (it in section) it.copy(selected = select) else it }
|
||||
}) { Text(if (select) "Select all" else "Deselect all") }
|
||||
}
|
||||
}
|
||||
items(section, key = { it.item.uuid() }) { row ->
|
||||
val toggle = { rows = rows.map { if (it === row) it.copy(selected = !it.selected) else it } }
|
||||
ListItem(
|
||||
headlineContent = { Text(name(row.item), maxLines = 1, overflow = TextOverflow.Ellipsis) },
|
||||
supportingContent = { Text(details(row.item), maxLines = 1, overflow = TextOverflow.Ellipsis) },
|
||||
leadingContent = { Checkbox(row.selected, { toggle() }) },
|
||||
trailingContent = if (row.imported) ({ Text("Imported", style = MaterialTheme.typography.labelMedium) }) else null,
|
||||
modifier = Modifier.clickable(onClick = toggle),
|
||||
)
|
||||
}
|
||||
}
|
||||
if (rows.isNotEmpty()) {
|
||||
item {
|
||||
@@ -234,7 +251,7 @@ private fun Detail(label: String, value: String) {
|
||||
|
||||
private fun name(item: SyncItem) = when (item) {
|
||||
is SyncItem.Bookmark -> item.name().ifBlank { item.address() }
|
||||
is SyncItem.Identity -> "Identity: ${item.name()}"
|
||||
is SyncItem.Identity -> item.name()
|
||||
else -> ""
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user