|
| 1 | +// |
| 2 | +// SettingsTab.swift |
| 3 | +// Loop |
| 4 | +// |
| 5 | +// Created by Kai Azim on 2025-12-06. |
| 6 | +// |
| 7 | + |
| 8 | +import Luminare |
| 9 | +import SwiftUI |
| 10 | + |
| 11 | +enum SettingsTab: LuminareTabItem, CaseIterable { |
| 12 | + var id: String { title } |
| 13 | + |
| 14 | + case icon |
| 15 | + case accentColor |
| 16 | + case radialMenu |
| 17 | + case preview |
| 18 | + |
| 19 | + case behavior |
| 20 | + case keybinds |
| 21 | + |
| 22 | + case advanced |
| 23 | + case excludedApps |
| 24 | + case about |
| 25 | + |
| 26 | + var title: String { |
| 27 | + switch self { |
| 28 | + case .icon: .init(localized: "Settings tab: Icon", defaultValue: "Icon") |
| 29 | + case .accentColor: .init(localized: "Settings tab: Accent Color", defaultValue: "Accent Color") |
| 30 | + case .radialMenu: .init(localized: "Settings tab: Radial Menu", defaultValue: "Radial Menu") |
| 31 | + case .preview: .init(localized: "Settings tab: Preview", defaultValue: "Preview") |
| 32 | + case .behavior: .init(localized: "Settings tab: Behavior", defaultValue: "Behavior") |
| 33 | + case .keybinds: .init(localized: "Settings tab: Keybindings", defaultValue: "Keybinds") |
| 34 | + case .advanced: .init(localized: "Settings tab: Advanced", defaultValue: "Advanced") |
| 35 | + case .excludedApps: .init(localized: "Settings tab: Excluded Apps", defaultValue: "Excluded Apps") |
| 36 | + case .about: .init(localized: "Settings tab: About", defaultValue: "About") |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + var image: Image { |
| 41 | + switch self { |
| 42 | + case .icon: Image(.squareSparkle) |
| 43 | + case .accentColor: Image(.paintbrush) |
| 44 | + case .radialMenu: Image(.loop) |
| 45 | + case .preview: Image(.sidebarRight2) |
| 46 | + case .behavior: Image(.gear) |
| 47 | + case .keybinds: Image(.command) |
| 48 | + case .advanced: Image(.faceNerdSmile) |
| 49 | + case .excludedApps: Image(.windowLock) |
| 50 | + case .about: Image(.msgSmile2) |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | + var showIndicator: Bool { |
| 55 | + switch self { |
| 56 | + case .about: Updater.shared.updateState == .available |
| 57 | + default: false |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + @ViewBuilder func view() -> some View { |
| 62 | + switch self { |
| 63 | + case .icon: IconConfigurationView() |
| 64 | + case .accentColor: AccentColorConfigurationView() |
| 65 | + case .radialMenu: RadialMenuConfigurationView() |
| 66 | + case .preview: PreviewConfigurationView() |
| 67 | + case .behavior: BehaviorConfigurationView() |
| 68 | + case .keybinds: KeybindsConfigurationView() |
| 69 | + case .advanced: AdvancedConfigurationView() |
| 70 | + case .excludedApps: ExcludedAppsConfigurationView() |
| 71 | + case .about: AboutConfigurationView() |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + static let themingTabs: [Self] = [.icon, .accentColor, .radialMenu, .preview] |
| 76 | + static let settingsTabs: [Self] = [.behavior, .keybinds] |
| 77 | + static let loopTabs: [Self] = [.advanced, .excludedApps, .about] |
| 78 | +} |
0 commit comments