From 28be00ea53666fd5500a702a3c187c0e27dd90ad Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 27 Jun 2026 16:26:30 +0800
Subject: [PATCH] Simplify SmartStart default categories

---
 src/Apptag/PreferencesView.swift |  817 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 672 insertions(+), 145 deletions(-)

diff --git a/src/Apptag/PreferencesView.swift b/src/Apptag/PreferencesView.swift
index 7c4b398..52b09ab 100644
--- a/src/Apptag/PreferencesView.swift
+++ b/src/Apptag/PreferencesView.swift
@@ -6,6 +6,7 @@
 private enum SettingsTab: String, CaseIterable, Identifiable {
     case language
     case general
+    case theme
     case hotkeys
     case tags
     case data
@@ -17,6 +18,7 @@
         switch self {
         case .language: return "settings.language"
         case .general: return "settings.general"
+        case .theme: return "settings.theme"
         case .hotkeys: return "quickSearch.hotkeys"
         case .tags: return "settings.tags"
         case .data: return "settings.data"
@@ -28,6 +30,7 @@
         switch self {
         case .language: return "globe"
         case .general: return "gearshape"
+        case .theme: return "paintpalette.fill"
         case .hotkeys: return "keyboard"
         case .tags: return "tag.fill"
         case .data: return "externaldrive.fill"
@@ -36,16 +39,22 @@
     }
 }
 
+private enum InitialLayoutMode: String {
+    case uncategorized
+    case smart
+}
+
 struct PreferencesView: View {
     private let settingsWindowWidth: CGFloat = 1000
+    private let settingsWindowHeight: CGFloat = 640
     private let settingsContentWidth: CGFloat = 940
     private let generalContentWidth: CGFloat = 720
     private let generalLabelWidth: CGFloat = 190
     private let generalControlWidth: CGFloat = 500
     private let compactPickerWidth: CGFloat = 320
-    private let dataPanelWidth: CGFloat = 760
-    private let dataLabelWidth: CGFloat = 220
-    private let dataActionWidth: CGFloat = 112
+    private let dataPanelWidth: CGFloat = 820
+    private let dataLabelWidth: CGFloat = 190
+    private let dataActionWidth: CGFloat = 128
 
     @AppStorage("tagFontSize") private var tagFontSize: Double = AppDefaults.tagFontSize
     @AppStorage("iconSize") private var iconSize: Double = AppDefaults.iconSize
@@ -56,19 +65,36 @@
     @AppStorage("showDockIcon") private var showDockIcon = AppDefaults.showDockIcon
     @AppStorage("launchAtLogin") private var launchAtLogin = AppDefaults.launchAtLogin
     @AppStorage("showUncommonAppBubbles") private var showUncommonAppBubbles = AppDefaults.showUncommonAppBubbles
+    @AppStorage("hideUsageTips") private var hideUsageTips = AppDefaults.hideUsageTips
+    @AppStorage(AppGridTheme.storageKey) private var appGridThemeID = AppDefaults.appGridThemeID
     @AppStorage("mainHotkeyRegistrationState") private var mainHotkeyRegistrationState = LauncherHotkeyRegistrationState.active.rawValue
     @AppStorage("quickSearchHotkeyRegistrationState") private var quickSearchHotkeyRegistrationState = LauncherHotkeyRegistrationState.active.rawValue
+    @ObservedObject private var proEntitlement = ProEntitlementCenter.shared
     @State private var selectedLanguage = L10n.selectedLanguageCode
     @State private var isRefreshingLanguage = false
     @State private var allApps: [AppInfo] = []
     @State private var tagColors: [String: Int] = [:]
     @State private var categoryScheme = TagDatabase.CategorySchemeState()
     @State private var isApplyingSystemScheme = false
+    @State private var isResettingToUncategorized = false
     @State private var showApplySystemSchemeConfirmation = false
+    @State private var showResetToUncategorizedConfirmation = false
     @State private var isDataFilePanelPresented = false
     @State private var hotkeyStatusToast: String? = nil
     @State private var hotkeyStatusToastToken: UUID? = nil
     @State private var selectedTab: SettingsTab = .general
+    @State private var selectedInitialLayoutMode: InitialLayoutMode = .smart
+    @State private var settingsProPromptFeature: ProFeature? = nil
+
+    init(initialTabRawValue: String? = nil) {
+        let initialTab = initialTabRawValue.flatMap(SettingsTab.init(rawValue:)) ?? .general
+        _selectedTab = State(initialValue: initialTab)
+    }
+
+    private func selectTab(rawValue: String?) {
+        guard let rawValue, let tab = SettingsTab(rawValue: rawValue) else { return }
+        selectedTab = tab
+    }
 
     private func scanApps() {
         DispatchQueue.global(qos: .userInitiated).async {
@@ -89,6 +115,10 @@
     }
 
     private func exportTags() {
+        guard proEntitlement.isUnlocked else {
+            presentSettingsProPrompt(for: .layoutExport)
+            return
+        }
         guard prepareDataFilePanelPresentation() else { return }
         DispatchQueue.main.async {
             TagDatabase.flushPendingCategorySchemeBackupBatch()
@@ -105,6 +135,10 @@
                 guard response == .OK, let url = panel.url else { return }
                 do {
                     try TagDatabase.exportTo(url)
+                } catch let error as ProEntitlementError {
+                    if let feature = error.feature {
+                        presentSettingsProPrompt(for: feature)
+                    }
                 } catch {
                     fputs("[TagLauncher] Export failed: \(error)\n", stderr)
                     showDataAlert(title: tr("settings.exportFailed"), message: error.localizedDescription)
@@ -114,6 +148,10 @@
     }
 
     private func importTags() {
+        guard proEntitlement.isUnlocked else {
+            presentSettingsProPrompt(for: .layoutImport)
+            return
+        }
         guard prepareDataFilePanelPresentation() else { return }
         DispatchQueue.main.async {
             let panel = NSOpenPanel()
@@ -130,6 +168,10 @@
                     scanApps()
                     refreshDataState()
                     notifyDataChanged()
+                } catch let error as ProEntitlementError {
+                    if let feature = error.feature {
+                        presentSettingsProPrompt(for: feature)
+                    }
                 } catch {
                     fputs("[TagLauncher] Import failed: \(error)\n", stderr)
                     showDataAlert(title: tr("settings.importFailed"), message: error.localizedDescription)
@@ -298,6 +340,18 @@
         }
     }
 
+    private func applySelectedInitialLayout() {
+        switch selectedInitialLayoutMode {
+        case .uncategorized:
+            guard !isResettingToUncategorized else { return }
+            withAnimation(.easeOut(duration: 0.16)) {
+                showResetToUncategorizedConfirmation = true
+            }
+        case .smart:
+            applySystemInitialScheme()
+        }
+    }
+
     private func performApplySystemInitialScheme() {
         guard !isApplyingSystemScheme else { return }
         showApplySystemSchemeConfirmation = false
@@ -325,6 +379,29 @@
                         message: tr("settings.systemSchemeApplyFailed")
                     )
                 }
+            }
+        }
+    }
+
+    private func performResetToUncategorized() {
+        guard !isResettingToUncategorized else { return }
+        showResetToUncategorizedConfirmation = false
+        TagDatabase.flushPendingCategorySchemeBackupBatch()
+        isResettingToUncategorized = true
+
+        DispatchQueue.global(qos: .userInitiated).async {
+            let result = AppLibraryController.resetToUncategorized()
+
+            DispatchQueue.main.async {
+                isResettingToUncategorized = false
+                allApps = result.snapshot.apps
+                tagColors = result.snapshot.tagColors
+                refreshDataState()
+                notifyDataChanged()
+                showDataAlert(
+                    title: tr("settings.resetToUncategorizedApplied"),
+                    message: tr("settings.resetToUncategorizedAppliedMessage")
+                )
             }
         }
     }
@@ -389,6 +466,58 @@
         .buttonStyle(.plain)
     }
 
