mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-09-15 08:50:57 +00:00
* Integrations to window * Cleanup of presenting. * Older name for copy * For copyable view too
88 lines
2.8 KiB
Swift
88 lines
2.8 KiB
Swift
import SwiftUI
|
|
|
|
struct IntegrationsView: View {
|
|
|
|
@Environment(\.dismiss) private var dismiss
|
|
|
|
@State private var selectedInstruction: ConfigurationFileInstructions?
|
|
private let instructions = Instructions()
|
|
|
|
var body: some View {
|
|
NavigationSplitView {
|
|
List(selection: $selectedInstruction) {
|
|
ForEach(instructions.instructions) { group in
|
|
Section(group.name) {
|
|
ForEach(group.instructions) { instruction in
|
|
Text(instruction.tool)
|
|
.padding(.vertical, 8)
|
|
.tag(instruction)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} detail: {
|
|
IntegrationsDetailView(selectedInstruction: $selectedInstruction)
|
|
}
|
|
.toolbar {
|
|
Button(.setupDoneButton) {
|
|
dismiss()
|
|
}
|
|
}
|
|
.hiddenToolbar()
|
|
.windowBackgroundStyle(.thinMaterial)
|
|
.onAppear {
|
|
selectedInstruction = instructions.gettingStarted
|
|
}
|
|
.frame(minWidth: 400, minHeight: 400)
|
|
}
|
|
|
|
}
|
|
|
|
struct IntegrationsDetailView: View {
|
|
|
|
@Binding private var selectedInstruction: ConfigurationFileInstructions?
|
|
|
|
init(selectedInstruction: Binding<ConfigurationFileInstructions?>) {
|
|
_selectedInstruction = selectedInstruction
|
|
}
|
|
|
|
var body: some View {
|
|
if let selectedInstruction {
|
|
switch selectedInstruction.id {
|
|
case .gettingStarted:
|
|
GettingStartedView(selectedInstruction: $selectedInstruction)
|
|
case .tool:
|
|
ToolConfigurationView(selectedInstruction: selectedInstruction)
|
|
case .otherShell:
|
|
Form {
|
|
Section {
|
|
Link(.integrationsViewOtherGithubLink, destination: URL(string: "https://github.com/maxgoedjen/secretive-config-instructions/tree/main/shells")!)
|
|
} header: {
|
|
Text(.integrationsCommunityShellListDescription)
|
|
.font(.body)
|
|
}
|
|
}
|
|
.formStyle(.grouped)
|
|
|
|
case .otherApp:
|
|
Form {
|
|
Section {
|
|
Link(.integrationsViewOtherGithubLink, destination: URL(string: "https://github.com/maxgoedjen/secretive-config-instructions/tree/main/apps")!)
|
|
} header: {
|
|
Text(.integrationsCommunityAppsListDescription)
|
|
.font(.body)
|
|
}
|
|
}
|
|
.formStyle(.grouped)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#Preview {
|
|
IntegrationsView()
|
|
.frame(height: 500)
|
|
}
|