Skip to content

Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.

feat: dashboard redesign with light/dark appearance toggle

livit3bb1e5f3170c
diff --git a/PureMac.xcodeproj/project.pbxproj b/PureMac.xcodeproj/project.pbxproj
index da6d40f..d4700db 100644
--- a/PureMac.xcodeproj/project.pbxproj
+++ b/PureMac.xcodeproj/project.pbxproj
@@ -15,14 +15,16 @@
47C5ECD49C4DD75F271DB6CE /* StringNormalization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D3AC5F17D7CA94FAB1E8D7A /* StringNormalization.swift */; };
48D1431A7C99C19EEBDB056B /* CleaningEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A8DE5D45BA19E2670B57DC5 /* CleaningEngine.swift */; };
4F754D89F4CE5142BE384062 /* AppConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31F91226CDCFBB8E303B7DA /* AppConstants.swift */; };
+ 535B23C0108C06475215B8E8 /* AppTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB003A7751F05727DBFD1A5 /* AppTheme.swift */; };
75B5F0401D37F2872B1AD85A /* AppListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60E6BC61614B27C065BB18C9 /* AppListView.swift */; };
76B132F9C499225D33E0D075 /* EmptyStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 424F7B28624C271620E13BBC /* EmptyStateView.swift */; };
826A750D2D7EC14C2AE306A3 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3667D46D8E2004EB4D73835A /* Models.swift */; };
8947F0CE448791BD50EECF46 /* Conditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB94E06E145558123BB5BFB3 /* Conditions.swift */; };
93743B036059418560D876E6 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8D39C3C250F26302EC45AB /* SettingsView.swift */; };
+ 95278ABDCF5F4D6AC60503B1 /* AppearancePill.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92259B3E9F4468865F15DEEC /* AppearancePill.swift */; };
9AA80E035DF7B33F6EE118DF /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = CED1B71D5F9510582E869CFD /* AppState.swift */; };
9BB5AAA574AFED6C27A3F8E2 /* AppPathFinder.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC0FEE7141871ED5F9E36121 /* AppPathFinder.swift */; };
- A89DF967EC9E5E8123B2925A /* SmartScanView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11BA091943263913276F3CCF /* SmartScanView.swift */; };
+ A2AE68CC75CB72D6B10CBDF5 /* DashboardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F661A0F64CF93E482CB1728F /* DashboardView.swift */; };
A9C3A1F643C26930F442E729 /* OrphanSafetyPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AE790496C936424EF98320A /* OrphanSafetyPolicy.swift */; };
B52938BBD11842631314543D /* CategoryDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10B0AF194677EAC1D5568785 /* CategoryDetailView.swift */; };
BC6C800216343438413349A3 /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D4FD34378988D430A582ED0 /* OnboardingView.swift */; };
@@ -42,7 +44,7 @@
01B2C5F66B6D812572BD4F05 /* CLI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLI.swift; sourceTree = "<group>"; };
02E502E2B5C6AECC76E5CFEF /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
10B0AF194677EAC1D5568785 /* CategoryDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryDetailView.swift; sourceTree = "<group>"; };
- 11BA091943263913276F3CCF /* SmartScanView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmartScanView.swift; sourceTree = "<group>"; };
+ 1AB003A7751F05727DBFD1A5 /* AppTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTheme.swift; sourceTree = "<group>"; };
1D3AC5F17D7CA94FAB1E8D7A /* StringNormalization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringNormalization.swift; sourceTree = "<group>"; };
23486A54A82EE3865B784D1C /* AppInfoFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppInfoFetcher.swift; sourceTree = "<group>"; };
2641C6376DD6F5889F35510E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
@@ -63,6 +65,7 @@
63581B70F9B10231964E3602 /* PureMacApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PureMacApp.swift; sourceTree = "<group>"; };
77D3D9A9BC52839E6D0A22BC /* Locations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Locations.swift; sourceTree = "<group>"; };
798B80977D14647A5691B0A0 /* AppFilesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppFilesView.swift; sourceTree = "<group>"; };
+ 92259B3E9F4468865F15DEEC /* AppearancePill.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearancePill.swift; sourceTree = "<group>"; };
9F04B811BB0012F6D2F07F91 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
9F510F232341EE18F11DC934 /* MainWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainWindow.swift; sourceTree = "<group>"; };
A711CDF5285F68775D9B5513 /* ScanEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScanEngine.swift; sourceTree = "<group>"; };
@@ -75,6 +78,7 @@
E866A1541D289C69144A5E62 /* FullDiskAccessManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullDiskAccessManager.swift; sourceTree = "<group>"; };
EEF15CB1B8EFCA78EF491824 /* ScanError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScanError.swift; sourceTree = "<group>"; };
F31F91226CDCFBB8E303B7DA /* AppConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppConstants.swift; sourceTree = "<group>"; };
+ F661A0F64CF93E482CB1728F /* DashboardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
@@ -107,9 +111,9 @@
isa = PBXGroup;
children = (
10B0AF194677EAC1D5568785 /* CategoryDetailView.swift */,
+ F661A0F64CF93E482CB1728F /* DashboardView.swift */,
9F510F232341EE18F11DC934 /* MainWindow.swift */,
3D4FD34378988D430A582ED0 /* OnboardingView.swift */,
- 11BA091943263913276F3CCF /* SmartScanView.swift */,
DAD2EC78EB98016ADA27D114 /* Apps */,
8AE26715B5748307483A1A5E /* Components */,
9D3C2DC382F5D4B77DFD218B /* Orphans */,
@@ -148,6 +152,8 @@
8AE26715B5748307483A1A5E /* Components */ = {
isa = PBXGroup;
children = (
+ 92259B3E9F4468865F15DEEC /* AppearancePill.swift */,
+ 1AB003A7751F05727DBFD1A5 /* AppTheme.swift */,
424F7B28624C271620E13BBC /* EmptyStateView.swift */,
);
path = Components;
@@ -201,11 +207,11 @@
children = (
B2EA41E1096FA8E3B916AD13 /* Assets.xcassets */,
46660271CFF167AB0FE7371D /* Info.plist */,
+ 241E0895B09C71AB423B2F9E /* Localizable.strings */,
5664D2BDAEAA9AE3A53DB364 /* PureMac.entitlements */,
63581B70F9B10231964E3602 /* PureMacApp.swift */,
D4333B07691BD85CAE0E5B15 /* Core */,
7C1729F88C0E5563E1A3DB40 /* Extensions */,
- 241E0895B09C71AB423B2F9E /* Localizable.strings */,
F283C00EB52AB140F61500A3 /* Logic */,
3CF46713F75B81F0F86D1C6F /* Models */,
6184B2EC3D01E6E95633406E /* Services */,
@@ -273,6 +279,7 @@
};
};
buildConfigurationList = 2ABAFAE07AA42044AE58F688 /* Build configuration list for PBXProject "PureMac" */;
+ compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
@@ -286,7 +293,6 @@
mainGroup = 13CF0676D0E93925F46C13AA;
minimizedProjectReferenceProxies = 1;
preferredProjectObjectVersion = 77;
- productRefGroup = 4562CA9E5625FA4EEEFECB6D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
@@ -318,10 +324,13 @@
75B5F0401D37F2872B1AD85A /* AppListView.swift in Sources */,
9BB5AAA574AFED6C27A3F8E2 /* AppPathFinder.swift in Sources */,
9AA80E035DF7B33F6EE118DF /* AppState.swift in Sources */,
+ 535B23C0108C06475215B8E8 /* AppTheme.swift in Sources */,
+ 95278ABDCF5F4D6AC60503B1 /* AppearancePill.swift in Sources */,
F2FA881A4B2209CC2A6342FB /* CLI.swift in Sources */,
B52938BBD11842631314543D /* CategoryDetailView.swift in Sources */,
48D1431A7C99C19EEBDB056B /* CleaningEngine.swift in Sources */,
8947F0CE448791BD50EECF46 /* Conditions.swift in Sources */,
+ A2AE68CC75CB72D6B10CBDF5 /* DashboardView.swift in Sources */,
76B132F9C499225D33E0D075 /* EmptyStateView.swift in Sources */,
2253F11BDF561B617439C96B /* FullDiskAccessManager.swift in Sources */,
E60B0A2C5D0A6CAE35BF4DFB /* Locations.swift in Sources */,
@@ -336,7 +345,6 @@
D50EB059E741011EB2523731 /* ScanError.swift in Sources */,
27F449EDD1B082FE11FEC9DF /* SchedulerService.swift in Sources */,
93743B036059418560D876E6 /* SettingsView.swift in Sources */,
- A89DF967EC9E5E8123B2925A /* SmartScanView.swift in Sources */,
47C5ECD49C4DD75F271DB6CE /* StringNormalization.swift in Sources */,
340E424F759ACCDE7372F99F /* Theme.swift in Sources */,
);
diff --git a/PureMac/Views/CategoryDetailView.swift b/PureMac/Views/CategoryDetailView.swift
index 7adefa7..31e4d24 100644
--- a/PureMac/Views/CategoryDetailView.swift
+++ b/PureMac/Views/CategoryDetailView.swift
@@ -13,15 +13,22 @@ struct CategoryDetailView: View {
}
var body: some View {
- Group {
- if let result = result {
- if result.items.isEmpty {
- EmptyStateView("All Clean", systemImage: "checkmark.circle", description: "No junk files found in this category.")
+ VStack(spacing: 0) {
+ heroCard
+ .padding(.horizontal, 20)
+ .padding(.top, 16)
+ .padding(.bottom, 12)
+
+ Group {
+ if let result = result {
+ if result.items.isEmpty {
+ EmptyStateView("All Clean", systemImage: "checkmark.circle", description: "No junk files found in this category.")
+ } else {
+ fileList(result)
+ }
} else {
- fileList(result)
+ EmptyStateView("Not Scanned", systemImage: category.icon, description: "Run a scan to analyze this category.", action: { appState.scanSingleCategory(category) }, actionLabel: "Scan Now")
}
- } else {
- EmptyStateView("Not Scanned", systemImage: category.icon, description: "Run a scan to analyze this category.", action: { appState.scanSingleCategory(category) }, actionLabel: "Scan Now")
}
}
.searchable(text: $searchText, prompt: "Filter files")
@@ -81,6 +88,47 @@ struct CategoryDetailView: View {
}
}
+ // MARK: - Hero
+
+ private var heroCard: some View {
+ let totalSize = result?.totalSize ?? 0
+ let itemCount = result?.itemCount ?? 0
+ let isScanning = appState.scanState.isActive
+
+ return CardSurface(padding: 18) {
+ HStack(alignment: .center, spacing: 16) {
+ IconTile(systemName: category.icon, tint: category.color, size: 56, corner: 14)
+
+ VStack(alignment: .leading, spacing: 4) {
+ Text(category.rawValue)
+ .font(.system(size: 22, weight: .bold))
+ Text(category.description)
+ .font(.system(size: 12))
+ .foregroundStyle(.secondary)
+ if itemCount > 0 {
+ Text("\(itemCount) items · \(ByteCountFormatter.string(fromByteCount: totalSize, countStyle: .file))")
+ .font(.system(size: 11.5, weight: .medium))
+ .foregroundStyle(category.color)
+ .padding(.top, 2)
+ }
+ }
+
+ Spacer()
+
+ Button {
+ appState.scanSingleCategory(category)
+ } label: {
+ Label(isScanning ? "Scanning…" : (result == nil ? "Scan" : "Rescan"),
+ systemImage: "arrow.clockwise")
+ .font(.system(size: 12.5, weight: .semibold))
+ }
+ .buttonStyle(.bordered)
+ .controlSize(.large)
+ .disabled(isScanning)
+ }
+ }
+ }
+
// MARK: - File List
private func fileList(_ result: CategoryResult) -> some View {
diff --git a/PureMac/Views/Components/AppTheme.swift b/PureMac/Views/Components/AppTheme.swift
new file mode 100644
index 0000000..c7d8051
--- /dev/null
+++ b/PureMac/Views/Components/AppTheme.swift
@@ -0,0 +1,97 @@
+import SwiftUI
+
+/// User-overridable appearance setting that lives independently of the system
+/// preference, mirroring the prototype's titlebar light/dark toggle.
+enum AppearanceMode: String, CaseIterable, Identifiable {
+ case system, light, dark
+ var id: String { rawValue }
+
+ var label: String {
+ switch self {
+ case .system: return "System"
+ case .light: return "Light"
+ case .dark: return "Dark"
+ }
+ }
+
+ var icon: String {
+ switch self {
+ case .system: return "circle.lefthalf.filled"
+ case .light: return "sun.max.fill"
+ case .dark: return "moon.fill"
+ }
+ }
+
+ var colorScheme: ColorScheme? {
+ switch self {
+ case .system: return nil
+ case .light: return .light
+ case .dark: return .dark
+ }
+ }
+}
+
+@MainActor
+final class ThemeManager: ObservableObject {
+ static let shared = ThemeManager()
+
+ @AppStorage("PureMac.Appearance") private var rawValue: String = AppearanceMode.system.rawValue
+
+ var appearance: AppearanceMode {
+ get { AppearanceMode(rawValue: rawValue) ?? .system }
+ set { rawValue = newValue.rawValue; objectWillChange.send() }
+ }
+}
+
+/// Centralized accent palette. Keeping these in one place lets the dashboard
+/// and sidebar share semantic tints (cleanup orange, performance green, etc.)
+/// instead of scattered Color literals.
+enum Tint {
+ static let blue = Color(red: 0.04, green: 0.52, blue: 1.00)
+ static let green = Color(red: 0.18, green: 0.78, blue: 0.47)
+ static let orange = Color(red: 1.00, green: 0.62, blue: 0.04)
+ static let purple = Color(red: 0.69, green: 0.32, blue: 0.87)
+ static let pink = Color(red: 1.00, green: 0.30, blue: 0.50)
+ static let cyan = Color(red: 0.30, green: 0.80, blue: 0.95)
+ static let red = Color(red: 1.00, green: 0.27, blue: 0.23)
+ static let yellow = Color(red: 1.00, green: 0.78, blue: 0.04)
+}
+
+/// Tinted square icon container used in the sidebar and on dashboard cards.
+struct IconTile: View {
+ let systemName: String
+ var tint: Color = Tint.blue
+ var size: CGFloat = 26
+ var corner: CGFloat = 7
+
+ var body: some View {
+ ZStack {
+ RoundedRectangle(cornerRadius: corner, style: .continuous)
+ .fill(tint.opacity(0.16))
+ Image(systemName: systemName)
+ .font(.system(size: size * 0.52, weight: .semibold))
+ .foregroundStyle(tint)
+ }
+ .frame(width: size, height: size)
+ }
+}
+
+/// Card surface used on the dashboard, suggestion list, and detail pages.
+struct CardSurface<Content: View>: View {
+ var padding: CGFloat = 16
+ @ViewBuilder var content: Content
+
+ var body: some View {
+ content
+ .padding(padding)
+ .background(
+ RoundedRectangle(cornerRadius: 14, style: .continuous)
+ .fill(Color(nsColor: .controlBackgroundColor))
+ )
+ .overlay(
+ RoundedRectangle(cornerRadius: 14, style: .continuous)
+ .strokeBorder(Color.primary.opacity(0.06), lineWidth: 0.5)
+ )
+ .shadow(color: .black.opacity(0.06), radius: 6, y: 2)
+ }
+}
diff --git a/PureMac/Views/Components/AppearancePill.swift b/PureMac/Views/Components/AppearancePill.swift
new file mode 100644
index 0000000..b6d48c8
--- /dev/null
+++ b/PureMac/Views/Components/AppearancePill.swift
@@ -0,0 +1,38 @@
+import SwiftUI
+
+/// Inline 3-segment toggle (system / light / dark) with an animated active
+/// indicator that slides between segments. Replaces the SwiftUI `Menu` which
+/// looked like a generic dropdown affordance.
+struct AppearancePill: View {
+ @Binding var selection: AppearanceMode
+ @Namespace private var indicator
+
+ var body: some View {
+ HStack(spacing: 2) {
+ ForEach(AppearanceMode.allCases) { mode in
+ Button {
+ withAnimation(.spring(response: 0.32, dampingFraction: 0.78)) {
+ selection = mode
+ }
+ } label: {
+ Image(systemName: mode.icon)
+ .font(.system(size: 12, weight: .semibold))
+ .frame(width: 28, height: 22)
+ .foregroundStyle(selection == mode ? Color.primary : .secondary)
+ .background(
+ ZStack {
+ if selection == mode {
+ RoundedRectangle(cornerRadius: 6, style: .continuous)
+ .fill(Color.primary.opacity(0.10))
+ .matchedGeometryEffect(id: "indicator", in: indicator)
+ }
+ }
+ )
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .help(mode.label)
+ }
+ }
+ }
+}
diff --git a/PureMac/Views/DashboardView.swift b/PureMac/Views/DashboardView.swift
new file mode 100644
index 0000000..262276c
--- /dev/null
+++ b/PureMac/Views/DashboardView.swift
@@ -0,0 +1,585 @@
+import SwiftUI
+
+/// Landing screen modeled after the new prototype:
+/// hero gauge + stats + quick actions + suggestion cards.
+/// Replaces the old SmartScanView idle/completed states with a richer
+/// at-a-glance view, and delegates active-scan progress to inline state UI.
+struct DashboardView: View {
+ @EnvironmentObject var appState: AppState
+ @State private var showConfirmation = false
+
+ var body: some View {
+ ScrollView {
+ VStack(alignment: .leading, spacing: 20) {
+ switch appState.scanState {
+ case .idle:
+ hero
+ stats
+ if !suggestionRows.isEmpty {
+ sectionHeader("Suggested for you")
+ suggestions
+ }
+ case .scanning:
+ scanningHero
+ if !appState.allResults.isEmpty {
+ sectionHeader("Found so far")
+ liveResults
+ }
+ case .completed:
+ completedHero
+ if appState.totalJunkSize > 0 {
+ sectionHeader("By category")
+ resultsList
+ }
+ case .cleaning:
+ cleaningHero
+ case .cleaned:
+ cleanedHero
+ }
+ }
+ .padding(.horizontal, 28)
+ .padding(.vertical, 24)
+ .frame(maxWidth: 920, alignment: .leading)
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
+ .confirmationDialog(
+ "Clean \(ByteCountFormatter.string(fromByteCount: appState.totalSelectedSize, countStyle: .file))?",
+ isPresented: $showConfirmation,
+ titleVisibility: .visible
+ ) {
+ Button("Clean", role: .destructive) { appState.cleanAll() }
+ Button("Cancel", role: .cancel) {}
+ } message: {
+ Text("This will permanently delete the selected files. This cannot be undone.")
+ }
+ }
+
+ // MARK: - Hero (idle)
+
+ private var hero: some View {
+ let total = appState.diskInfo.totalSpace
+ let used = appState.diskInfo.usedSpace
+ let free = appState.diskInfo.freeSpace
+ let percentUsed = total > 0 ? Double(used) / Double(total) : 0
+
+ return CardSurface(padding: 24) {
+ HStack(alignment: .center, spacing: 28) {
+ StorageGauge(percentUsed: percentUsed)
+ .frame(width: 180, height: 180)
+
+ VStack(alignment: .leading, spacing: 12) {
+ HStack(alignment: .firstTextBaseline) {
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Storage")
+ .font(.system(size: 13, weight: .semibold))
+ .foregroundStyle(.secondary)
+ Text(ByteCountFormatter.string(fromByteCount: free, countStyle: .file))
+ .font(.system(size: 30, weight: .bold))
+ .monospacedDigit()
+ Text("free of \(ByteCountFormatter.string(fromByteCount: total, countStyle: .file))")
+ .font(.system(size: 12))
+ .foregroundStyle(.secondary)
+ }
+ Spacer()
+ Button {
+ appState.startSmartScan()
+ } label: {
+ Label("Smart Scan", systemImage: "sparkles")
+ .font(.system(size: 12.5, weight: .semibold))
+ }
+ .buttonStyle(.bordered)
+ .controlSize(.regular)
+ }
+
+ storageBreakdown(used: used, total: total)
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ }
+ }
+
+ private func storageBreakdown(used: Int64, total: Int64) -> some View {
+ let usedPct = total > 0 ? Double(used) / Double(total) : 0
+ let purgePct = total > 0 ? Double(appState.diskInfo.purgeableSpace) / Double(total) : 0
+ let junkPct = total > 0 ? min(0.4, Double(appState.totalJunkSize) / Double(total)) : 0
+
+ return VStack(alignment: .leading, spacing: 8) {
+ GeometryReader { geo in
+ ZStack(alignment: .leading) {
+ Capsule()
+ .fill(Color.primary.opacity(0.08))
+ HStack(spacing: 0) {
+ Capsule()
+ .fill(LinearGradient(colors: [Tint.blue, Tint.purple], startPoint: .leading, endPoint: .trailing))
+ .frame(width: geo.size.width * CGFloat(usedPct))
+ }
+ if junkPct > 0 {
+ Capsule()
+ .fill(Tint.orange)
+ .frame(width: max(8, geo.size.width * CGFloat(junkPct)))
+ .offset(x: geo.size.width * CGFloat(usedPct - junkPct))
+ .opacity(0.85)
+ }
+ }
+ }
+ .frame(height: 10)
+
+ HStack(spacing: 16) {
+ LegendDot(color: Tint.blue, label: "Used", value: ByteCountFormatter.string(fromByteCount: used, countStyle: .file))
+ if appState.totalJunkSize > 0 {
+ LegendDot(color: Tint.orange, label: "Junk",
+ value: ByteCountFormatter.string(fromByteCount: appState.totalJunkSize, countStyle: .file))
+ }
+ if appState.diskInfo.purgeableSpace > 0 {
+ LegendDot(color: Tint.green, label: "Purgeable",
+ value: ByteCountFormatter.string(fromByteCount: appState.diskInfo.purgeableSpace, countStyle: .file))
+ }
+ Spacer()
+ Text("\(Int(usedPct * 100))% used")
+ .font(.system(size: 11, weight: .medium))
+ .foregroundStyle(.secondary)
+ .monospacedDigit()
+ }
+ }
+ }
+
+ // MARK: - Stats
+
+ private var stats: some View {
+ let free = appState.diskInfo.freeSpace
+ let total = appState.diskInfo.totalSpace
+ let percentUsed = total > 0 ? Double(total - free) / Double(total) : 0
+
+ return LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 12), count: 4), spacing: 12) {
+ StatCard(
+ icon: "internaldrive.fill",
+ tint: Tint.blue,
+ label: "Free Space",
+ value: ByteCountFormatter.string(fromByteCount: free, countStyle: .file),
+ delta: total > 0 ? "of \(ByteCountFormatter.string(fromByteCount: total, countStyle: .file)) · \(Int(percentUsed * 100))% used" : nil
+ )
+ StatCard(
+ icon: "trash.circle.fill",
+ tint: Tint.orange,
+ label: "Junk Found",
+ value: appState.totalJunkSize > 0
+ ? ByteCountFormatter.string(fromByteCount: appState.totalJunkSize, countStyle: .file)
+ : "—",
+ delta: appState.allResults.isEmpty ? "Run a scan" : "across \(appState.allResults.count) categories"
+ )
+ StatCard(
+ icon: "square.grid.2x2.fill",
+ tint: Tint.purple,
+ label: "Apps",
+ value: "\(appState.installedApps.count)",
+ delta: "installed"
+ )
+ StatCard(
+ icon: "memorychip.fill",
+ tint: Tint.green,
+ label: "Purgeable",
+ value: appState.diskInfo.purgeableSpace > 0
+ ? ByteCountFormatter.string(fromByteCount: appState.diskInfo.purgeableSpace, countStyle: .file)
+ : "—",
+ delta: "APFS reclaimable"
+ )
+ }
+ }
+
+ // MARK: - Suggestions
+
+ private var suggestions: some View {
+ VStack(spacing: 10) {
+ ForEach(suggestionRows) { row in
+ SuggestionRow(suggestion: row)
+ }
+ }
+ }
+
+ private var suggestionRows: [Suggestion] {
+ var out: [Suggestion] = []
+ // Surface the largest pending category as a contextual nudge.
+ if let biggest = appState.allResults.max(by: { $0.totalSize < $1.totalSize }), biggest.totalSize > 0 {
+ out.append(Suggestion(
+ icon: biggest.category.icon,
+ tint: biggest.category.color,
+ title: "\(biggest.category.rawValue) is using \(biggest.formattedSize)",
+ subtitle: biggest.category.description,
+ pill: biggest.formattedSize
+ ))
+ }
+ if !appState.hasFullDiskAccess {
+ out.append(Suggestion(
+ icon: "lock.shield.fill",
+ tint: Tint.orange,
+ title: "Grant Full Disk Access for full results",
+ subtitle: "Without it, most caches and uninstall flows fail.",
+ pill: "Action"
+ ))
+ }
+ return out
+ }
+
+ // MARK: - Scanning state
+
+ private var scanningHero: some View {
+ CardSurface(padding: 24) {
+ HStack(alignment: .center, spacing: 28) {
+ ScanningGauge(progress: appState.scanProgress)
+ .frame(width: 180, height: 180)
+ VStack(alignment: .leading, spacing: 8) {
+ Text("Scanning your Mac")
+ .font(.system(size: 22, weight: .bold))
+ Text("Currently in: \(appState.currentScanCategory)")
+ .font(.system(size: 13))
+ .foregroundStyle(.secondary)
+ ProgressView(value: appState.scanProgress)
+ .progressViewStyle(.linear)
+ .frame(maxWidth: 320)
+ .padding(.top, 4)
+ }
+ Spacer(minLength: 0)
+ }
+ }
+ }
+
+ private var liveResults: some View {
+ CardSurface(padding: 0) {
+ VStack(spacing: 0) {
+ ForEach(appState.allResults.prefix(8)) { result in
+ HStack(spacing: 12) {
+ IconTile(systemName: result.category.icon, tint: result.category.color, size: 26)
+ Text(result.category.rawValue)
+ .font(.system(size: 13))
+ Spacer()
+ Text(result.formattedSize)
+ .font(.system(size: 13, weight: .semibold))
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 12)
+ if result.id != appState.allResults.prefix(8).last?.id {
+ Divider().padding(.leading, 54)
+ }
+ }
+ }
+ }
+ }
+
+ // MARK: - Completed state
+
+ private var completedHero: some View {
+ CardSurface(padding: 24) {
+ VStack(alignment: .leading, spacing: 14) {
+ HStack(alignment: .firstTextBaseline) {
+ if appState.totalJunkSize > 0 {
+ Text(ByteCountFormatter.string(fromByteCount: appState.totalJunkSize, countStyle: .file))
+ .font(.system(size: 36, weight: .bold))
+ .monospacedDigit()
+ Text("found")
+ .font(.system(size: 16))
+ .foregroundStyle(.secondary)
+ } else {
+ Label("Your Mac is clean", systemImage: "checkmark.seal.fill")
+ .font(.system(size: 22, weight: .bold))
+ .foregroundStyle(Tint.green)
+ }
+ Spacer()
+ Button("Scan Again") { appState.startSmartScan() }
+ .controlSize(.large)
+ }
+ if appState.totalJunkSize > 0 {
+ HStack {
+ if appState.totalSelectedSize > 0 {
+ Button {
+ showConfirmation = true
+ } label: {
+ Label(
+ "Clean \(ByteCountFormatter.string(fromByteCount: appState.totalSelectedSize, countStyle: .file))",
+ systemImage: "sparkles"
+ )
+ .font(.system(size: 13, weight: .semibold))
+ .padding(.horizontal, 6)
+ }
+ .buttonStyle(.borderedProminent)
+ .controlSize(.large)
+ }
+ Spacer()
+ }
+ }
+ }
+ }
+ }
+
+ private var resultsList: some View {
+ CardSurface(padding: 0) {
+ VStack(spacing: 0) {
+ ForEach(appState.allResults) { result in
+ CategoryToggleRow(result: result)
+ if result.id != appState.allResults.last?.id {
+ Divider().padding(.leading, 54)
+ }
+ }
+ }
+ }
+ }
+
+ private var cleaningHero: some View {
+ CardSurface(padding: 24) {
+ HStack(alignment: .center, spacing: 28) {
+ ScanningGauge(progress: appState.cleanProgress, tint: Tint.orange)
+ .frame(width: 180, height: 180)
+ VStack(alignment: .leading, spacing: 8) {
+ Text("Cleaning…")
+ .font(.system(size: 22, weight: .bold))
+ Text("\(Int(appState.cleanProgress * 100))% complete")
+ .font(.system(size: 13))
+ .foregroundStyle(.secondary)
+ }
+ Spacer(minLength: 0)
+ }
+ }
+ }
+
+ private var cleanedHero: some View {
+ CardSurface(padding: 24) {
+ HStack(alignment: .center, spacing: 28) {
+ ZStack {
+ Circle().fill(Tint.green.opacity(0.18))
+ Image(systemName: "checkmark")
+ .font(.system(size: 60, weight: .bold))
+ .foregroundStyle(Tint.green)
+ }
+ .frame(width: 140, height: 140)
+
+ VStack(alignment: .leading, spacing: 6) {
+ Text(ByteCountFormatter.string(fromByteCount: appState.totalFreedSpace, countStyle: .file))
+ .font(.system(size: 36, weight: .bold))
+ .monospacedDigit()
+ Text("freed")
+ .font(.system(size: 14))
+ .foregroundStyle(.secondary)
+ Button("Done") { appState.scanState = .idle }
+ .buttonStyle(.borderedProminent)
+ .controlSize(.large)
+ .padding(.top, 4)
+ }
+ Spacer(minLength: 0)
+ }
+ }
+ }
+
+ // MARK: - Helpers
+
+ private func sectionHeader(_ text: String) -> some View {
+ Text(text)
+ .font(.system(size: 16, weight: .bold))
+ .padding(.top, 4)
+ }
+}
+
+// MARK: - Components
+
+private struct StatCard: View {
+ let icon: String
+ let tint: Color
+ let label: String
+ let value: String
+ let delta: String?
+
+ var body: some View {
+ CardSurface(padding: 14) {
+ VStack(alignment: .leading, spacing: 6) {
+ HStack(spacing: 8) {
+ IconTile(systemName: icon, tint: tint, size: 26)
+ Text(label)
+ .font(.system(size: 12))
+ .foregroundStyle(.secondary)
+ }
+ Text(value)
+ .font(.system(size: 22, weight: .bold))
+ .monospacedDigit()
+ .lineLimit(1)
+ .minimumScaleFactor(0.6)
+ if let delta {
+ Text(delta)
+ .font(.system(size: 11))
+ .foregroundStyle(.tertiary)
+ }
+ }
+ }
+ }
+}
+
+private struct Suggestion: Identifiable {
+ let id = UUID()
+ let icon: String
+ let tint: Color
+ let title: String
+ let subtitle: String
+ let pill: String?
+}
+
+private struct SuggestionRow: View {
+ let suggestion: Suggestion
+ var body: some View {
+ CardSurface(padding: 14) {
+ HStack(spacing: 14) {
+ IconTile(systemName: suggestion.icon, tint: suggestion.tint, size: 36, corner: 10)
+ VStack(alignment: .leading, spacing: 2) {
+ Text(suggestion.title)
+ .font(.system(size: 13.5, weight: .semibold))
+ Text(suggestion.subtitle)
+ .font(.system(size: 12))
+ .foregroundStyle(.secondary)
+ }
+ Spacer()
+ if let pill = suggestion.pill {
+ Text(pill)
+ .font(.system(size: 12, weight: .semibold))
+ .padding(.horizontal, 10)
+ .padding(.vertical, 4)
+ .background(
+ Capsule().fill(suggestion.tint.opacity(0.15))
+ )
+ .foregroundStyle(suggestion.tint)
+ }
+ }
+ }
+ }
+}
+
+// MARK: - Gauges
+
+private struct StorageGauge: View {
+ let percentUsed: Double // 0...1
+
+ var body: some View {
+ let pct = max(0, min(1, percentUsed))
+ let displayPercent = Int(round(pct * 100))
+ let stress = pct > 0.85
+ ZStack {
+ Circle()
+ .stroke(Color.primary.opacity(0.10), lineWidth: 14)
+ Circle()
+ .trim(from: 0, to: CGFloat(pct))
+ .stroke(
+ AngularGradient(
+ colors: stress
+ ? [Tint.orange, Tint.red]
+ : [Tint.blue, Tint.purple],
+ center: .center
+ ),
+ style: StrokeStyle(lineWidth: 14, lineCap: .round)
+ )
+ .rotationEffect(.degrees(-90))
+ .shadow(color: (stress ? Tint.orange : Tint.blue).opacity(0.35), radius: 8, y: 2)
+ .animation(.easeOut(duration: 0.8), value: pct)
+ VStack(spacing: 2) {
+ Text("\(displayPercent)%")
+ .font(.system(size: 44, weight: .bold))
+ .monospacedDigit()
+ .contentTransition(.numericText())
+ Text("USED")
+ .font(.system(size: 10, weight: .semibold))
+ .tracking(0.6)
+ .foregroundStyle(.secondary)
+ }
+ }
+ }
+}
+
+private struct LegendDot: View {
+ let color: Color
+ let label: String
+ let value: String
+
+ var body: some View {
+ HStack(spacing: 6) {
+ Circle().fill(color).frame(width: 8, height: 8)
+ VStack(alignment: .leading, spacing: 0) {
+ Text(label)
+ .font(.system(size: 10.5))
+ .foregroundStyle(.secondary)
+ Text(value)
+ .font(.system(size: 11.5, weight: .semibold))
+ .monospacedDigit()
+ }
+ }
+ }
+}
+
+private struct ScanningGauge: View {
+ let progress: Double
+ var tint: Color = Tint.blue
+ @State private var rotate = false
+
+ var body: some View {
+ ZStack {
+ Circle()
+ .stroke(Color.primary.opacity(0.10), lineWidth: 14)
+ Circle()
+ .trim(from: 0, to: CGFloat(max(0.05, min(0.95, progress))))
+ .stroke(
+ AngularGradient(colors: [tint, Tint.green], center: .center),
+ style: StrokeStyle(lineWidth: 14, lineCap: .round)
+ )
+ .rotationEffect(.degrees(rotate ? 360 : 0))
+ .animation(.linear(duration: 4).repeatForever(autoreverses: false), value: rotate)
+ VStack(spacing: 2) {
+ Text("\(Int(progress * 100))%")
+ .font(.system(size: 36, weight: .bold))
+ .monospacedDigit()
+ Text("SCANNING")
+ .font(.system(size: 10, weight: .semibold))
+ .tracking(0.6)
+ .foregroundStyle(.secondary)
+ }
+ }
+ .onAppear { rotate = true }
+ }
+}
+
+// MARK: - Toggle row
+
+private struct CategoryToggleRow: View {
+ @EnvironmentObject var appState: AppState
+ let result: CategoryResult
+
+ private var isFullySelected: Bool {
+ appState.selectedCountInCategory(result.category) == result.itemCount
+ }
+
+ var body: some View {
+ Toggle(isOn: Binding(
+ get: { isFullySelected },
+ set: { newValue in
+ if newValue {
+ appState.selectAllInCategory(result.category)
+ } else {
+ appState.deselectAllInCategory(result.category)
+ }
+ }
+ )) {
+ HStack(spacing: 12) {
+ IconTile(systemName: result.category.icon, tint: result.category.color, size: 28)
+ VStack(alignment: .leading, spacing: 1) {
+ Text(LocalizedStringKey(result.category.rawValue))
+ .font(.system(size: 13.5, weight: .semibold))
+ Text("\(result.itemCount) items")
+ .font(.system(size: 11.5))
+ .foregroundStyle(.secondary)
+ }
+ Spacer()
+ Text(result.formattedSize)
+ .font(.system(size: 13, weight: .semibold))
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ }
+ }
+ .toggleStyle(.checkbox)
+ .padding(.horizontal, 16)
+ .padding(.vertical, 10)
+ }
+}
diff --git a/PureMac/Views/MainWindow.swift b/PureMac/Views/MainWindow.swift
index 071eb52..754d3c8 100644
--- a/PureMac/Views/MainWindow.swift
+++ b/PureMac/Views/MainWindow.swift
@@ -2,6 +2,7 @@ import SwiftUI
struct MainWindow: View {
@EnvironmentObject var appState: AppState
+ @EnvironmentObject var theme: ThemeManager
@State private var selectedSection: AppSection? = .cleaning(.smartScan)
@State private var columnVisibility: NavigationSplitViewVisibility = .all
@@ -9,56 +10,157 @@ struct MainWindow: View {
NavigationSplitView(columnVisibility: $columnVisibility) {
sidebar
} detail: {
- detailView
+ detailContainer
+ }
+ .navigationSplitViewColumnWidth(min: 232, ideal: 244, max: 320)
+ .frame(minWidth: 980, minHeight: 600)
+ .toolbar {
+ ToolbarItem(placement: .navigation) {
+ appearancePicker
+ }
}
- .navigationSplitViewColumnWidth(min: 220, ideal: 250, max: 320)
- .frame(minWidth: 860, minHeight: 520)
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
appState.checkFullDiskAccess()
}
- }
-
- // All sidebar items as a flat array so ForEach gives proper selectability.
- // Smart Scan is pinned to the top so users always have a path back to it -
- // otherwise the landing page disappears after selecting another tab (#69).
- private var allSidebarItems: [SidebarItem] {
- let smartSize = appState.categoryResults[.smartScan]?.totalSize ?? appState.totalJunkSize
- let smartBadge = smartSize > 0 ? ByteCountFormatter.string(fromByteCount: smartSize, countStyle: .file) : nil
- var items: [SidebarItem] = [
- SidebarItem(section: .cleaning(.smartScan), label: LocalizedStringKey(CleaningCategory.smartScan.rawValue), icon: CleaningCategory.smartScan.icon, badge: smartBadge, group: .home),
- SidebarItem(section: .apps, label: "Installed Apps", icon: "square.grid.2x2", badge: "\(appState.installedApps.count)", group: .applications),
- SidebarItem(section: .orphans, label: "Orphaned Files", icon: "doc.questionmark", badge: appState.orphanedFiles.count > 0 ? "\(appState.orphanedFiles.count)" : nil, group: .applications),
- ]
- for category in CleaningCategory.scannable {
- let size = appState.categoryResults[category]?.totalSize ?? 0
- let badge = size > 0 ? ByteCountFormatter.string(fromByteCount: size, countStyle: .file) : nil
- items.append(SidebarItem(section: .cleaning(category), label: LocalizedStringKey(category.rawValue), icon: category.icon, badge: badge, group: .cleaning))
+ .alert("Couldn't clean everything", isPresented: Binding(
+ get: { appState.cleanError != nil },
+ set: { if !$0 { appState.cleanError = nil } }
+ )) {
+ Button("Open System Settings") {
+ FullDiskAccessManager.shared.openFullDiskAccessSettings()
+ appState.cleanError = nil
+ }
+ Button("OK", role: .cancel) { appState.cleanError = nil }
+ } message: {
+ Text(appState.cleanError ?? "")
}
- return items
}
+ // MARK: - Sidebar
+
private var sidebar: some View {
List(selection: $selectedSection) {
- let grouped = Dictionary(grouping: allSidebarItems, by: \.group)
- ForEach(SidebarGroup.allCases, id: \.self) { group in
- Section(group.title) {
- ForEach(grouped[group] ?? [], id: \.section) { item in
- HStack {
- Label(item.label, systemImage: item.icon)
- Spacer()
- if let badge = item.badge {
- Text(badge)
- .font(.caption)
- .foregroundStyle(.secondary)
- }
- }
- .tag(item.section)
- }
+ Section {
+ navRow(section: .cleaning(.smartScan), label: "Dashboard",
+ icon: "sparkles", tint: Tint.blue,
+ badge: dashboardBadge)
+ } header: { sectionLabel("Overview") }
+
+ Section {
+ navRow(section: .apps, label: "Installed Apps",
+ icon: "square.grid.2x2.fill", tint: Tint.purple,
+ badge: appState.installedApps.isEmpty ? nil : "\(appState.installedApps.count)")
+ navRow(section: .orphans, label: "Orphaned Files",
+ icon: "doc.questionmark.fill", tint: Tint.pink,
+ badge: appState.orphanedFiles.isEmpty ? nil : "\(appState.orphanedFiles.count)")
+ } header: { sectionLabel("Applications") }
+
+ Section {
+ ForEach(CleaningCategory.scannable) { category in
+ navRow(section: .cleaning(category),
+ label: category.rawValue,
+ icon: category.icon,
+ tint: category.color,
+ badge: sizeBadge(for: category))
}
- }
+ } header: { sectionLabel("Cleanup") }
}
.listStyle(.sidebar)
.navigationTitle("PureMac")
+ .safeAreaInset(edge: .bottom) {
+ healthFooter
+ }
+ }
+
+ private func sectionLabel(_ text: String) -> some View {
+ Text(text)
+ .font(.system(size: 10.5, weight: .semibold))
+ .tracking(0.5)
+ .foregroundStyle(.tertiary)
+ .textCase(.uppercase)
+ }
+
+ private func navRow(section: AppSection, label: String, icon: String,
+ tint: Color, badge: String?) -> some View {
+ HStack(spacing: 10) {
+ IconTile(systemName: icon, tint: tint, size: 24)
+ Text(label)
+ .font(.system(size: 13))
+ Spacer()
+ if let badge {
+ Text(badge)
+ .font(.system(size: 11, weight: .medium))
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ .padding(.horizontal, 7)
+ .padding(.vertical, 2)
+ .background(
+ Capsule().fill(Color.primary.opacity(0.06))
+ )
+ }
+ }
+ .padding(.vertical, 1)
+ .tag(section)
+ }
+
+ private var dashboardBadge: String? {
+ appState.totalJunkSize > 0
+ ? ByteCountFormatter.string(fromByteCount: appState.totalJunkSize, countStyle: .file)
+ : nil
+ }
+
+ private func sizeBadge(for category: CleaningCategory) -> String? {
+ guard let size = appState.categoryResults[category]?.totalSize, size > 0 else { return nil }
+ return ByteCountFormatter.string(fromByteCount: size, countStyle: .file)
+ }
+
+ private var healthFooter: some View {
+ HStack(spacing: 10) {
+ Circle()
+ .fill(appState.hasFullDiskAccess ? Tint.green : Tint.orange)
+ .frame(width: 8, height: 8)
+ .background(
+ Circle()
+ .fill((appState.hasFullDiskAccess ? Tint.green : Tint.orange).opacity(0.25))
+ .frame(width: 18, height: 18)
+ )
+ VStack(alignment: .leading, spacing: 1) {
+ Text(appState.hasFullDiskAccess ? "Ready to clean" : "Limited access")
+ .font(.system(size: 12, weight: .semibold))
+ Text(appState.hasFullDiskAccess ? "Full Disk Access granted" : "Grant FDA in Settings")
+ .font(.system(size: 10.5))
+ .foregroundStyle(.secondary)
+ }
+ Spacer()
+ }
+ .padding(.horizontal, 14)
+ .padding(.vertical, 10)
+ .background(.bar)
+ }
+
+ // MARK: - Toolbar
+
+ private var appearancePicker: some View {
+ AppearancePill(selection: Binding(
+ get: { theme.appearance },
+ set: { theme.appearance = $0 }
+ ))
+ }
+
+ // MARK: - Detail
+
+ @ViewBuilder
+ private var detailContainer: some View {
+ VStack(spacing: 0) {
+ if !appState.hasFullDiskAccess && !appState.fdaBannerDismissed {
+ fdaToast
+ .padding(.horizontal, 16)
+ .padding(.top, 12)
+ }
+ detailView
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .background(Color(nsColor: .windowBackgroundColor))
}
@ViewBuilder
@@ -70,32 +172,65 @@ struct MainWindow: View {
OrphanListView()
case .cleaning(let category):
if category == .smartScan {
- SmartScanView()
+ DashboardView()
} else {
CategoryDetailView(category: category)
}
case nil:
- EmptyStateView("PureMac", systemImage: "sparkles", description: "Select a category from the sidebar to get started.")
+ EmptyStateView("PureMac", systemImage: "sparkles",
+ description: "Select a category from the sidebar to get started.")
}
}
-}
-private enum SidebarGroup: Hashable, CaseIterable {
- case home, applications, cleaning
+ // Card-shaped FDA toast that matches the dashboard surface aesthetic
+ // rather than the flat orange bar.
+ private var fdaToast: some View {
+ HStack(spacing: 14) {
+ ZStack {
+ RoundedRectangle(cornerRadius: 9, style: .continuous)
+ .fill(Color.white.opacity(0.18))
+ Image(systemName: "exclamationmark.shield.fill")
+ .font(.system(size: 16, weight: .semibold))
+ .foregroundStyle(.white)
+ }
+ .frame(width: 34, height: 34)
+
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Full Disk Access required")
+ .font(.system(size: 13.5, weight: .bold))
+ .foregroundStyle(.white)
+ Text("macOS blocks PureMac from cleaning caches and uninstalling apps until you grant access.")
+ .font(.system(size: 11.5))
+ .foregroundStyle(.white.opacity(0.92))
+ }
+
+ Spacer()
- var title: LocalizedStringKey {
- switch self {
- case .home: return "Home"
- case .applications: return "Applications"
- case .cleaning: return "Cleaning"
+ Button("Grant Access") {
+ FullDiskAccessManager.shared.openFullDiskAccessSettings()
+ }
+ .buttonStyle(.borderedProminent)
+ .tint(.white)
+ .foregroundStyle(Tint.orange)
+
+ Button {
+ appState.fdaBannerDismissed = true
+ } label: {
+ Image(systemName: "xmark")
+ .font(.system(size: 11, weight: .bold))
+ .foregroundStyle(.white.opacity(0.85))
+ .padding(6)
+ }
+ .buttonStyle(.plain)
}
+ .padding(14)
+ .background(
+ RoundedRectangle(cornerRadius: 14, style: .continuous)
+ .fill(
+ LinearGradient(colors: [Tint.orange, Color(red: 1.0, green: 0.42, blue: 0.0)],
+ startPoint: .topLeading, endPoint: .bottomTrailing)
+ )
+ )
+ .shadow(color: Tint.orange.opacity(0.35), radius: 12, y: 4)
}
}
-
-private struct SidebarItem {
- let section: AppSection
- let label: LocalizedStringKey
- let icon: String
- let badge: String?
- let group: SidebarGroup
-}
diff --git a/PureMac/Views/SmartScanView.swift b/PureMac/Views/SmartScanView.swift
deleted file mode 100644
index ebbdd9f..0000000
--- a/PureMac/Views/SmartScanView.swift
+++ /dev/null
@@ -1,253 +0,0 @@
-import SwiftUI
-
-struct SmartScanView: View {
- @EnvironmentObject var appState: AppState
- @State private var showConfirmation = false
-
- var body: some View {
- VStack(spacing: 20) {
- Spacer()
-
- switch appState.scanState {
- case .idle:
- idleView
- case .scanning:
- scanningView
- case .completed:
- completedView
- case .cleaning:
- cleaningView
- case .cleaned:
- cleanedView
- }
-
- Spacer()
- }
- .padding()
- }
-
- // MARK: - Idle
-
- private var idleView: some View {
- VStack(spacing: 20) {
- Image(systemName: "magnifyingglass")
- .font(.system(size: 48))
- .foregroundStyle(.secondary)
-
- Text("Ready to Scan")
- .font(.title2)
-
- GroupBox("Disk Usage") {
- Grid(alignment: .leading, horizontalSpacing: 12, verticalSpacing: 8) {
- GridRow {
- Text("Total")
- .foregroundStyle(.secondary)
- Text(appState.diskInfo.formattedTotal)
- .fontWeight(.medium)
- }
- GridRow {
- Text("Used")
- .foregroundStyle(.secondary)
- Text(appState.diskInfo.formattedUsed)
- .fontWeight(.medium)
- }
- GridRow {
- Text("Free")
- .foregroundStyle(.secondary)
- Text(appState.diskInfo.formattedFree)
- .fontWeight(.medium)
- }
- if appState.diskInfo.purgeableSpace > 0 {
- GridRow {
- Text("Purgeable")
- .foregroundStyle(.secondary)
- Text(appState.diskInfo.formattedPurgeable)
- .fontWeight(.medium)
- }
- }
- }
- .padding(.vertical, 4)
- }
- .frame(maxWidth: 300)
-
- Button("Start Scan") {
- appState.startSmartScan()
- }
- .buttonStyle(.borderedProminent)
- .controlSize(.large)
- }
- }
-
- // MARK: - Scanning
-
- private var scanningView: some View {
- VStack(spacing: 20) {
- Text("Scanning...")
- .font(.title2)
-
- ProgressView(value: appState.scanProgress) {
- Text(appState.currentScanCategory)
- .foregroundStyle(.secondary)
- } currentValueLabel: {
- Text("\(Int(appState.scanProgress * 100))%")
- }
- .progressViewStyle(.linear)
- .frame(maxWidth: 350)
-
- if !appState.allResults.isEmpty {
- GroupBox("Results Found") {
- VStack(alignment: .leading, spacing: 6) {
- ForEach(appState.allResults.prefix(6)) { result in
- HStack {
- Image(systemName: result.category.icon)
- .frame(width: 20)
- Text(LocalizedStringKey(result.category.rawValue))
- Spacer()
- Text(result.formattedSize)
- .foregroundStyle(.secondary)
- }
- .font(.callout)
- }
- }
- .padding(.vertical, 4)
- }
- .frame(maxWidth: 400)
- }
- }
- }
-
- // MARK: - Completed
-
- private var completedView: some View {
- VStack(spacing: 20) {
- if appState.totalJunkSize > 0 {
- Text(ByteCountFormatter.string(fromByteCount: appState.totalJunkSize, countStyle: .file))
- .font(.system(size: 36, weight: .bold, design: .rounded))
-
- Text("junk found")
- .font(.title3)
- .foregroundStyle(.secondary)
-
- GroupBox {
- VStack(alignment: .leading, spacing: 6) {
- ForEach(appState.allResults) { result in
- CategoryToggleRow(result: result)
- }
- }
- .padding(.vertical, 4)
- }
- .frame(maxWidth: 450)
-
- HStack(spacing: 12) {
- if appState.totalSelectedSize > 0 {
- Button("Clean Selected (\(ByteCountFormatter.string(fromByteCount: appState.totalSelectedSize, countStyle: .file)))") {
- showConfirmation = true
- }
- .buttonStyle(.borderedProminent)
- .controlSize(.large)
- }
-
- Button("Scan Again") {
- appState.startSmartScan()
- }
- .controlSize(.large)
- }
- .confirmationDialog("Clean \(ByteCountFormatter.string(fromByteCount: appState.totalSelectedSize, countStyle: .file))?", isPresented: $showConfirmation, titleVisibility: .visible) {
- Button("Clean", role: .destructive) {
- appState.cleanAll()
- }
- Button("Cancel", role: .cancel) {}
- } message: {
- Text("This will permanently delete the selected files. This cannot be undone.")
- }
- } else {
- Image(systemName: "checkmark.circle")
- .font(.system(size: 48))
- .foregroundStyle(.green)
-
- Text("Your Mac is clean")
- .font(.title2)
-
- Button("Scan Again") {
- appState.startSmartScan()
- }
- .buttonStyle(.borderedProminent)
- .controlSize(.large)
- }
- }
- }
-
- // MARK: - Cleaning
-
- private var cleaningView: some View {
- VStack(spacing: 20) {
- ProgressView(value: appState.cleanProgress) {
- Text("Cleaning...")
- .font(.title3)
- } currentValueLabel: {
- Text("\(Int(appState.cleanProgress * 100))%")
- }
- .progressViewStyle(.linear)
- .frame(maxWidth: 350)
- }
- }
-
- // MARK: - Cleaned
-
- private var cleanedView: some View {
- VStack(spacing: 20) {
- Image(systemName: "checkmark.circle")
- .font(.system(size: 48))
- .foregroundStyle(.green)
-
- Text(ByteCountFormatter.string(fromByteCount: appState.totalFreedSpace, countStyle: .file))
- .font(.system(size: 36, weight: .bold, design: .rounded))
-
- Text("freed")
- .font(.title3)
- .foregroundStyle(.secondary)
-
- Button("Done") {
- appState.scanState = .idle
- }
- .buttonStyle(.borderedProminent)
- .controlSize(.large)
- }
- }
-}
-
-// MARK: - Category Toggle Row
-
-private struct CategoryToggleRow: View {
- @EnvironmentObject var appState: AppState
- let result: CategoryResult
-
- private var isFullySelected: Bool {
- appState.selectedCountInCategory(result.category) == result.itemCount
- }
-
- var body: some View {
- Toggle(isOn: Binding(
- get: { isFullySelected },
- set: { newValue in
- if newValue {
- appState.selectAllInCategory(result.category)
- } else {
- appState.deselectAllInCategory(result.category)
- }
- }
- )) {
- HStack {
- Image(systemName: result.category.icon)
- .frame(width: 20)
- Text(LocalizedStringKey(result.category.rawValue))
- Spacer()
- Text("\(result.itemCount) items")
- .foregroundStyle(.secondary)
- Text(result.formattedSize)
- .fontWeight(.medium)
- }
- }
- .toggleStyle(.checkbox)
- }
-}
diff --git a/docs/ui-prototype/new.html b/docs/ui-prototype/new.html
new file mode 100644
index 0000000..ad7c451
--- /dev/null
+++ b/docs/ui-prototype/new.html
@@ -0,0 +1,808 @@
+<!DOCTYPE html>
+<html lang="en" data-theme="dark">
+<head>
+<meta charset="UTF-8">
+<title>PureMac — Proposed UI</title>
+<style>
+ * { box-sizing: border-box; margin: 0; padding: 0; }
+ :root {
+ --bg: #f4f4f7;
+ --bg-elev: #ffffff;
+ --bg-glass: rgba(255,255,255,0.72);
+ --sidebar: #fafafa;
+ --border: rgba(0,0,0,0.08);
+ --border-strong: rgba(0,0,0,0.14);
+ --text: #1c1c1e;
+ --text-2: #6c6c70;
+ --text-3: #98989d;
+ --accent: #0a84ff;
+ --accent-soft: rgba(10,132,255,0.12);
+ --good: #30c779;
+ --warn: #ff9f0a;
+ --bad: #ff453a;
+ --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 0 0 0.5px rgba(0,0,0,0.06);
+ --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.06);
+ --shadow-lg: 0 16px 48px rgba(0,0,0,0.10), 0 0 0 0.5px rgba(0,0,0,0.08);
+ --radius-sm: 8px;
+ --radius-md: 12px;
+ --radius-lg: 18px;
+ --grad-hero: radial-gradient(ellipse at top left, rgba(10,132,255,0.12), transparent 60%),
+ radial-gradient(ellipse at bottom right, rgba(48,199,121,0.10), transparent 50%);
+ }
+ [data-theme="dark"] {
+ --bg: #1a1a1c;
+ --bg-elev: #232326;
+ --bg-glass: rgba(35,35,38,0.72);
+ --sidebar: #1f1f22;
+ --border: rgba(255,255,255,0.08);
+ --border-strong: rgba(255,255,255,0.14);
+ --text: #f2f2f7;
+ --text-2: #a8a8ad;
+ --text-3: #6c6c70;
+ --accent: #409cff;
+ --accent-soft: rgba(64,156,255,0.18);
+ --good: #34d399;
+ --warn: #fbbf24;
+ --bad: #f87171;
+ --shadow-sm: 0 1px 2px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(255,255,255,0.06);
+ --shadow-md: 0 8px 24px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(255,255,255,0.06);
+ --shadow-lg: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 0.5px rgba(255,255,255,0.08);
+ --grad-hero: radial-gradient(ellipse at top left, rgba(64,156,255,0.20), transparent 55%),
+ radial-gradient(ellipse at bottom right, rgba(52,211,153,0.15), transparent 50%);
+ }
+
+ html, body {
+ height: 100%;
+ font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
+ font-size: 13.5px;
+ color: var(--text);
+ background: var(--bg);
+ -webkit-font-smoothing: antialiased;
+ user-select: none;
+ transition: background 0.25s ease, color 0.25s ease;
+ }
+ body { display: flex; align-items: center; justify-content: center; padding: 24px; }
+
+ .window {
+ width: 100%; max-width: 1180px; height: calc(100vh - 48px); max-height: 760px;
+ display: flex; flex-direction: column;
+ background: var(--bg-elev);
+ border-radius: 14px;
+ overflow: hidden;
+ box-shadow: var(--shadow-lg);
+ }
+
+ .titlebar {
+ height: 44px; flex-shrink: 0;
+ display: flex; align-items: center;
+ padding: 0 14px;
+ background: var(--bg-glass);
+ backdrop-filter: blur(20px) saturate(180%);
+ -webkit-backdrop-filter: blur(20px) saturate(180%);
+ border-bottom: 0.5px solid var(--border);
+ gap: 14px;
+ }
+ .traffic { display: flex; gap: 8px; }
+ .traffic .dot { width: 12px; height: 12px; border-radius: 50%; }
+ .traffic .red { background: #ff5f57; }
+ .traffic .yellow { background: #febc2e; }
+ .traffic .green { background: #28c840; }
+ .titlebar .brand {
+ display: flex; align-items: center; gap: 8px;
+ font-size: 13px; font-weight: 600;
+ color: var(--text);
+ }
+ .brand-mark {
+ width: 22px; height: 22px;
+ border-radius: 6px;
+ background: linear-gradient(135deg, var(--accent), #30c779);
+ display: flex; align-items: center; justify-content: center;
+ box-shadow: 0 2px 6px rgba(10,132,255,0.4);
+ }
+ .titlebar .spacer { flex: 1; }
+ .theme-toggle {
+ display: flex; gap: 2px; padding: 2px;
+ background: var(--bg);
+ border-radius: 8px; border: 0.5px solid var(--border);
+ }
+ .theme-toggle button {
+ border: 0; background: transparent; color: var(--text-2);
+ padding: 5px 9px; border-radius: 6px; cursor: pointer;
+ display: flex; align-items: center; justify-content: center;
+ }
+ .theme-toggle button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
+ .icon-btn {
+ border: 0; background: transparent; color: var(--text-2);
+ width: 30px; height: 30px; border-radius: 8px;
+ display: flex; align-items: center; justify-content: center;
+ cursor: pointer;
+ }
+ .icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
+
+ .body { flex: 1; display: flex; min-height: 0; }
+
+ /* Sidebar */
+ .sidebar {
+ width: 232px; flex-shrink: 0;
+ background: var(--sidebar);
+ border-right: 0.5px solid var(--border);
+ overflow-y: auto;
+ padding: 8px 8px 14px;
+ display: flex; flex-direction: column;
+ }
+ .sidebar h6 {
+ font-size: 10.5px; font-weight: 600;
+ text-transform: uppercase;
+ color: var(--text-3);
+ padding: 14px 12px 6px;
+ letter-spacing: 0.5px;
+ }
+ .nav-row {
+ display: flex; align-items: center;
+ padding: 7px 10px;
+ border-radius: 7px;
+ cursor: pointer;
+ font-size: 13px;
+ color: var(--text);
+ gap: 10px;
+ margin: 1px 0;
+ transition: background 0.15s ease, transform 0.15s ease;
+ }
+ .nav-row:hover { background: var(--accent-soft); }
+ .nav-row.active { background: var(--accent); color: white; box-shadow: 0 4px 12px rgba(10,132,255,0.35); }
+ .nav-row.active .nav-icon { color: white; background: rgba(255,255,255,0.18); }
+ .nav-row.active .badge { background: rgba(255,255,255,0.22); color: white; }
+ .nav-icon {
+ width: 24px; height: 24px;
+ border-radius: 6px;
+ background: var(--accent-soft);
+ color: var(--accent);
+ display: flex; align-items: center; justify-content: center;
+ flex-shrink: 0;
+ transition: background 0.15s ease;
+ }
+ .nav-icon svg { width: 14px; height: 14px; }
+ .nav-row .label { flex: 1; }
+ .nav-row .badge {
+ font-size: 11px;
+ background: var(--bg);
+ color: var(--text-2);
+ padding: 2px 7px;
+ border-radius: 10px;
+ font-variant-numeric: tabular-nums;
+ font-weight: 500;
+ }
+
+ .sidebar-footer {
+ margin-top: auto; padding: 12px 8px 4px;
+ border-top: 0.5px solid var(--border);
+ }
+ .sidebar-footer .health {
+ display: flex; align-items: center; gap: 10px;
+ padding: 8px;
+ }
+ .sidebar-footer .health .dot {
+ width: 8px; height: 8px; border-radius: 50%; background: var(--good);
+ box-shadow: 0 0 0 4px rgba(48,199,121,0.18);
+ }
+ .sidebar-footer .health .meta { display: flex; flex-direction: column; gap: 1px; flex: 1; }
+ .sidebar-footer .health .label { font-size: 11px; color: var(--text-3); }
+ .sidebar-footer .health .value { font-size: 13px; font-weight: 600; }
+
+ /* Detail */
+ .detail {
+ flex: 1; overflow-y: auto;
+ background: var(--bg);
+ }
+ .page {
+ padding: 28px 32px 40px;
+ max-width: 880px;
+ margin: 0 auto;
+ }
+
+ /* Hero */
+ .hero {
+ background: var(--bg-elev);
+ border-radius: var(--radius-lg);
+ border: 0.5px solid var(--border);
+ box-shadow: var(--shadow-md);
+ padding: 28px;
+ display: grid;
+ grid-template-columns: 220px 1fr;
+ gap: 28px;
+ align-items: center;
+ background-image: var(--grad-hero);
+ background-color: var(--bg-elev);
+ }
+ .gauge-wrap { display: flex; align-items: center; justify-content: center; }
+ .gauge {
+ position: relative; width: 180px; height: 180px;
+ }
+ .gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
+ .gauge .track { stroke: var(--border); stroke-width: 14; fill: none; }
+ .gauge .progress {
+ stroke: url(#gradGauge);
+ stroke-width: 14; fill: none;
+ stroke-linecap: round;
+ stroke-dasharray: 502;
+ stroke-dashoffset: 90;
+ filter: drop-shadow(0 4px 12px rgba(10,132,255,0.4));
+ }
+ .gauge .center {
+ position: absolute; inset: 0;
+ display: flex; flex-direction: column;
+ align-items: center; justify-content: center;
+ }
+ .gauge .score { font-size: 48px; font-weight: 700; letter-spacing: -1px; }
+ .gauge .score-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; }
+
+ .hero-info h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.4px; }
+ .hero-info .sub { color: var(--text-2); margin-bottom: 18px; }
+ .hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
+
+ .btn {
+ display: inline-flex; align-items: center; gap: 6px;
+ border: 0; padding: 9px 16px;
+ border-radius: 9px;
+ font-size: 13px; font-weight: 600;
+ cursor: pointer;
+ transition: transform 0.1s ease, background 0.15s ease;
+ }
+ .btn svg { width: 14px; height: 14px; }
+ .btn-primary {
+ background: var(--accent); color: white;
+ box-shadow: 0 4px 12px rgba(10,132,255,0.35);
+ }
+ .btn-primary:hover { transform: translateY(-1px); }
+ .btn-ghost {
+ background: var(--bg);
+ color: var(--text);
+ border: 0.5px solid var(--border-strong);
+ }
+ .btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }
+
+ /* Stats grid */
+ .stats {
+ display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
+ margin-top: 20px;
+ }
+ .stat {
+ background: var(--bg-elev);
+ border: 0.5px solid var(--border);
+ border-radius: var(--radius-md);
+ padding: 14px 16px;
+ box-shadow: var(--shadow-sm);
+ transition: transform 0.15s ease, box-shadow 0.15s ease;
+ }
+ .stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
+ .stat .stat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
+ .stat .icon-tile {
+ width: 26px; height: 26px; border-radius: 7px;
+ display: flex; align-items: center; justify-content: center;
+ }
+ .stat .icon-tile svg { width: 14px; height: 14px; }
+ .stat .label { font-size: 12px; color: var(--text-2); }
+ .stat .value { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
+ .stat .delta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
+ .tile-blue { background: rgba(10,132,255,0.14); color: var(--accent); }
+ .tile-green { background: rgba(48,199,121,0.14); color: var(--good); }
+ .tile-orange { background: rgba(255,159,10,0.14); color: var(--warn); }
+ .tile-purple { background: rgba(175,82,222,0.14); color: #af52de; }
+
+ /* Section header */
+ .section-head {
+ display: flex; align-items: center; justify-content: space-between;
+ margin: 28px 0 12px;
+ }
+ .section-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
+ .section-head .link { color: var(--accent); font-size: 12px; cursor: pointer; }
+
+ /* Quick actions */
+ .quick-actions {
+ display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
+ }
+ .qa {
+ background: var(--bg-elev);
+ border: 0.5px solid var(--border);
+ border-radius: var(--radius-md);
+ padding: 14px 14px 14px 14px;
+ cursor: pointer;
+ display: flex; flex-direction: column;
+ gap: 10px;
+ transition: transform 0.15s ease, box-shadow 0.15s ease;
+ box-shadow: var(--shadow-sm);
+ }
+ .qa:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
+ .qa .icon-tile { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
+ .qa .icon-tile svg { width: 16px; height: 16px; }
+ .qa .qa-title { font-size: 13.5px; font-weight: 600; }
+ .qa .qa-sub { font-size: 11.5px; color: var(--text-2); }
+
+ /* Suggestion cards */
+ .suggestions { display: flex; flex-direction: column; gap: 10px; }
+ .suggestion {
+ display: flex; align-items: center; gap: 14px;
+ background: var(--bg-elev);
+ border: 0.5px solid var(--border);
+ border-radius: var(--radius-md);
+ padding: 14px 16px;
+ box-shadow: var(--shadow-sm);
+ }
+ .suggestion .icon-tile { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; }
+ .suggestion .icon-tile svg { width: 16px; height: 16px; }
+ .suggestion .body-text { flex: 1; }
+ .suggestion .body-text .t { font-size: 13.5px; font-weight: 600; }
+ .suggestion .body-text .s { font-size: 12px; color: var(--text-2); margin-top: 2px; }
+ .suggestion .size-pill {
+ padding: 4px 10px; border-radius: 999px;
+ font-size: 12px; font-weight: 600;
+ background: var(--accent-soft); color: var(--accent);
+ font-variant-numeric: tabular-nums;
+ }
+
+ /* Generic page */
+ .page-header { margin-bottom: 18px; }
+ .page-header h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
+ .page-header p { color: var(--text-2); font-size: 13px; margin-top: 2px; }
+
+ /* List */
+ .list-card {
+ background: var(--bg-elev);
+ border: 0.5px solid var(--border);
+ border-radius: var(--radius-md);
+ overflow: hidden;
+ box-shadow: var(--shadow-sm);
+ }
+ .list-row {
+ display: flex; align-items: center;
+ padding: 12px 16px; gap: 12px;
+ border-bottom: 0.5px solid var(--border);
+ }
+ .list-row:last-child { border-bottom: 0; }
+ .list-row .check {
+ width: 16px; height: 16px; border-radius: 4px;
+ border: 1.5px solid var(--border-strong);
+ display: flex; align-items: center; justify-content: center;
+ color: white;
+ cursor: pointer;
+ }
+ .list-row .check.on { background: var(--accent); border-color: var(--accent); }
+ .list-row .check.on::after { content: "✓"; font-size: 11px; font-weight: bold; }
+ .list-row .name { flex: 1; font-size: 13.5px; }
+ .list-row .meta { font-size: 12px; color: var(--text-3); }
+ .list-row .size { font-size: 12.5px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
+
+ /* FDA banner */
+ .toast {
+ position: relative;
+ background: linear-gradient(135deg, #ff9f0a, #ff6a00);
+ color: white;
+ padding: 14px 18px;
+ border-radius: var(--radius-md);
+ display: flex; align-items: center; gap: 14px;
+ box-shadow: 0 8px 24px rgba(255,159,10,0.35);
+ margin-bottom: 18px;
+ }
+ .toast .icon-tile { background: rgba(255,255,255,0.18); width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
+ .toast .body-text { flex: 1; }
+ .toast .body-text .t { font-weight: 700; }
+ .toast .body-text .s { font-size: 12px; opacity: 0.9; margin-top: 1px; }
+ .toast button { background: white; color: #ff6a00; border: 0; padding: 7px 14px; font-size: 12px; font-weight: 700; border-radius: 8px; cursor: pointer; }
+
+ /* Animated scan ring shimmer */
+ @keyframes pulse {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.6; }
+ }
+ .gauge .progress.scanning { animation: pulse 1.6s ease-in-out infinite; }
+</style>
+</head>
+<body>
+
+<svg width="0" height="0" style="position:absolute">
+ <defs>
+ <linearGradient id="gradGauge" x1="0%" y1="0%" x2="100%" y2="100%">
+ <stop offset="0%" stop-color="#0a84ff" />
+ <stop offset="100%" stop-color="#30c779" />
+ </linearGradient>
+ </defs>
+ <symbol id="i-sparkles" viewBox="0 0 16 16"><path fill="currentColor" d="M8 1l1.4 3.6L13 6l-3.6 1.4L8 11 6.6 7.4 3 6l3.6-1.4zM2 11l.7 1.3L4 13l-1.3.7L2 15l-.7-1.3L0 13l1.3-.7zm12-1l.7 1.3L16 12l-1.3.7L14 14l-.7-1.3L12 12l1.3-.7z"/></symbol>
+ <symbol id="i-grid" viewBox="0 0 16 16"><path fill="currentColor" d="M2 2h5v5H2zm7 0h5v5H9zM2 9h5v5H2zm7 0h5v5H9z"/></symbol>
+ <symbol id="i-broom" viewBox="0 0 16 16"><path fill="currentColor" d="M11 1h2v6l-1 4H4l-1-4V7h2v3h5V7zm-7 11h8v3H4z"/></symbol>
+ <symbol id="i-trash" viewBox="0 0 16 16"><path fill="currentColor" d="M5 3V1.5A.5.5 0 015.5 1h5a.5.5 0 01.5.5V3h3v1H2V3h3zm-1 2h8l-1 9.5a1 1 0 01-1 .9H6a1 1 0 01-1-.9z"/></symbol>
+ <symbol id="i-doc" viewBox="0 0 16 16"><path fill="currentColor" d="M3 1h7l3 3v11a1 1 0 01-1 1H3a1 1 0 01-1-1V2a1 1 0 011-1zm7 0v3h3z"/></symbol>
+ <symbol id="i-cpu" viewBox="0 0 16 16"><path fill="currentColor" d="M5 5h6v6H5zM3 6v1H1V6zm0 3v1H1V9zm10-3v1h2V6zm0 3v1h2V9zM6 1h1v2H6zm3 0h1v2H9zM6 13h1v2H6zm3 0h1v2H9z"/></symbol>
+ <symbol id="i-shield" viewBox="0 0 16 16"><path fill="currentColor" d="M8 1l6 2v5c0 4-2.7 6.5-6 7-3.3-.5-6-3-6-7V3z"/></symbol>
+ <symbol id="i-lock" viewBox="0 0 16 16"><path fill="currentColor" d="M5 6V4a3 3 0 016 0v2h1v9H4V6zm2 0h2V4a1 1 0 00-2 0z"/></symbol>
+ <symbol id="i-folder" viewBox="0 0 16 16"><path fill="currentColor" d="M2 3h4l1.5 1.5H14a1 1 0 011 1V12a1 1 0 01-1 1H2a1 1 0 01-1-1V4a1 1 0 011-1z"/></symbol>
+ <symbol id="i-mail" viewBox="0 0 16 16"><path fill="currentColor" d="M2 3h12v10H2zm.5 1.5L8 9l5.5-4.5"/></symbol>
+ <symbol id="i-clock" viewBox="0 0 16 16"><path fill="currentColor" d="M8 1a7 7 0 100 14A7 7 0 008 1zm-.5 3h1v4.3l3 1.7-.5.9L7.5 9z"/></symbol>
+ <symbol id="i-flame" viewBox="0 0 16 16"><path fill="currentColor" d="M8 1c2 3 5 4 5 8a5 5 0 01-10 0c0-2 1-3 2-4 0 2 1 3 2 3-1-3 0-5 1-7z"/></symbol>
+ <symbol id="i-disk" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="currentColor"/><circle cx="8" cy="8" r="2" fill="white"/></symbol>
+ <symbol id="i-bolt" viewBox="0 0 16 16"><path fill="currentColor" d="M9 1L3 9h4l-1 6 6-8H8z"/></symbol>
+ <symbol id="i-search" viewBox="0 0 16 16"><circle cx="7" cy="7" r="5" fill="none" stroke="currentColor" stroke-width="1.5"/><path stroke="currentColor" stroke-width="1.5" stroke-linecap="round" d="M11 11l4 4"/></symbol>
+ <symbol id="i-arrow-up" viewBox="0 0 16 16"><path fill="currentColor" d="M8 2l5 5h-3v7H6V7H3z"/></symbol>
+ <symbol id="i-app-grid" viewBox="0 0 16 16"><rect x="2" y="2" width="4" height="4" rx="1" fill="currentColor"/><rect x="10" y="2" width="4" height="4" rx="1" fill="currentColor"/><rect x="2" y="10" width="4" height="4" rx="1" fill="currentColor"/><rect x="10" y="10" width="4" height="4" rx="1" fill="currentColor"/></symbol>
+ <symbol id="i-globe" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.3"/><path fill="none" stroke="currentColor" stroke-width="1.3" d="M2 8h12M8 2c2 2 2 10 0 12M8 2c-2 2-2 10 0 12"/></symbol>
+ <symbol id="i-sun" viewBox="0 0 16 16"><circle cx="8" cy="8" r="3" fill="currentColor"/><path stroke="currentColor" stroke-width="1.5" stroke-linecap="round" d="M8 1v2M8 13v2M1 8h2M13 8h2M3 3l1.5 1.5M11.5 11.5L13 13M3 13l1.5-1.5M11.5 4.5L13 3"/></symbol>
+ <symbol id="i-moon" viewBox="0 0 16 16"><path fill="currentColor" d="M14 10A6 6 0 016 2a7 7 0 108 8z"/></symbol>
+ <symbol id="i-gear" viewBox="0 0 16 16"><circle cx="8" cy="8" r="2.5" fill="none" stroke="currentColor" stroke-width="1.5"/><path stroke="currentColor" stroke-width="1.5" stroke-linecap="round" d="M8 1v2M8 13v2M1 8h2M13 8h2M3 3l1.5 1.5M11.5 11.5L13 13M3 13l1.5-1.5M11.5 4.5L13 3"/></symbol>
+</svg>
+
+<div class="window">
+ <div class="titlebar">
+ <div class="traffic">
+ <div class="dot red"></div><div class="dot yellow"></div><div class="dot green"></div>
+ </div>
+ <div class="brand">
+ <div class="brand-mark"><svg width="14" height="14"><use href="#i-sparkles"/></svg></div>
+ PureMac
+ </div>
+ <div class="spacer"></div>
+ <div class="theme-toggle" id="themeToggle">
+ <button class="active" data-theme="light"><svg width="14" height="14"><use href="#i-sun"/></svg></button>
+ <button data-theme="dark"><svg width="14" height="14"><use href="#i-moon"/></svg></button>
+ </div>
+ <button class="icon-btn"><svg width="16" height="16"><use href="#i-search"/></svg></button>
+ <button class="icon-btn"><svg width="16" height="16"><use href="#i-gear"/></svg></button>
+ </div>
+
+ <div class="body">
+ <div class="sidebar">
+ <h6>Overview</h6>
+ <div class="nav-row active" data-page="dashboard">
+ <div class="nav-icon"><svg><use href="#i-grid"/></svg></div>
+ <span class="label">Dashboard</span>
+ </div>
+ <div class="nav-row" data-page="smart">
+ <div class="nav-icon"><svg><use href="#i-sparkles"/></svg></div>
+ <span class="label">Smart Scan</span>
+ </div>
+ <div class="nav-row" data-page="lens">
+ <div class="nav-icon"><svg><use href="#i-disk"/></svg></div>
+ <span class="label">Space Lens</span>
+ <span class="badge">new</span>
+ </div>
+
+ <h6>Cleanup</h6>
+ <div class="nav-row" data-page="systemJunk"><div class="nav-icon"><svg><use href="#i-broom"/></svg></div><span class="label">System Junk</span><span class="badge">2.3 GB</span></div>
+ <div class="nav-row" data-page="userCache"><div class="nav-icon"><svg><use href="#i-folder"/></svg></div><span class="label">User Caches</span><span class="badge">1.8 GB</span></div>
+ <div class="nav-row" data-page="mail"><div class="nav-icon"><svg><use href="#i-mail"/></svg></div><span class="label">Mail Attachments</span></div>
+ <div class="nav-row" data-page="trash"><div class="nav-icon"><svg><use href="#i-trash"/></svg></div><span class="label">Trash Bins</span></div>
+ <div class="nav-row" data-page="large"><div class="nav-icon"><svg><use href="#i-doc"/></svg></div><span class="label">Large &amp; Old Files</span></div>
+
+ <h6>Applications</h6>
+ <div class="nav-row" data-page="apps"><div class="nav-icon"><svg><use href="#i-app-grid"/></svg></div><span class="label">Uninstaller</span><span class="badge">142</span></div>
+ <div class="nav-row" data-page="updater"><div class="nav-icon"><svg><use href="#i-arrow-up"/></svg></div><span class="label">Updater</span><span class="badge">7</span></div>
+ <div class="nav-row" data-page="login"><div class="nav-icon"><svg><use href="#i-bolt"/></svg></div><span class="label">Login Items</span></div>
+
+ <h6>Privacy</h6>
+ <div class="nav-row" data-page="privacy"><div class="nav-icon"><svg><use href="#i-shield"/></svg></div><span class="label">Browser Data</span></div>
+ <div class="nav-row" data-page="malware"><div class="nav-icon"><svg><use href="#i-lock"/></svg></div><span class="label">Malware Scan</span></div>
+
+ <h6>Performance</h6>
+ <div class="nav-row" data-page="perf"><div class="nav-icon"><svg><use href="#i-cpu"/></svg></div><span class="label">Free Up RAM</span></div>
+ <div class="nav-row" data-page="maintenance"><div class="nav-icon"><svg><use href="#i-flame"/></svg></div><span class="label">Maintenance</span></div>
+
+ <div class="sidebar-footer">
+ <div class="health">
+ <div class="dot"></div>
+ <div class="meta">
+ <span class="label">System Health</span>
+ <span class="value">Excellent</span>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="detail" id="detail"></div>
+ </div>
+</div>
+
+<script>
+const dashboard = `
+ <div class="page">
+ <div class="toast">
+ <div class="icon-tile"><svg width="16" height="16"><use href="#i-shield"/></svg></div>
+ <div class="body-text">
+ <div class="t">Full Disk Access required</div>
+ <div class="s">macOS blocks PureMac from cleaning caches and uninstalling apps until you grant access.</div>
+ </div>
+ <button>Grant Access</button>
+ </div>
+
+ <div class="hero">
+ <div class="gauge-wrap">
+ <div class="gauge">
+ <svg viewBox="0 0 180 180">
+ <circle class="track" cx="90" cy="90" r="80"/>
+ <circle class="progress" cx="90" cy="90" r="80"/>
+ </svg>
+ <div class="center">
+ <div class="score">82</div>
+ <div class="score-label">Health Score</div>
+ </div>
+ </div>
+ </div>
+ <div class="hero-info">
+ <h1>Looks healthy.</h1>
+ <p class="sub">We found <strong>4.1 GB</strong> of junk you can clear and <strong>7 apps</strong> with available updates.</p>
+ <div class="hero-actions">
+ <button class="btn btn-primary"><svg><use href="#i-sparkles"/></svg>Smart Scan</button>
+ <button class="btn btn-ghost"><svg><use href="#i-bolt"/></svg>Free Up RAM</button>
+ <button class="btn btn-ghost"><svg><use href="#i-trash"/></svg>Empty Trash</button>
+ </div>
+ </div>
+ </div>
+
+ <div class="stats">
+ <div class="stat">
+ <div class="stat-head"><div class="icon-tile tile-blue"><svg><use href="#i-disk"/></svg></div><div class="label">Free Space</div></div>
+ <div class="value">312 GB</div>
+ <div class="delta">of 500 GB · 38% used</div>
+ </div>
+ <div class="stat">
+ <div class="stat-head"><div class="icon-tile tile-orange"><svg><use href="#i-broom"/></svg></div><div class="label">Junk Found</div></div>
+ <div class="value">4.1 GB</div>
+ <div class="delta">across 6 categories</div>
+ </div>
+ <div class="stat">
+ <div class="stat-head"><div class="icon-tile tile-purple"><svg><use href="#i-app-grid"/></svg></div><div class="label">Apps</div></div>
+ <div class="value">142</div>
+ <div class="delta">7 updates available</div>
+ </div>
+ <div class="stat">
+ <div class="stat-head"><div class="icon-tile tile-green"><svg><use href="#i-cpu"/></svg></div><div class="label">Memory</div></div>
+ <div class="value">12.4 GB</div>
+ <div class="delta">free of 32 GB</div>
+ </div>
+ </div>
+
+ <div class="section-head"><h2>Quick Actions</h2></div>
+ <div class="quick-actions">
+ <div class="qa">
+ <div class="icon-tile tile-blue"><svg><use href="#i-bolt"/></svg></div>
+ <div>
+ <div class="qa-title">Free Up RAM</div>
+ <div class="qa-sub">Force unused memory back to the OS</div>
+ </div>
+ </div>
+ <div class="qa">
+ <div class="icon-tile tile-orange"><svg><use href="#i-trash"/></svg></div>
+ <div>
+ <div class="qa-title">Empty Trash</div>
+ <div class="qa-sub">All trashes across volumes</div>
+ </div>
+ </div>
+ <div class="qa">
+ <div class="icon-tile tile-green"><svg><use href="#i-flame"/></svg></div>
+ <div>
+ <div class="qa-title">Run Maintenance</div>
+ <div class="qa-sub">periodic, font cache, Spotlight</div>
+ </div>
+ </div>
+ <div class="qa">
+ <div class="icon-tile tile-purple"><svg><use href="#i-globe"/></svg></div>
+ <div>
+ <div class="qa-title">Flush DNS</div>
+ <div class="qa-sub">Clear name resolution cache</div>
+ </div>
+ </div>
+ </div>
+
+ <div class="section-head"><h2>Suggested for you</h2><span class="link">See all →</span></div>
+ <div class="suggestions">
+ <div class="suggestion">
+ <div class="icon-tile tile-orange"><svg><use href="#i-folder"/></svg></div>
+ <div class="body-text">
+ <div class="t">Slack stored 2.4 GB of cache</div>
+ <div class="s">Last cleared 6 months ago. Safe to remove — Slack will rebuild it.</div>
+ </div>
+ <span class="size-pill">2.4 GB</span>
+ </div>
+ <div class="suggestion">
+ <div class="icon-tile tile-purple"><svg><use href="#i-app-grid"/></svg></div>
+ <div class="body-text">
+ <div class="t">5 apps haven't been opened in 6+ months</div>
+ <div class="s">Adobe Audition, Final Cut Pro, Keynote, Pages, Numbers</div>
+ </div>
+ <span class="size-pill">12.8 GB</span>
+ </div>
+ <div class="suggestion">
+ <div class="icon-tile tile-blue"><svg><use href="#i-clock"/></svg></div>
+ <div class="body-text">
+ <div class="t">DerivedData hasn't been touched in 30 days</div>
+ <div class="s">Xcode will rebuild incrementally on next launch.</div>
+ </div>
+ <span class="size-pill">3.1 GB</span>
+ </div>
+ </div>
+ </div>
+`;
+
+const smart = `
+ <div class="page">
+ <div class="page-header">
+ <h1>Smart Scan</h1>
+ <p>One pass that finds junk, leftovers, and large files in every category.</p>
+ </div>
+ <div class="hero">
+ <div class="gauge-wrap">
+ <div class="gauge">
+ <svg viewBox="0 0 180 180">
+ <circle class="track" cx="90" cy="90" r="80"/>
+ <circle class="progress scanning" cx="90" cy="90" r="80" style="stroke-dashoffset: 240"/>
+ </svg>
+ <div class="center">
+ <div class="score" style="font-size:28px">2.4 GB</div>
+ <div class="score-label">scanning…</div>
+ </div>
+ </div>
+ </div>
+ <div class="hero-info">
+ <h1>Scanning your Mac</h1>
+ <p class="sub">Currently in: <strong>User Caches</strong> · 12 of 24 categories</p>
+ <div class="hero-actions">
+ <button class="btn btn-ghost">Pause</button>
+ <button class="btn btn-ghost">Cancel</button>
+ </div>
+ </div>
+ </div>
+ <div class="section-head"><h2>What we'll check</h2></div>
+ <div class="quick-actions">
+ ${[
+ ['i-broom','System Junk','/Library/Caches, logs'],
+ ['i-folder','User Caches','~/Library/Caches'],
+ ['i-mail','Mail Attachments','Cached Mail downloads'],
+ ['i-trash','Trash','User and per-volume'],
+ ['i-doc','Large & Old','Files over 100 MB'],
+ ['i-cpu','Xcode','DerivedData, archives'],
+ ['i-globe','Browser Data','Caches, history'],
+ ['i-bolt','Login Items','LaunchAgents/Daemons'],
+ ].map(([icon, t, s]) => `
+ <div class="qa">
+ <div class="icon-tile tile-blue"><svg><use href="#${icon}"/></svg></div>
+ <div>
+ <div class="qa-title">${t}</div>
+ <div class="qa-sub">${s}</div>
+ </div>
+ </div>`).join('')}
+ </div>
+ </div>
+`;
+
+const lens = `
+ <div class="page">
+ <div class="page-header">
+ <h1>Space Lens</h1>
+ <p>Visual map of every byte on your disk. Click any tile to drill down.</p>
+ </div>
+ <div style="background: var(--bg-elev); border:0.5px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-md);">
+ <div style="display:grid; grid-template-columns: 2fr 1fr; gap: 8px; height: 380px;">
+ <div style="display:grid; grid-template-rows: 2fr 1fr; gap: 8px;">
+ <div style="background: linear-gradient(135deg, rgba(10,132,255,0.6), rgba(10,132,255,0.3)); border-radius: 10px; padding: 14px; color: white; display:flex; flex-direction: column; justify-content:flex-end;">
+ <div style="font-weight:700">Applications</div>
+ <div style="opacity:0.85; font-size: 12px">82 GB · 26%</div>
+ </div>
+ <div style="display:grid; grid-template-columns: 1fr 1fr; gap: 8px;">
+ <div style="background: linear-gradient(135deg, rgba(48,199,121,0.6), rgba(48,199,121,0.3)); border-radius: 10px; padding: 12px; color: white;">
+ <div style="font-weight:700">Photos</div><div style="opacity:0.85; font-size: 12px">42 GB</div>
+ </div>
+ <div style="background: linear-gradient(135deg, rgba(175,82,222,0.6), rgba(175,82,222,0.3)); border-radius: 10px; padding: 12px; color: white;">
+ <div style="font-weight:700">Music</div><div style="opacity:0.85; font-size: 12px">28 GB</div>
+ </div>
+ </div>
+ </div>
+ <div style="display: flex; flex-direction: column; gap: 8px;">
+ <div style="background: linear-gradient(135deg, rgba(255,159,10,0.6), rgba(255,159,10,0.3)); flex: 2; border-radius: 10px; padding: 12px; color: white; display:flex; flex-direction: column; justify-content:flex-end;">
+ <div style="font-weight:700">System</div><div style="opacity:0.85; font-size: 12px">38 GB · 12%</div>
+ </div>
+ <div style="background: linear-gradient(135deg, rgba(255,69,58,0.6), rgba(255,69,58,0.3)); flex: 1.4; border-radius: 10px; padding: 12px; color: white; display:flex; flex-direction: column; justify-content:flex-end;">
+ <div style="font-weight:700">Caches</div><div style="opacity:0.85; font-size: 12px">22 GB</div>
+ </div>
+ <div style="background: rgba(120,120,128,0.4); flex: 1; border-radius: 10px; padding: 12px; color: white; display:flex; flex-direction: column; justify-content:flex-end;">
+ <div style="font-weight:700">Other</div><div style="opacity:0.85; font-size: 12px">16 GB</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+`;
+
+const generic = (title, sub, items) => `
+ <div class="page">
+ <div class="page-header">
+ <h1>${title}</h1>
+ <p>${sub}</p>
+ </div>
+ <div class="list-card">
+ ${items.map(([name, meta, size, on]) => `
+ <div class="list-row">
+ <div class="check ${on ? 'on' : ''}"></div>
+ <div class="name">${name}</div>
+ <div class="meta">${meta}</div>
+ <div class="size">${size}</div>
+ </div>
+ `).join('')}
+ </div>
+ </div>
+`;
+
+const pages = {
+ dashboard,
+ smart,
+ lens,
+ systemJunk: generic("System Junk", "Caches, logs and temp files. Some require admin rights to delete.", [
+ ["/Library/Caches/com.apple.bird", "Apr 12", "412 MB", true],
+ ["/Library/Logs/CrashReporter", "Apr 14", "184 MB", true],
+ ["/private/var/log/system.log.0.gz", "Apr 28", "92 MB", true],
+ ["/private/var/log/wifi.log", "Apr 29", "44 MB", false],
+ ]),
+ userCache: generic("User Caches", "Cached data your apps regenerate as needed.", [
+ ["com.apple.dt.Xcode", "Apr 28", "1.2 GB", true],
+ ["com.spotify.client", "Apr 29", "412 MB", true],
+ ["com.tinyspeck.slackmacgap", "Apr 28", "2.4 GB", true],
+ ["com.figma.Desktop", "Apr 28", "180 MB", true],
+ ]),
+ mail: generic("Mail Attachments", "Files Mail.app downloaded for messages.", []),
+ trash: generic("Trash Bins", "Files in user and per-volume trashes.", []),
+ large: generic("Large & Old Files", "Files over 100 MB or older than 1 year.", [
+ ["WWDC2025_Keynote.mp4", "~/Downloads · Jun 2025", "1.8 GB", false],
+ ["Untitled.sketch", "~/Documents · Jan 2024", "412 MB", false],
+ ["backup_oct.zip", "~/Desktop · Oct 2024", "3.2 GB", false],
+ ]),
+ apps: generic("Uninstaller", "Apps installed on this Mac with leftover detection.", [
+ ["Xcode", "1d ago", "16.8 GB", false],
+ ["Adobe Audition", "8mo ago", "3.4 GB", false],
+ ["Slack", "today", "412 MB", false],
+ ["Final Cut Pro", "1y ago", "4.1 GB", false],
+ ]),
+ updater: generic("Updater", "App updates available.", [
+ ["Visual Studio Code", "1.95 → 1.97", "—", true],
+ ["Slack", "4.40 → 4.42", "—", true],
+ ["Docker Desktop", "4.34 → 4.38", "—", true],
+ ]),
+ login: generic("Login Items", "LaunchAgents and LaunchDaemons that run at login.", [
+ ["com.adobe.acc.installer.v2", "—", "active", false],
+ ["com.docker.helper", "—", "active", true],
+ ["com.microsoft.update.agent", "—", "active", false],
+ ]),
+ privacy: generic("Browser Data", "History, cookies and caches across browsers.", [
+ ["Safari · history.db", "—", "84 MB", false],
+ ["Chrome · cache", "—", "612 MB", true],
+ ["Arc · cookies", "—", "12 MB", false],
+ ]),
+ malware: generic("Malware Scan", "Match running launchd entries against Objective-See's signatures.", []),
+ perf: generic("Free Up RAM", "Force inactive memory back to the OS.", []),
+ maintenance: generic("Maintenance", "Periodic scripts, cache rebuilds, font cache.", []),
+};
+
+const detail = document.getElementById('detail');
+function show(key){ detail.innerHTML = pages[key] || pages.dashboard; }
+document.querySelectorAll('.nav-row').forEach(row => {
+ row.addEventListener('click', () => {
+ document.querySelectorAll('.nav-row').forEach(r => r.classList.remove('active'));
+ row.classList.add('active');
+ show(row.dataset.page);
+ });
+});
+show('dashboard');
+
+// Theme toggle
+const root = document.documentElement;
+document.querySelectorAll('#themeToggle button').forEach(b => {
+ b.addEventListener('click', () => {
+ document.querySelectorAll('#themeToggle button').forEach(x => x.classList.remove('active'));
+ b.classList.add('active');
+ root.setAttribute('data-theme', b.dataset.theme);
+ });
+});
+// Default to dark on first load to show off the polish
+(function(){
+ document.querySelectorAll('#themeToggle button').forEach(x => x.classList.remove('active'));
+ document.querySelector('#themeToggle button[data-theme="dark"]').classList.add('active');
+ root.setAttribute('data-theme', 'dark');
+})();
+</script>
+</body>
+</html>
diff --git a/docs/ui-prototype/old.html b/docs/ui-prototype/old.html
new file mode 100644
index 0000000..edfe80f
--- /dev/null
+++ b/docs/ui-prototype/old.html
@@ -0,0 +1,274 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<title>PureMac — Current UI (faithful prototype)</title>
+<style>
+ * { box-sizing: border-box; margin: 0; padding: 0; }
+ html, body {
+ height: 100%;
+ font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
+ font-size: 13px;
+ color: #1d1d1f;
+ background: #ececec;
+ user-select: none;
+ -webkit-font-smoothing: antialiased;
+ }
+ .window {
+ width: 100vw; height: 100vh;
+ display: flex; flex-direction: column;
+ background: #f5f5f7;
+ border-radius: 0;
+ overflow: hidden;
+ }
+ .titlebar {
+ height: 38px; flex-shrink: 0;
+ display: flex; align-items: center;
+ padding: 0 12px;
+ background: linear-gradient(#e8e8ea, #d8d8da);
+ border-bottom: 1px solid #c8c8cc;
+ }
+ .traffic { display: flex; gap: 8px; align-items: center; }
+ .traffic .dot { width: 12px; height: 12px; border-radius: 50%; border: 0.5px solid rgba(0,0,0,0.15); }
+ .traffic .red { background: #ff5f57; }
+ .traffic .yellow { background: #febc2e; }
+ .traffic .green { background: #28c840; }
+ .titlebar .title { flex: 1; text-align: center; font-weight: 600; font-size: 13px; color: #3a3a3c; }
+ .body { flex: 1; display: flex; min-height: 0; }
+
+ .sidebar {
+ width: 250px; flex-shrink: 0;
+ background: #ebebeb;
+ border-right: 1px solid #d0d0d4;
+ overflow-y: auto;
+ padding: 8px 0;
+ }
+ .sidebar h6 {
+ font-size: 11px; font-weight: 600;
+ text-transform: uppercase;
+ color: #86868b;
+ padding: 8px 16px 4px;
+ letter-spacing: 0.3px;
+ }
+ .nav-row {
+ display: flex; align-items: center;
+ padding: 5px 16px;
+ margin: 0 8px;
+ border-radius: 6px;
+ cursor: pointer;
+ font-size: 13px;
+ color: #1d1d1f;
+ gap: 8px;
+ }
+ .nav-row:hover { background: rgba(0,0,0,0.04); }
+ .nav-row.active { background: #007aff; color: white; }
+ .nav-row.active .badge { color: rgba(255,255,255,0.85); }
+ .nav-row .icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
+ .nav-row .label { flex: 1; }
+ .nav-row .badge { font-size: 11px; color: #86868b; }
+
+ .detail {
+ flex: 1; display: flex; flex-direction: column;
+ background: #ffffff;
+ overflow-y: auto;
+ }
+ .fda-banner {
+ background: #ff9500;
+ color: white;
+ padding: 10px 14px;
+ display: flex; align-items: center; gap: 10px;
+ font-size: 12px;
+ }
+ .fda-banner .title { font-weight: 600; }
+ .fda-banner .grant {
+ margin-left: auto;
+ background: white; color: #ff9500;
+ border: 0; padding: 5px 12px;
+ border-radius: 6px; font-weight: 600; font-size: 12px;
+ cursor: pointer;
+ }
+ .fda-banner .dismiss {
+ background: transparent; color: rgba(255,255,255,0.85);
+ border: 0; cursor: pointer;
+ font-size: 13px;
+ }
+ .detail-inner { flex: 1; padding: 24px 32px; }
+
+ /* Smart Scan landing */
+ .scan-hero { text-align: center; padding: 40px 20px; }
+ .scan-hero .ring {
+ width: 180px; height: 180px;
+ margin: 0 auto 20px;
+ border-radius: 50%;
+ border: 12px solid #d2d2d7;
+ display: flex; align-items: center; justify-content: center;
+ flex-direction: column;
+ }
+ .scan-hero .ring .number { font-size: 32px; font-weight: 600; color: #1d1d1f; }
+ .scan-hero .ring .label { font-size: 11px; color: #86868b; margin-top: 4px; }
+ .scan-hero h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
+ .scan-hero p { color: #86868b; font-size: 13px; margin-bottom: 24px; }
+ .btn-primary {
+ background: #007aff; color: white;
+ border: 0; padding: 8px 22px;
+ border-radius: 6px; font-weight: 600; font-size: 13px;
+ cursor: pointer;
+ }
+ .btn-primary:hover { background: #006ae0; }
+ .btn-secondary {
+ background: #fff; color: #1d1d1f;
+ border: 0.5px solid #c8c8cc;
+ padding: 7px 18px; border-radius: 6px;
+ font-size: 13px; cursor: pointer;
+ }
+
+ /* Generic detail page */
+ .page-title { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
+ .page-sub { color: #86868b; margin-bottom: 24px; font-size: 13px; }
+
+ .item-list { border: 0.5px solid #d2d2d7; border-radius: 6px; overflow: hidden; }
+ .item-row {
+ display: flex; align-items: center;
+ padding: 8px 14px;
+ border-bottom: 0.5px solid #e5e5e7;
+ font-size: 13px;
+ gap: 10px;
+ }
+ .item-row:last-child { border-bottom: 0; }
+ .item-row input[type="checkbox"] { width: 14px; height: 14px; }
+ .item-row .name { flex: 1; }
+ .item-row .size { color: #86868b; font-variant-numeric: tabular-nums; }
+
+ .actionbar {
+ display: flex; gap: 8px; padding: 16px 0 0;
+ border-top: 0.5px solid #e5e5e7; margin-top: 16px;
+ align-items: center;
+ }
+ .actionbar .spacer { flex: 1; }
+ .danger { background: #ff3b30; color: white; }
+ .danger:hover { background: #db3025; }
+
+ .empty { text-align: center; padding: 60px 20px; color: #86868b; }
+ .empty .icon-large { font-size: 38px; margin-bottom: 12px; }
+
+ /* Light SF-symbol style icons (drawn with unicode boxes for fidelity) */
+ .glyph {
+ display: inline-flex; align-items: center; justify-content: center;
+ width: 16px; height: 16px;
+ color: currentColor;
+ }
+</style>
+</head>
+<body>
+<div class="window">
+ <div class="titlebar">
+ <div class="traffic">
+ <div class="dot red"></div>
+ <div class="dot yellow"></div>
+ <div class="dot green"></div>
+ </div>
+ <div class="title">PureMac</div>
+ <div style="width: 50px"></div>
+ </div>
+
+ <div class="body">
+ <div class="sidebar">
+ <h6>Home</h6>
+ <div class="nav-row active" data-page="smart">
+ <svg class="icon" viewBox="0 0 16 16" fill="currentColor"><path d="M8 1l1.7 4.3L14 6l-3.4 2.5.8 4.5L8 11l-3.4 2 .8-4.5L2 6l4.3-.7z"/></svg>
+ <span class="label">Smart Scan</span>
+ </div>
+
+ <h6>Applications</h6>
+ <div class="nav-row" data-page="apps">
+ <svg class="icon" viewBox="0 0 16 16" fill="currentColor"><rect x="1" y="1" width="6" height="6" rx="1"/><rect x="9" y="1" width="6" height="6" rx="1"/><rect x="1" y="9" width="6" height="6" rx="1"/><rect x="9" y="9" width="6" height="6" rx="1"/></svg>
+ <span class="label">Installed Apps</span>
+ <span class="badge">142</span>
+ </div>
+ <div class="nav-row" data-page="orphans">
+ <svg class="icon" viewBox="0 0 16 16" fill="currentColor"><path d="M8 14a6 6 0 110-12 6 6 0 010 12zm0-2a4 4 0 100-8 4 4 0 000 8zm-.5-7h1v3h-1V5zm0 4h1v1h-1V9z"/></svg>
+ <span class="label">Orphaned Files</span>
+ </div>
+
+ <h6>Cleaning</h6>
+ <div class="nav-row" data-page="systemJunk"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><path d="M3 3h10v2H3zm1 3h8v8H4z"/></svg><span class="label">System Junk</span><span class="badge">—</span></div>
+ <div class="nav-row" data-page="userCache"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><path d="M2 4h12v9H2z" fill="none" stroke="currentColor"/><path d="M2 4h12v3H2z"/></svg><span class="label">User Cache</span><span class="badge">—</span></div>
+ <div class="nav-row" data-page="mail"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><path d="M2 3h12v10H2zm1 1l5 4 5-4"/></svg><span class="label">Mail Attachments</span></div>
+ <div class="nav-row" data-page="trash"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><path d="M5 3V2h6v1h3v1H2V3h3zm-1 2h8l-1 9H5z"/></svg><span class="label">Trash Bins</span></div>
+ <div class="nav-row" data-page="large"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><path d="M3 1h7l3 3v11H3z"/></svg><span class="label">Large &amp; Old Files</span></div>
+ <div class="nav-row" data-page="purgeable"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M8 4v4l3 2"/></svg><span class="label">Purgeable Space</span></div>
+ <div class="nav-row" data-page="xcode"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><path d="M2 3h12v10H2zm2 2h8v6H4z" fill="none" stroke="currentColor" stroke-width="1"/></svg><span class="label">Xcode Junk</span></div>
+ <div class="nav-row" data-page="brew"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><path d="M5 2h6v3H5zm-1 3h8v9H4z"/></svg><span class="label">Homebrew Cache</span></div>
+ <div class="nav-row" data-page="node"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor"/></svg><span class="label">Node Cache</span></div>
+ <div class="nav-row" data-page="docker"><svg class="icon" viewBox="0 0 16 16" fill="currentColor"><rect x="2" y="6" width="12" height="6"/></svg><span class="label">Docker Cache</span></div>
+ </div>
+
+ <div class="detail">
+ <div class="fda-banner">
+ <span>⚠</span>
+ <div>
+ <div class="title">Full Disk Access required</div>
+ <div>macOS blocks PureMac from cleaning caches and uninstalling apps until you grant access.</div>
+ </div>
+ <button class="grant">Grant Access</button>
+ <button class="dismiss">✕</button>
+ </div>
+
+ <div class="detail-inner" id="content">
+ <!-- populated by JS -->
+ </div>
+ </div>
+ </div>
+</div>
+
+<script>
+ const pages = {
+ smart: `
+ <div class="scan-hero">
+ <div class="ring"><div class="number">0 B</div><div class="label">junk found</div></div>
+ <h1>Run a Smart Scan</h1>
+ <p>Scan your Mac for caches, logs, leftover files and large media.</p>
+ <button class="btn-primary">Scan</button>
+ </div>`,
+ apps: `
+ <div class="page-title">Installed Apps</div>
+ <div class="page-sub">142 apps · click an app to uninstall</div>
+ <div class="item-list">
+ ${['Xcode','Slack','Visual Studio Code','Docker Desktop','Figma','Spotify','Discord','Notion','Arc','Chrome'].map(a=>`<div class="item-row"><span class="name">${a}</span><span class="size">— MB</span></div>`).join('')}
+ </div>`,
+ orphans: `
+ <div class="page-title">Orphaned Files</div>
+ <div class="page-sub">Leftover files from apps you've uninstalled.</div>
+ <div class="empty"><div class="icon-large">🔍</div>No orphaned files found.<br><small>Run a scan to look for leftovers.</small></div>`,
+ systemJunk: page("System Junk", "Caches, logs and temp files in /Library and /var.", []),
+ userCache: page("User Cache", "Cached data from your apps in ~/Library/Caches.", []),
+ mail: page("Mail Attachments", "Cached attachments downloaded by Mail.app.", []),
+ trash: page("Trash Bins", "Files in your user and per-volume trashes.", []),
+ large: page("Large &amp; Old Files", "Files over 100 MB or older than 1 year.", []),
+ purgeable: page("Purgeable Space", "APFS purgeable space and Time Machine snapshots.", []),
+ xcode: page("Xcode Junk", "DerivedData, archives, simulator caches.", []),
+ brew: page("Homebrew Cache", "Cached download artifacts from brew.", []),
+ node: page("Node Cache", "npm, yarn, pnpm, pip download caches.", []),
+ docker: page("Docker Cache", "Unused Docker images, layers and containers.", []),
+ };
+
+ function page(title, sub, items) {
+ return `
+ <div class="page-title">${title}</div>
+ <div class="page-sub">${sub}</div>
+ <div class="empty"><div class="icon-large">📂</div>Nothing scanned yet.<br><small>Click Smart Scan to populate.</small></div>`;
+ }
+
+ const content = document.getElementById('content');
+ document.querySelectorAll('.nav-row').forEach(row => {
+ row.addEventListener('click', () => {
+ document.querySelectorAll('.nav-row').forEach(r => r.classList.remove('active'));
+ row.classList.add('active');
+ content.innerHTML = pages[row.dataset.page] || '';
+ });
+ });
+ // initial
+ content.innerHTML = pages.smart;
+</script>
+</body>
+</html>