Skip to content

Commit 0838196

Browse files
robster7674Robclaude
authored
fix(ui): collapse AI Destination items by default (#43)
* fix(ui): collapse AI Destination items by default Start with expandedId = null so all destination cards are collapsed when the screen opens, giving a clean overview instead of auto-expanding the first item. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ui): don't auto-expand after delete when nothing was open Guard the expandedId reassignment in deleteDestination so it only picks a successor card if the user had one open. Without the guard, deleting any destination would silently expand a card even when the screen started (or was left) fully collapsed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ui): only move focus when the deleted card was open The previous guard (expandedId != null) moved focus to the first enabled destination whenever anything was expanded, even if the deleted card was a different one. Change the condition to (expandedId == destination.id) so focus only shifts when the card being deleted is the one currently open; all other expanded cards are left untouched. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Rob <rob@performanceinsights.ai> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 09e06ae commit 0838196

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

Common/src/mobile/java/tk/glucodata/ui/OutboundApiSettingsScreen.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ import tk.glucodata.ui.components.cardShape
9494
fun OutboundApiSettingsScreen(navController: NavController) {
9595
val context = LocalContext.current
9696
var config by remember { mutableStateOf(OutboundApiSettings.load(context)) }
97-
var expandedId by rememberSaveable {
98-
mutableStateOf(config.destinations.firstOrNull { it.enabled }?.id ?: config.destinations.firstOrNull()?.id)
99-
}
97+
var expandedId by rememberSaveable { mutableStateOf<String?>(null) }
10098
var showSecretForId by rememberSaveable { mutableStateOf<String?>(null) }
10199
var showAddSheet by rememberSaveable { mutableStateOf(false) }
102100
var pendingDelete by remember { mutableStateOf<OutboundApiSettings.Destination?>(null) }
@@ -127,7 +125,7 @@ fun OutboundApiSettingsScreen(navController: NavController) {
127125
fun deleteDestination(destination: OutboundApiSettings.Destination) {
128126
val remaining = config.destinations.filterNot { it.id == destination.id }
129127
save(config.copy(destinations = remaining))
130-
expandedId = remaining.firstOrNull { it.enabled }?.id ?: remaining.firstOrNull()?.id
128+
if (expandedId == destination.id) expandedId = remaining.firstOrNull { it.enabled }?.id ?: remaining.firstOrNull()?.id
131129
pendingDelete = null
132130
showSecretForId = null
133131
}

0 commit comments

Comments
 (0)