11import { useState , useCallback } from "react" ;
22import { useScan } from "./hooks/useScan" ;
33import { useClean } from "./hooks/useClean" ;
4+ import { useVersion } from "./hooks/useVersion" ;
45import { ProgressBar } from "./components/ProgressBar" ;
56import { ScanView } from "./components/ScanView" ;
67import { Settings } from "./components/Settings" ;
78import { MapView } from "./components/MapView" ;
9+ import { TrashView } from "./components/TrashView" ;
10+ import { ScheduleView } from "./components/ScheduleView" ;
811import { useI18n } from "./i18n" ;
912import type { ScanConfig } from "./types" ;
1013import { formatSize } from "./utils" ;
1114
1215type ScanSpeed = "quick" | "normal" | "thorough" ;
13- type Tab = "scan" | "map" ;
16+ type Tab = "scan" | "map" | "trash" | "schedule" ;
1417
1518// Default scan settings
1619const DEFAULT_MIN_FILE_SIZE_MB = 100 ;
@@ -26,6 +29,7 @@ function App() {
2629
2730 const { results, isScanning, progress : scanProgress , error : scanError , scan, clearResults } = useScan ( ) ;
2831 const { isCleaning, progress : cleanProgress , result : cleanResult , error : cleanError , cleanItems, clearResult } = useClean ( ) ;
32+ const { versionInfo } = useVersion ( ) ;
2933
3034 const handleScan = async ( ) => {
3135 setSelectedPaths ( new Set ( ) ) ;
@@ -116,33 +120,55 @@ function App() {
116120 </ div >
117121 </ div >
118122
119- < button
120- onClick = { ( ) => setShowSettings ( true ) }
121- className = "p-2.5 hover:bg-[var(--bg-secondary)] rounded-xl transition-colors"
122- title = { t ( "settings" ) }
123- aria-label = { t ( "settings" ) }
124- >
125- < svg
126- className = "w-5 h-5 text-secondary"
127- fill = "none"
128- stroke = "currentColor"
129- viewBox = "0 0 24 24"
130- aria-hidden = "true"
123+ < div className = "flex items-center gap-3" >
124+ { /* Version indicator */ }
125+ { versionInfo && (
126+ < div className = "flex items-center gap-2 text-xs" >
127+ < span className = "text-muted" > v{ versionInfo . current } </ span >
128+ { versionInfo . update_available && versionInfo . release_url && (
129+ < a
130+ href = { versionInfo . release_url }
131+ target = "_blank"
132+ rel = "noopener noreferrer"
133+ className = "flex items-center gap-1 px-2 py-1 rounded-full bg-[var(--orange-primary)]/10 text-[var(--orange-primary)] hover:bg-[var(--orange-primary)]/20 transition-colors"
134+ >
135+ < svg className = "w-3 h-3" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
136+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
137+ </ svg >
138+ v{ versionInfo . latest }
139+ </ a >
140+ ) }
141+ </ div >
142+ ) }
143+
144+ < button
145+ onClick = { ( ) => setShowSettings ( true ) }
146+ className = "p-2.5 hover:bg-[var(--bg-secondary)] rounded-xl transition-colors"
147+ title = { t ( "settings" ) }
148+ aria-label = { t ( "settings" ) }
131149 >
132- < path
133- strokeLinecap = "round"
134- strokeLinejoin = "round"
135- strokeWidth = { 2 }
136- d = "M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
137- />
138- < path
139- strokeLinecap = "round"
140- strokeLinejoin = "round"
141- strokeWidth = { 2 }
142- d = "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
143- />
144- </ svg >
145- </ button >
150+ < svg
151+ className = "w-5 h-5 text-secondary"
152+ fill = "none"
153+ stroke = "currentColor"
154+ viewBox = "0 0 24 24"
155+ aria-hidden = "true"
156+ >
157+ < path
158+ strokeLinecap = "round"
159+ strokeLinejoin = "round"
160+ strokeWidth = { 2 }
161+ d = "M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
162+ />
163+ < path
164+ strokeLinecap = "round"
165+ strokeLinejoin = "round"
166+ strokeWidth = { 2 }
167+ d = "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
168+ />
169+ </ svg >
170+ </ button >
171+ </ div >
146172 </ header >
147173
148174 { /* Tab navigation */ }
@@ -173,6 +199,32 @@ function App() {
173199 { t ( "mapTab" ) }
174200 </ span >
175201 </ button >
202+ < button
203+ onClick = { ( ) => setActiveTab ( "trash" ) }
204+ className = { `tab-button ${ activeTab === "trash" ? "active" : "" } ` }
205+ aria-selected = { activeTab === "trash" }
206+ role = "tab"
207+ >
208+ < span className = "flex items-center gap-2" >
209+ < svg className = "w-4 h-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" aria-hidden = "true" >
210+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
211+ </ svg >
212+ { t ( "trashTab" ) }
213+ </ span >
214+ </ button >
215+ < button
216+ onClick = { ( ) => setActiveTab ( "schedule" ) }
217+ className = { `tab-button ${ activeTab === "schedule" ? "active" : "" } ` }
218+ aria-selected = { activeTab === "schedule" }
219+ role = "tab"
220+ >
221+ < span className = "flex items-center gap-2" >
222+ < svg className = "w-4 h-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" aria-hidden = "true" >
223+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
224+ </ svg >
225+ { t ( "scheduleTab" ) }
226+ </ span >
227+ </ button >
176228 </ div >
177229
178230 { /* Main content */ }
@@ -319,10 +371,18 @@ function App() {
319371 ) }
320372 </ div >
321373 </ >
322- ) : (
374+ ) : activeTab === "map" ? (
323375 < div className = "flex-1 overflow-hidden" >
324376 < MapView />
325377 </ div >
378+ ) : activeTab === "trash" ? (
379+ < div className = "flex-1 overflow-hidden" >
380+ < TrashView />
381+ </ div >
382+ ) : (
383+ < div className = "flex-1 overflow-hidden" >
384+ < ScheduleView />
385+ </ div >
326386 ) }
327387
328388 { /* Settings modal */ }
0 commit comments