+    private func initialLayoutOption(
+        _ title: String,
+        mode: InitialLayoutMode
+    ) -> some View {
+        let isSelected = selectedInitialLayoutMode == mode
+        return Button {
+            selectedInitialLayoutMode = mode
+        } label: {
+            HStack(spacing: 6) {
+                Image(systemName: isSelected ? "largecircle.fill.circle" : "circle")
+                    .font(.system(size: 13, weight: .medium))
+                    .frame(width: 16, height: 16)
+                Text(title)
+                    .font(.system(size: 13, weight: .medium))
+                    .lineLimit(1)
+                    .minimumScaleFactor(0.85)
+            }
+            .foregroundStyle(isSelected ? Color.accentColor : Color.primary)
+            .contentShape(Rectangle())
+        }
+        .buttonStyle(.plain)
+    }
+
+    private func dataSectionTitle(_ title: String) -> some View {
+        Text(title)
+            .font(.system(size: 13, weight: .semibold))
+            .foregroundStyle(.primary)
+            .lineLimit(1)
+            .minimumScaleFactor(0.82)
+            .multilineTextAlignment(.trailing)
+            .frame(width: dataLabelWidth, alignment: .trailing)
+    }
+
+    private func dataSection<Content: View>(
+        minHeight: CGFloat,
+        @ViewBuilder content: () -> Content
+    ) -> some View {
+        content()
+            .padding(.horizontal, 20)
+            .padding(.vertical, 18)
+            .frame(width: dataPanelWidth, alignment: .leading)
+            .frame(minHeight: minHeight, alignment: .leading)
+            .background(
+                RoundedRectangle(cornerRadius: 12, style: .continuous)
+                    .fill(Color(nsColor: .controlBackgroundColor))
+            )
+            .overlay(
+                RoundedRectangle(cornerRadius: 12, style: .continuous)
+                    .stroke(Color.secondary.opacity(0.18), lineWidth: 1)
+            )
+    }
+
     private func syncSelectedLanguage() {
         let code = L10n.selectedLanguageCode
         guard selectedLanguage != code else { return }
@@ -417,6 +546,12 @@
             GridItem(.flexible(minimum: 220), spacing: 10, alignment: .top),
         ]
     }
