diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-05 11:29:17 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-07-05 11:29:17 +0200 |
| commit | cb4a713afc81326485becba4fa3a635f112114d4 (patch) | |
| tree | e3efea48ccb7be53ed681eb9ed333af39d93ce67 /Map/Presentation/PreferencesWindow.swift | |
| parent | e21ead77ffdff206d1ae17e5ce93ea34c4227414 (diff) | |
Add custom stages
Diffstat (limited to 'Map/Presentation/PreferencesWindow.swift')
| -rw-r--r-- | Map/Presentation/PreferencesWindow.swift | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/Map/Presentation/PreferencesWindow.swift b/Map/Presentation/PreferencesWindow.swift new file mode 100644 index 0000000..22bd987 --- /dev/null +++ b/Map/Presentation/PreferencesWindow.swift @@ -0,0 +1,86 @@ +// Copyright (C) 2024 Rubén Beltrán del Río + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see https://map.tranquil.systems. + +import SwiftUI + +enum PreferencesTab: String, CaseIterable { + case general = "General" + case appearance = "Appearance" + case map = "Map" + case stages = "Stages" + case templates = "Templates" + + var systemImage: String { + switch self { + case .general: + return "gearshape" + case .appearance: + return "paintpalette" + case .map: + return "map" + case .stages: + return "list.number" + case .templates: + return "doc.text" + } + } +} + +struct PreferencesWindow: View { + @State private var selectedTab: PreferencesTab = .general + + var body: some View { + Group { + switch selectedTab { + case .general: + GeneralPreferencesView() + case .appearance: + AppearancePreferencesView() + case .map: + MapPreferencesView() + case .stages: + StagesPreferencesView() + case .templates: + TemplatesPreferencesView() + } + } + .frame(width: 600, height: 400) + .toolbar { + ToolbarItem(placement: .principal) { + HStack(spacing: 12) { + ForEach(PreferencesTab.allCases, id: \.self) { tab in + Button(action: { selectedTab = tab }) { + VStack(spacing: 2) { + Image(systemName: tab.systemImage) + .font(.system(size: 16)) + Text(tab.rawValue) + .font(.caption2) + } + .frame(width: 60, height: 40) + .background(selectedTab == tab ? Color.accentColor.opacity(0.2) : Color.clear) + .foregroundColor(selectedTab == tab ? .accentColor : .primary) + .cornerRadius(6) + } + .buttonStyle(.plain) + } + } + } + } + } +} + +#Preview { + PreferencesWindow() +} |