Cleanup and string fixes (#684)

* Setup UI tweaks.

* Protection level string

* Toolbar cleanup

* More strings.
This commit is contained in:
Max Goedjen
2025-09-09 23:00:26 -07:00
committed by GitHub
parent 8c516e128a
commit a5b43ea046
5 changed files with 36 additions and 574 deletions

View File

@@ -21,9 +21,10 @@ struct SetupView: View {
StepView(
title: .setupAgentTitle,
description: .setupAgentDescription,
detail: .setupAgentActivityMonitorDescription,
systemImage: "lock.laptopcomputer",
) {
setupButton(
SetupButton(
.setupAgentInstallButton,
complete: installed,
width: buttonWidth
@@ -40,7 +41,7 @@ struct SetupView: View {
description: .setupUpdatesDescription,
systemImage: "network.badge.shield.half.filled",
) {
setupButton(
SetupButton(
.setupUpdatesOkButton,
complete: updates,
width: buttonWidth
@@ -54,7 +55,7 @@ struct SetupView: View {
description: .setupIntegrationsDescription,
systemImage: "firewall",
) {
setupButton(
SetupButton(
.setupIntegrationsButton,
complete: integrations,
width: buttonWidth
@@ -63,7 +64,7 @@ struct SetupView: View {
}
}
}
.onPreferenceChange(setupButton.WidthKey.self) { width in
.onPreferenceChange(SetupButton.WidthKey.self) { width in
buttonWidth = width
}
.background(.white.opacity(0.1), in: RoundedRectangle(cornerRadius: 10))
@@ -88,7 +89,7 @@ struct SetupView: View {
}
}
struct setupButton: View {
struct SetupButton: View {
struct WidthKey: @MainActor PreferenceKey {
@MainActor static var defaultValue: CGFloat? = nil
@@ -144,12 +145,20 @@ struct StepView<Content: View>: View {
let title: LocalizedStringResource
let icon: Image
let description: LocalizedStringResource
let detail: LocalizedStringResource?
let actions: Content
init(title: LocalizedStringResource, description: LocalizedStringResource, systemImage: String, actions: () -> Content) {
init(
title: LocalizedStringResource,
description: LocalizedStringResource,
detail: LocalizedStringResource? = nil,
systemImage: String,
actions: () -> Content
) {
self.title = title
self.icon = Image(systemName: systemImage)
self.description = description
self.detail = detail
self.actions = actions()
}
@@ -165,6 +174,11 @@ struct StepView<Content: View>: View {
Text(title)
.bold()
Text(description)
if let detail {
Text(detail)
.font(.callout)
.italic()
}
}
Spacer(minLength: 20)
actions

View File

@@ -28,7 +28,7 @@ struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
Section {
TextField(String(localized: .createSecretNameLabel), text: $name, prompt: Text(.createSecretNamePlaceholder))
VStack(alignment: .leading, spacing: 10) {
Picker(.createSecretRequireAuthenticationTitle, selection: $authenticationRequirement) {
Picker(.createSecretProtectionLevelTitle, selection: $authenticationRequirement) {
ForEach(authenticationOptions) { option in
HStack {
switch option {

View File

@@ -54,20 +54,12 @@ extension ContentView {
ToolbarItem(id: id) { view }
}
}
var needsSetup: Bool {
runningSetup || !hasRunSetup
}
/// Item either showing a "everything's good, here's more info" or "something's wrong, re-run setup" message
/// These two are mutually exclusive
@ViewBuilder
var runningOrRunSetupView: some View {
if needsSetup {
setupNoticeView
} else {
agentStatusToolbarView
}
agentStatusToolbarView
}
var updateNoticeContent: (LocalizedStringResource, Color)? {
@@ -134,19 +126,6 @@ extension ContentView {
}
}
@ViewBuilder
var setupNoticeView: some View {
Button(action: {
runningSetup = true
}, label: {
if !hasRunSetup {
Text(.agentSetupNoticeTitle)
.font(.headline)
}
})
.buttonStyle(ToolbarButtonStyle(color: .orange))
}
@ViewBuilder
var agentStatusToolbarView: some View {
Button(action: {