+    private var themeColumns: [GridItem] {
+        [
+            GridItem(.flexible(minimum: 220), spacing: 12, alignment: .top),
+            GridItem(.flexible(minimum: 220), spacing: 12, alignment: .top),
+        ]
+    }
     private var displayModeOptions: [(id: String, title: String)] {
         [
             ("flat", tr("settings.flat")),
@@ -428,6 +563,109 @@
     }
     private var containerDisplayModeOptions: [(id: String, title: String)] {
         Array(displayModeOptions.dropFirst())
+    }
+    private var selectedAppGridTheme: AppGridTheme {
+        AppGridTheme(storedID: appGridThemeID)
+    }
+
+    private var effectiveAppGridTheme: AppGridTheme {
+        ProEntitlementPolicy.effectiveTheme(for: selectedAppGridTheme)
+    }
+
+    private var proStatusPillStyle: ProStatusPillStyle {
+        if proEntitlement.isPreviewingTheme {
+            return .preview
+        }
+        switch proEntitlement.accessState {
+        case .free:
+            return .neutral
+        case .purchased:
+            return .unlocked
+        case .legacy:
+            return .legacy
+        }
+    }
+
+    private var proCardTitle: String {
+        switch proEntitlement.accessState {
+        case .free:
+            return tr("pro.card.title.free")
+        case .purchased:
+            return tr("pro.card.title.unlocked")
+        case .legacy:
+            return tr("pro.card.title.legacy")
+        }
+    }
+
+    private var proCardSummary: String {
+        switch proEntitlement.accessState {
+        case .free:
+            return tr("pro.card.summary.free")
+        case .purchased:
+            return tr("pro.card.summary.unlocked")
+        case .legacy:
+            return tr("pro.card.summary.legacy")
+        }
+    }
+
+    private var themeStatusSummary: String {
+        if proEntitlement.isPreviewingTheme {
+            return tr("pro.theme.status.preview")
+        }
+        switch proEntitlement.accessState {
+        case .free:
+            return tr("pro.theme.status.free")
+        case .purchased, .legacy:
+            return tr("pro.theme.status.unlocked")
+        }
+    }
+
+    private func unlockButtonTitle() -> String {
+        tr("pro.card.unlock")
+    }
+
+    private func handleThemeSelection(_ theme: AppGridTheme) {
+        if theme.isFreeTheme || proEntitlement.isUnlocked {
+            proEntitlement.stopThemePreview()
+            appGridThemeID = theme.rawValue
+            return
+        }
+        proEntitlement.startThemePreview(for: theme)
+    }
+
+    private func themeOptionAccessory(for theme: AppGridTheme) -> ThemeOptionAccessory {
+        if let preview = proEntitlement.themePreviewState?.theme, preview == theme {
+            return .pill(text: tr("pro.card.previewBadge"), style: .preview)
+        }
+        if !proEntitlement.isUnlocked && theme.requiresPro {
+            return .pill(text: tr("pro.card.badge"), style: .locked)
+        }
+        return effectiveAppGridTheme == theme ? .checkmark : .circle
+    }
+
+    private func presentSettingsProPrompt(for feature: ProFeature) {
+        proEntitlement.clearTransientOperationState()
+        withAnimation(.spring(response: 0.22, dampingFraction: 0.84)) {
+            settingsProPromptFeature = feature
+        }
+    }
+
+    private func dismissSettingsProPrompt() {
+        proEntitlement.clearTransientOperationState()
+        withAnimation(.easeOut(duration: 0.18)) {
+            settingsProPromptFeature = nil
+        }
+    }
+
+    private func handleProAccessStateChange(_ newState: ProAccessState) {
+        guard newState.isUnlocked else { return }
+        if let preview = proEntitlement.themePreviewState {
+            appGridThemeID = preview.theme.rawValue
+            proEntitlement.stopThemePreview()
+        }
+        if settingsProPromptFeature != nil {
+            dismissSettingsProPrompt()
+        }
     }
 
     private func generalSettingRow<Control: View>(
@@ -527,13 +765,112 @@
         }
     }
 
