mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-09-20 03:10:57 +00:00
Setup UI tweaks.
This commit is contained in:
parent
8c516e128a
commit
2dc1d7a6b7
@ -21,9 +21,10 @@ struct SetupView: View {
|
|||||||
StepView(
|
StepView(
|
||||||
title: .setupAgentTitle,
|
title: .setupAgentTitle,
|
||||||
description: .setupAgentDescription,
|
description: .setupAgentDescription,
|
||||||
|
detail: .setupAgentActivityMonitorDescription,
|
||||||
systemImage: "lock.laptopcomputer",
|
systemImage: "lock.laptopcomputer",
|
||||||
) {
|
) {
|
||||||
setupButton(
|
SetupButton(
|
||||||
.setupAgentInstallButton,
|
.setupAgentInstallButton,
|
||||||
complete: installed,
|
complete: installed,
|
||||||
width: buttonWidth
|
width: buttonWidth
|
||||||
@ -40,7 +41,7 @@ struct SetupView: View {
|
|||||||
description: .setupUpdatesDescription,
|
description: .setupUpdatesDescription,
|
||||||
systemImage: "network.badge.shield.half.filled",
|
systemImage: "network.badge.shield.half.filled",
|
||||||
) {
|
) {
|
||||||
setupButton(
|
SetupButton(
|
||||||
.setupUpdatesOkButton,
|
.setupUpdatesOkButton,
|
||||||
complete: updates,
|
complete: updates,
|
||||||
width: buttonWidth
|
width: buttonWidth
|
||||||
@ -54,7 +55,7 @@ struct SetupView: View {
|
|||||||
description: .setupIntegrationsDescription,
|
description: .setupIntegrationsDescription,
|
||||||
systemImage: "firewall",
|
systemImage: "firewall",
|
||||||
) {
|
) {
|
||||||
setupButton(
|
SetupButton(
|
||||||
.setupIntegrationsButton,
|
.setupIntegrationsButton,
|
||||||
complete: integrations,
|
complete: integrations,
|
||||||
width: buttonWidth
|
width: buttonWidth
|
||||||
@ -63,7 +64,7 @@ struct SetupView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onPreferenceChange(setupButton.WidthKey.self) { width in
|
.onPreferenceChange(SetupButton.WidthKey.self) { width in
|
||||||
buttonWidth = width
|
buttonWidth = width
|
||||||
}
|
}
|
||||||
.background(.white.opacity(0.1), in: RoundedRectangle(cornerRadius: 10))
|
.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 {
|
struct WidthKey: @MainActor PreferenceKey {
|
||||||
@MainActor static var defaultValue: CGFloat? = nil
|
@MainActor static var defaultValue: CGFloat? = nil
|
||||||
@ -144,12 +145,20 @@ struct StepView<Content: View>: View {
|
|||||||
let title: LocalizedStringResource
|
let title: LocalizedStringResource
|
||||||
let icon: Image
|
let icon: Image
|
||||||
let description: LocalizedStringResource
|
let description: LocalizedStringResource
|
||||||
|
let detail: LocalizedStringResource?
|
||||||
let actions: Content
|
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.title = title
|
||||||
self.icon = Image(systemName: systemImage)
|
self.icon = Image(systemName: systemImage)
|
||||||
self.description = description
|
self.description = description
|
||||||
|
self.detail = detail
|
||||||
self.actions = actions()
|
self.actions = actions()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +174,11 @@ struct StepView<Content: View>: View {
|
|||||||
Text(title)
|
Text(title)
|
||||||
.bold()
|
.bold()
|
||||||
Text(description)
|
Text(description)
|
||||||
|
if let detail {
|
||||||
|
Text(detail)
|
||||||
|
.font(.callout)
|
||||||
|
.italic()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Spacer(minLength: 20)
|
Spacer(minLength: 20)
|
||||||
actions
|
actions
|
||||||
|
Loading…
Reference in New Issue
Block a user