fix(settings): grey out API & Access while offline

New API Key/delete were already gated on isEffectivelyOnline, but
nothing visually signaled offline state the way Preferences/Profile do
— added the same offline hint banner plus dimmed+disabled the key list
itself, and gated the sheet's own Create button too (in case Offline
Mode gets toggled on while the sheet is already open).
This commit is contained in:
2026-08-18 16:49:45 +01:00
parent 45c950d474
commit 26b0d7b118
+7 -1
View File
@@ -764,6 +764,10 @@ struct SettingsView: View {
Divider().frame(maxWidth: 480)
if !isEffectivelyOnline {
offlineSettingsHint
}
HStack {
Text("Personal keys")
.font(.headline)
@@ -774,6 +778,8 @@ struct SettingsView: View {
.frame(maxWidth: 480)
apiKeysList
.disabled(!isEffectivelyOnline)
.opacity(isEffectivelyOnline ? 1 : 0.4)
}
.task { await refreshApiKeys() }
.sheet(isPresented: $isShowingCreateApiKey) {
@@ -908,7 +914,7 @@ struct SettingsView: View {
} else {
Button("Create") { Task { await createApiKey() } }
.buttonStyle(.borderedProminent)
.disabled(newApiKeyName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
.disabled(newApiKeyName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || !isEffectivelyOnline)
}
}
}