+    private var themeProStatusRow: some View {
+        HStack(spacing: 12) {
+            ProStatusPill(
+                text: tr(proEntitlement.compactStatusTextKey),
+                style: proStatusPillStyle
+            )
+
+            Text(themeStatusSummary)
+                .font(.system(size: 13, weight: .medium))
+                .foregroundStyle(.secondary)
+                .fixedSize(horizontal: false, vertical: true)
+
+            Spacer(minLength: 0)
+
+            if !proEntitlement.isUnlocked {
+                Button(unlockButtonTitle()) {
+                    presentSettingsProPrompt(for: .premiumThemes)
+                }
+                .buttonStyle(.borderedProminent)
+
+                Button(tr("pro.card.restore")) {
+                    proEntitlement.restorePurchases()
+                }
+                .buttonStyle(.bordered)
+            }
+        }
+        .padding(.horizontal, 16)
+        .padding(.vertical, 14)
+        .background(
+            RoundedRectangle(cornerRadius: 10, style: .continuous)
+                .fill(Color(nsColor: .controlBackgroundColor))
+        )
+        .overlay(
+            RoundedRectangle(cornerRadius: 10, style: .continuous)
+                .stroke(Color.secondary.opacity(0.16), lineWidth: 1)
+        )
+    }
+
+    private var proStatusCard: some View {
+        HStack(alignment: .top, spacing: 18) {
+            VStack(alignment: .leading, spacing: 10) {
+                HStack(spacing: 10) {
+                    Text(proCardTitle)
+                        .font(.system(size: 20, weight: .bold))
+                    ProStatusPill(
+                        text: tr(proEntitlement.compactStatusTextKey),
+                        style: proStatusPillStyle
+                    )
+                }
+
+                Text(proCardSummary)
+                    .font(.system(size: 13, weight: .medium))
+                    .foregroundStyle(.secondary)
+                    .lineSpacing(2)
+                    .fixedSize(horizontal: false, vertical: true)
+
+                if let price = proEntitlement.priceDisplayText, !proEntitlement.isUnlocked {
+                    Text(price)
+                        .font(.system(size: 12, weight: .semibold))
+                        .foregroundStyle(Color.accentColor)
+                }
+            }
+
+            Spacer(minLength: 16)
+
+            VStack(alignment: .trailing, spacing: 10) {
+                if !proEntitlement.isUnlocked {
+                    Button(unlockButtonTitle()) {
+                        proEntitlement.purchasePro()
+                    }
+                    .buttonStyle(.borderedProminent)
+                }
+
+                Button(tr("pro.card.restore")) {
+                    proEntitlement.restorePurchases()
+                }
+                .buttonStyle(.bordered)
+
+                if let statusKey = proEntitlement.operationState.statusMessageKey {
+                    Text(tr(statusKey))
+                        .font(.caption)
+                        .foregroundStyle(.secondary)
+                        .multilineTextAlignment(.trailing)
+                }
+            }
+        }
+        .padding(.horizontal, 20)
+        .padding(.vertical, 18)
+        .frame(width: dataPanelWidth, alignment: .leading)
+        .background(
+            RoundedRectangle(cornerRadius: 12, style: .continuous)
+                .fill(Color(nsColor: .controlBackgroundColor))
+        )
+        .overlay(
+            RoundedRectangle(cornerRadius: 12, style: .continuous)
+                .stroke(Color.secondary.opacity(0.18), lineWidth: 1)
+        )
+    }
+
     private var settingsTabBar: some View {
-        HStack(spacing: 18) {
+        HStack(spacing: 8) {
             ForEach(SettingsTab.allCases) { tab in
                 settingsTabButton(tab)
             }
         }
-        .frame(height: 104, alignment: .center)
+        .frame(height: 96, alignment: .center)
         .frame(maxWidth: .infinity)
         .background(Color(nsColor: .windowBackgroundColor))
     }
@@ -550,11 +887,12 @@
                     .frame(width: 32, height: 32)
                 Text(tr(tab.titleKey))
                     .font(.system(size: 13, weight: .semibold))
-                    .lineLimit(1)
+                    .lineLimit(2)
+                    .multilineTextAlignment(.center)
                     .minimumScaleFactor(0.8)
             }
             .foregroundStyle(isSelected ? Color.accentColor : Color.secondary)
-            .frame(width: 72, height: 70)
+            .frame(width: 108, height: 74)
             .background(
                 RoundedRectangle(cornerRadius: 8, style: .continuous)
                     .fill(isSelected ? Color.accentColor.opacity(0.10) : Color.clear)
@@ -663,9 +1001,12 @@
                                     AppDelegate.refreshChromeSettings()
                                 }
                             Toggle(tr("settings.hideAppNames"), isOn: $hideAppNames)
+                            Toggle(tr("settings.hideUsageTips"), isOn: $hideUsageTips)
+                                .help(tr("settings.hideUsageTipsDesc"))
                         }
                         .frame(maxWidth: .infinity, alignment: .center)
-                        .padding(.bottom, 16)
+                        .padding(.top, 12)
+                        .padding(.bottom, 18)
 
                         Divider()
                             .padding(.bottom, 16)
@@ -728,8 +1069,47 @@
                         }
                     }
                     .frame(maxWidth: generalContentWidth, alignment: .center)
-                    .padding()
+                    .padding(.horizontal)
+                    .padding(.top, 28)
+                    .padding(.bottom)
                 }
+
+                    case .theme:
+            ScrollView(.vertical, showsIndicators: true) {
+                VStack(alignment: .leading, spacing: 18) {
+                    VStack(alignment: .leading, spacing: 6) {
+                        Text(tr("settings.theme"))
+                            .font(.headline)
+                        Text(tr("settings.themeDesc"))
+                            .font(.caption)
+                            .foregroundStyle(.secondary)
+                    }
+
+                    themeProStatusRow
+
+                    LazyVGrid(columns: themeColumns, alignment: .leading, spacing: 12) {
+                        ForEach(AppGridTheme.allCases) { theme in
+                            ThemeOptionButton(
+                                theme: theme,
+                                title: tr(theme.titleKey),
+                                isSelected: effectiveAppGridTheme == theme,
+                                accessory: themeOptionAccessory(for: theme)
+                            ) {
+                                handleThemeSelection(theme)
+                            }
+                        }
+                    }
+
+                    Text(tr("settings.themeScopeDesc"))
+                        .font(.caption)
+                        .foregroundStyle(.secondary)
+                        .fixedSize(horizontal: false, vertical: true)
+                }
+                .frame(maxWidth: generalContentWidth, alignment: .leading)
+                .padding(.horizontal)
+                .padding(.top, 28)
+                .padding(.bottom)
+            }
 
                     case .hotkeys:
             // Tab 3: Hotkeys
@@ -756,52 +1136,112 @@
                     case .data:
             // Tab 5: Data
             VStack(spacing: 0) {
-                Spacer(minLength: 32)
+                Spacer(minLength: 36)
 
-                VStack(alignment: .center, spacing: 0) {
-                    VStack(alignment: .leading, spacing: 12) {
+                VStack(alignment: .center, spacing: 24) {
+                    dataSection(minHeight: 124) {
                         HStack(alignment: .center, spacing: 12) {
-                            Text(tr("settings.systemScheme"))
-                                .font(.system(size: 13, weight: .semibold))
-                                .foregroundStyle(.secondary)
-                                .lineLimit(1)
-                                .minimumScaleFactor(0.82)
-                                .multilineTextAlignment(.trailing)
-                                .frame(width: dataLabelWidth, alignment: .trailing)
+                            dataSectionTitle(tr("settings.initialLayout"))
 
-                            Text(SmartStartService.systemInitialSchemeName)
-                                .font(.system(size: 13, weight: .medium))
-                                .foregroundStyle(.primary)
-                                .lineLimit(1)
-                                .truncationMode(.middle)
+                            HStack(spacing: 22) {
+                                initialLayoutOption(
+                                    tr("settings.initialLayoutUncategorized"),
+                                    mode: .uncategorized
+                                )
+                                initialLayoutOption(
+                                    tr("settings.initialLayoutSmart"),
+                                    mode: .smart
+                                )
+                            }
                                 .frame(maxWidth: .infinity, alignment: .leading)
-                                .layoutPriority(0)
+                                .layoutPriority(1)
 
                             dataActionButton(
                                 tr("settings.applyScheme"),
                                 prominent: true,
-                                enabled: !isApplyingSystemScheme,
-                                action: applySystemInitialScheme
+                                enabled: !isApplyingSystemScheme && !isResettingToUncategorized,
+                                action: applySelectedInitialLayout
                             )
                             .frame(width: dataActionWidth, alignment: .trailing)
                             .layoutPriority(2)
                         }
+                    }
 
-                        HStack(alignment: .center, spacing: 12) {
-                            Text(tr("settings.previousScheme"))
-                                .font(.system(size: 13, weight: .semibold))
-                                .foregroundStyle(.secondary)
-                                .lineLimit(1)
-                                .minimumScaleFactor(0.82)
-                                .multilineTextAlignment(.trailing)
-                                .frame(width: dataLabelWidth, alignment: .trailing)
-                            Text(previousCategorySchemeName)
-                                .font(.system(size: 13, weight: .medium))
-                                .foregroundStyle(canRestorePreviousScheme ? .primary : .tertiary)
-                                .lineLimit(1)
-                                .truncationMode(.middle)
-                                .frame(maxWidth: .infinity, alignment: .leading)
-                                .layoutPriority(0)
+                    dataSection(minHeight: 190) {
+                        HStack(alignment: .top, spacing: 12) {
+                            dataSectionTitle(tr("settings.customLayout"))
+                                .padding(.top, 4)
+
+                            VStack(alignment: .leading, spacing: 10) {
+                                HStack(alignment: .firstTextBaseline, spacing: 8) {
+                                    Text(tr("settings.previousScheme"))
+                                        .font(.system(size: 13, weight: .semibold))
+                                        .foregroundStyle(.secondary)
+                                        .lineLimit(1)
+                                        .minimumScaleFactor(0.82)
+                                    Text(previousCategorySchemeName)
+                                        .font(.system(size: 13, weight: .medium))
+                                        .foregroundStyle(canRestorePreviousScheme ? .primary : .tertiary)
+                                        .lineLimit(1)
+                                        .truncationMode(.middle)
+                                        .frame(maxWidth: .infinity, alignment: .leading)
+                                }
+
+                                HStack(alignment: .firstTextBaseline, spacing: 8) {
+                                    Text(tr("settings.currentScheme"))
+                                        .font(.system(size: 13, weight: .semibold))
+                                        .foregroundStyle(.secondary)
+                                        .lineLimit(1)
+                                        .minimumScaleFactor(0.82)
+                                    Text(currentCategorySchemeName)
+                                        .font(.system(size: 13, weight: .medium))
+                                        .foregroundStyle(.primary)
+                                        .lineLimit(1)
+                                        .truncationMode(.middle)
+                                        .frame(maxWidth: .infinity, alignment: .leading)
+                                }
+
+                                Divider().opacity(0.35)
+                                    .padding(.top, 2)
+
+                                VStack(alignment: .center, spacing: 8) {
+                                    HStack(spacing: 12) {
+                                        Button {
+                                            exportTags()
+                                        } label: {
+                                            HStack(spacing: 8) {
+                                                Text(tr("settings.export"))
+                                                if !proEntitlement.isUnlocked {
+                                                    ProStatusPill(text: tr("pro.card.badge"), style: .locked, compact: true)
+                                                }
+                                            }
+                                        }
+                                            .buttonStyle(.bordered)
+                                            .disabled(isDataFilePanelPresented)
+                                        Button {
+                                            importTags()
+                                        } label: {
+                                            HStack(spacing: 8) {
+                                                Text(tr("settings.import"))
+                                                if !proEntitlement.isUnlocked {
+                                                    ProStatusPill(text: tr("pro.card.badge"), style: .locked, compact: true)
+                                                }
+                                            }
+                                        }
+                                            .buttonStyle(.bordered)
+                                            .disabled(isDataFilePanelPresented)
+                                    }
+                                    Text(tr("settings.backupDesc"))
+                                        .font(.caption)
+                                        .foregroundStyle(.secondary)
+                                        .multilineTextAlignment(.center)
+                                        .fixedSize(horizontal: false, vertical: true)
+                                        .frame(maxWidth: dataPanelWidth - dataLabelWidth - dataActionWidth - 92, alignment: .center)
+                                }
+                                .frame(maxWidth: .infinity, alignment: .center)
+                            }
+                            .frame(maxWidth: .infinity, alignment: .leading)
+                            .layoutPriority(1)
 
                             dataActionButton(
                                 tr("settings.restorePreviousScheme"),
@@ -812,60 +1252,11 @@
                             .frame(width: dataActionWidth, alignment: .trailing)
                             .layoutPriority(2)
                         }
-
-                        HStack(alignment: .firstTextBaseline, spacing: 12) {
-                            Text(tr("settings.currentScheme"))
-                                .font(.system(size: 13, weight: .semibold))
-                                .foregroundStyle(.secondary)
-                                .lineLimit(1)
-                                .minimumScaleFactor(0.82)
-                                .multilineTextAlignment(.trailing)
-                                .frame(width: dataLabelWidth, alignment: .trailing)
-                            Text(currentCategorySchemeName)
-                                .font(.system(size: 13, weight: .medium))
-                                .foregroundStyle(.primary)
-                                .lineLimit(1)
-                                .truncationMode(.middle)
-                                .frame(maxWidth: .infinity, alignment: .leading)
-                            Color.clear
-                                .frame(width: dataActionWidth, height: 1)
-                        }
-
-                        Divider().opacity(0.35)
-
-                        VStack(alignment: .center, spacing: 8) {
-                            HStack(spacing: 12) {
-                                Button(tr("settings.export")) { exportTags() }
-                                    .buttonStyle(.bordered)
-                                    .disabled(isDataFilePanelPresented)
-                                Button(tr("settings.import")) { importTags() }
-                                    .buttonStyle(.bordered)
-                                    .disabled(isDataFilePanelPresented)
-                            }
-                            Text(tr("settings.backupDesc"))
-                                .font(.caption)
-                                .foregroundStyle(.secondary)
-                                .multilineTextAlignment(.center)
-                                .fixedSize(horizontal: false, vertical: true)
-                                .frame(maxWidth: dataPanelWidth - 72, alignment: .center)
-                        }
-                        .frame(maxWidth: .infinity, alignment: .center)
                     }
-                    .padding(.horizontal, 20)
-                    .padding(.vertical, 16)
-                    .frame(width: dataPanelWidth, alignment: .leading)
-                    .background(
-                        RoundedRectangle(cornerRadius: 8, style: .continuous)
-                            .fill(Color(nsColor: .controlBackgroundColor))
-                    )
-                    .overlay(
-                        RoundedRectangle(cornerRadius: 8, style: .continuous)
-                            .stroke(Color.secondary.opacity(0.16), lineWidth: 1)
-                    )
                 }
                 .frame(width: dataPanelWidth, alignment: .center)
 
-                Spacer(minLength: 22)
+                Spacer(minLength: 30)
 
                 HStack(alignment: .center, spacing: 14) {
                     Text(tr("settings.bubbleDisplayScope"))
@@ -898,62 +1289,67 @@
                     case .about:
             // Tab 6: About
             VStack(spacing: 0) {
-                Spacer(minLength: 72)
+                Spacer(minLength: 44)
 
-                HStack {
-                    if let icon = NSImage(named: NSImage.applicationIconName) {
-                        Image(nsImage: icon)
-                            .resizable()
-                            .frame(width: 128, height: 128)
-                    }
-                    VStack(alignment: .leading, spacing: 4) {
-                        Text("TagLauncher")
-                            .font(.title2)
-                            .fontWeight(.semibold)
-                        Text(tr("app.description"))
-                            .font(.body)
-                            .foregroundStyle(.secondary)
-                        Text("\(tr("app.version")) \(appVersion) (\(tr("app.build")) \(buildVersion))")
-                            .font(.callout)
-                            .foregroundStyle(.tertiary)
+                VStack(alignment: .center, spacing: 24) {
+                    proStatusCard
 
-                        Divider()
-                            .padding(.vertical, 4)
-
-                        HStack(spacing: 8) {
-                            Button {
-                                NSWorkspace.shared.open(helpPDFURL)
-                            } label: {
-                                Label(tr("help.openPDF"), systemImage: "questionmark.circle")
-                            }
-                            .buttonStyle(.borderedProminent)
-                            .controlSize(.regular)
-
-                            Button {
-                                NSPasteboard.general.clearContents()
-                                NSPasteboard.general.setString(helpPDFURL.absoluteString, forType: .string)
-                            } label: {
-                                Image(systemName: "link")
-                            }
-                            .buttonStyle(.bordered)
-                            .controlSize(.regular)
-                            .help(tr("help.copyLink"))
+                    HStack(alignment: .center, spacing: 24) {
+                        if let icon = NSImage(named: NSImage.applicationIconName) {
+                            Image(nsImage: icon)
+                                .resizable()
+                                .frame(width: 112, height: 112)
                         }
+                        VStack(alignment: .leading, spacing: 4) {
+                            Text("TagLauncher")
+                                .font(.title2)
+                                .fontWeight(.semibold)
+                            Text(tr("app.description"))
+                                .font(.body)
+                                .foregroundStyle(.secondary)
+                            Text("\(tr("app.version")) \(appVersion) (\(tr("app.build")) \(buildVersion))")
+                                .font(.callout)
+                                .foregroundStyle(.tertiary)
 
-                        Text(tr("help.currentLanguage"))
-                            .font(.caption)
-                            .foregroundStyle(.secondary)
-                            .padding(.bottom, 2)
+                            Divider()
+                                .padding(.vertical, 4)
 
-                        Text("万物之中,希望最美")
-                            .font(.caption)
-                            .foregroundStyle(.secondary)
-                        Text("永桔@shanghai3168@gmail.com")
-                            .font(.caption)
-                            .foregroundStyle(.secondary)
+                            HStack(spacing: 8) {
+                                Button {
+                                    NSWorkspace.shared.open(helpPDFURL)
+                                } label: {
+                                    Label(tr("help.openPDF"), systemImage: "questionmark.circle")
+                                }
+                                .buttonStyle(.borderedProminent)
+                                .controlSize(.regular)
+
+                                Button {
+                                    NSPasteboard.general.clearContents()
+                                    NSPasteboard.general.setString(helpPDFURL.absoluteString, forType: .string)
+                                } label: {
+                                    Image(systemName: "link")
+                                }
+                                .buttonStyle(.bordered)
+                                .controlSize(.regular)
+                                .help(tr("help.copyLink"))
+                            }
+
+                            Text(tr("help.currentLanguage"))
+                                .font(.caption)
+                                .foregroundStyle(.secondary)
+                                .padding(.bottom, 2)
+
+                            Text("万物之中,希望最美")
+                                .font(.caption)
+                                .foregroundStyle(.secondary)
+                            Text("永桔@shanghai3168@gmail.com")
+                                .font(.caption)
+                                .foregroundStyle(.secondary)
+                        }
                     }
+                    .frame(width: dataPanelWidth, alignment: .leading)
                 }
-                .frame(width: 560, alignment: .leading)
+                .frame(width: dataPanelWidth, alignment: .center)
 
                 Spacer(minLength: 30)
                 Spacer(minLength: 18)
@@ -979,6 +1375,9 @@
             .onReceive(NotificationCenter.default.publisher(for: .tagLauncherDataDidChange)) { _ in
                 refreshDataState()
             }
+            .onChange(of: proEntitlement.accessState) { _, newState in
+                handleProAccessStateChange(newState)
+            }
 
             if isRefreshingLanguage {
                 ZStack {
@@ -993,7 +1392,7 @@
             }
 
             if showApplySystemSchemeConfirmation {
-                ApplySystemSchemeConfirmationView(
+                SettingsConfirmationView(
                     title: tr("settings.applySystemSchemeWarningTitle"),
                     message: tr("settings.applySystemSchemeWarningMessage"),
                     confirmTitle: tr("settings.confirmApplyScheme"),
@@ -1006,6 +1405,45 @@
                     }
                 )
                 .zIndex(3)
+                .transition(.opacity)
+            }
+
+            if showResetToUncategorizedConfirmation {
+                SettingsConfirmationView(
+                    title: tr("settings.resetToUncategorizedWarningTitle"),
+                    message: tr("settings.resetToUncategorizedWarningMessage"),
+                    confirmTitle: tr("settings.confirmResetToUncategorized"),
+                    cancelTitle: tr("settings.cancel"),
+                    onConfirm: performResetToUncategorized,
+                    onCancel: {
+                        withAnimation(.easeOut(duration: 0.14)) {
+                            showResetToUncategorizedConfirmation = false
+                        }
+                    }
+                )
+                .zIndex(3)
+                .transition(.opacity)
+            }
+
+            if let feature = settingsProPromptFeature {
+                ZStack {
+                    Color.black.opacity(0.16)
+                        .ignoresSafeArea()
+
+                    ProUpgradePromptView(
+                        title: tr(feature.titleKey),
+                        message: tr(feature.promptMessageKey),
+                        benefitText: tr(feature.benefitKey),
+                        operationText: proEntitlement.operationState.statusMessageKey.map(tr),
+                        unlockTitle: unlockButtonTitle(),
+                        restoreTitle: tr("pro.card.restore"),
+                        isBusy: proEntitlement.operationState.isBusy,
+                        onClose: dismissSettingsProPrompt,
+                        onUnlock: { proEntitlement.purchasePro() },
+                        onRestore: { proEntitlement.restorePurchases() }
+                    )
+                }
+                .zIndex(4)
                 .transition(.opacity)
             }
 
@@ -1027,17 +1465,20 @@
                         .frame(maxWidth: 620)
                         .padding(.bottom, 22)
                 }
-                .zIndex(4)
+                .zIndex(5)
                 .transition(.opacity.combined(with: .move(edge: .bottom)))
             }
         }
-        .frame(width: settingsWindowWidth, height: 480)
+        .frame(width: settingsWindowWidth, height: settingsWindowHeight)
         .onAppear {
             syncSelectedLanguage()
             showPendingHotkeyWarningIfNeeded()
         }
         .onReceive(NotificationCenter.default.publisher(for: .tagLauncherHotkeyRegistrationChanged)) { _ in
             showPendingHotkeyWarningIfNeeded()
+        }
+        .onReceive(NotificationCenter.default.publisher(for: .tagLauncherPreferencesTabRequested)) { notification in
+            selectTab(rawValue: notification.userInfo?[SettingsTabTarget.userInfoKey] as? String)
         }
     }
 
@@ -1116,7 +1557,7 @@
     }
 }
 
-private struct ApplySystemSchemeConfirmationView: View {
+private struct SettingsConfirmationView: View {
     let title: String
     let message: String
     let confirmTitle: String
@@ -1218,6 +1659,92 @@
     }
 }
 
+private enum ThemeOptionAccessory {
+    case checkmark
+    case circle
+    case pill(text: String, style: ProStatusPillStyle)
+}
+
+private struct ThemeOptionButton: View {
+    let theme: AppGridTheme
+    let title: String
+    let isSelected: Bool
+    let accessory: ThemeOptionAccessory
+    let action: () -> Void
+
+    var body: some View {
+        Button(action: action) {
+            HStack(spacing: 12) {
+                RoundedRectangle(cornerRadius: 8, style: .continuous)
+                    .fill(
+                        LinearGradient(
+                            colors: theme.previewColors,
+                            startPoint: .topLeading,
+                            endPoint: .bottomTrailing
+                        )
+                    )
+                    .frame(width: 70, height: 42)
+                    .overlay(
+                        RoundedRectangle(cornerRadius: 8, style: .continuous)
+                            .stroke(previewStrokeColor, lineWidth: 1)
+                    )
+                    .shadow(
+                        color: isSelected ? Color.accentColor.opacity(0.22) : Color.clear,
+                        radius: 10,
+                        x: 0,
+                        y: 4
+                    )
+
+                Text(title)
+                    .font(.system(size: 13, weight: .semibold))
+                    .foregroundStyle(.primary)
+                    .lineLimit(1)
+                    .minimumScaleFactor(0.82)
+
+                Spacer(minLength: 0)
+
+                accessoryView
+            }
+            .padding(10)
+            .frame(maxWidth: .infinity, minHeight: 64)
+            .background(
+                RoundedRectangle(cornerRadius: 8, style: .continuous)
+                    .fill(isSelected ? Color.accentColor.opacity(0.10) : Color(nsColor: .controlBackgroundColor))
+            )
+            .overlay(
+                RoundedRectangle(cornerRadius: 8, style: .continuous)
+                    .stroke(isSelected ? Color.accentColor.opacity(0.32) : Color.secondary.opacity(0.16), lineWidth: 1)
+            )
+            .contentShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
+        }
+        .buttonStyle(.plain)
+        .accessibilityLabel(title)
+        .accessibilityIdentifier("theme-option-\(theme.rawValue)")
+    }
+
+    private var previewStrokeColor: Color {
+        theme.isDefaultLight
+            ? Color.secondary.opacity(0.26)
+            : Color.white.opacity(0.24)
+    }
+
+    @ViewBuilder
+    private var accessoryView: some View {
+        switch accessory {
+        case .checkmark:
+            Image(systemName: "checkmark.circle.fill")
+                .font(.system(size: 16, weight: .semibold))
+                .foregroundStyle(Color.accentColor)
+        case .circle:
+            Image(systemName: "circle")
+                .font(.system(size: 16, weight: .semibold))
+                .foregroundStyle(Color.secondary.opacity(0.42))
+        case .pill(let text, let style):
+            ProStatusPill(text: text, style: style, compact: true)
+        }
+    }
+}
+
 private struct DisplayModeOptionButton: View {
     let mode: String
     let title: String

--
Gitblit v1.9.3