1
- import { AlertCircle , Download , Folder } from "lucide-react" ;
1
+ import { AlertCircle , Book , Download , Folder , Github , Settings } from "lucide-react" ;
2
2
import { useEffect , useState } from "react" ;
3
3
import Button from "@/components/ui/button" ;
4
+ import SettingsDialog from "@/settings/components/settings-dialog" ;
4
5
import { useUpdater } from "@/settings/hooks/use-updater" ;
6
+ import { useUIState } from "@/stores/ui-state-store" ;
5
7
import { fetchRawAppVersion } from "@/utils/app-utils" ;
6
8
7
- // ...existing code...
8
-
9
9
interface RecentFolder {
10
10
name : string ;
11
11
path : string ;
@@ -24,6 +24,10 @@ const WelcomeScreen = ({
24
24
onOpenRecentFolder,
25
25
} : WelcomeScreenProps ) => {
26
26
const [ appVersion , setAppVersion ] = useState < string > ( "..." ) ;
27
+ const { openSettingsDialog, isSettingsDialogVisible, setIsSettingsDialogVisible } = useUIState ( ) ;
28
+
29
+ // Hide updater in development environment
30
+ const isDevelopment = import . meta. env . MODE === "development" ;
27
31
const {
28
32
available,
29
33
checking,
@@ -33,7 +37,7 @@ const WelcomeScreen = ({
33
37
updateInfo,
34
38
downloadAndInstall,
35
39
dismissUpdate,
36
- } = useUpdater ( true ) ;
40
+ } = useUpdater ( ! isDevelopment ) ;
37
41
38
42
useEffect ( ( ) => {
39
43
const loadVersion = async ( ) => {
@@ -52,6 +56,10 @@ const WelcomeScreen = ({
52
56
}
53
57
} ;
54
58
59
+ const openExternalLink = ( url : string ) => {
60
+ window . open ( url , "_blank" , "noopener,noreferrer" ) ;
61
+ } ;
62
+
55
63
return (
56
64
< div
57
65
data-tauri-drag-region
@@ -63,14 +71,14 @@ const WelcomeScreen = ({
63
71
< img src = "/logo.svg" alt = "athas industries" className = "h-12" draggable = "false" />
64
72
</ div >
65
73
< div className = "flex items-center gap-2 text-text-lighter" >
66
- < p className = "font-mono font-normal text-xs" > v{ appVersion } </ p >
67
- { checking && (
68
- < div className = "text-xs" title = "Checking for updates ..." >
74
+ < p className = "font-mono text-xs" > v{ appVersion } </ p >
75
+ { ! isDevelopment && checking && (
76
+ < div className = "animate-spin text-xs" title = "Checking..." >
69
77
⟳
70
78
</ div >
71
79
) }
72
- { available && (
73
- < div className = "text-accent text-xs" title = { `Update available : ${ updateInfo ?. version } ` } >
80
+ { ! isDevelopment && available && (
81
+ < div className = "text-accent text-xs" title = { `Update: ${ updateInfo ?. version } ` } >
74
82
•
75
83
</ div >
76
84
) }
@@ -80,28 +88,30 @@ const WelcomeScreen = ({
80
88
{ /* Main Content */ }
81
89
< div className = "flex w-full max-w-sm flex-col items-center px-4" >
82
90
{ /* Update Available Banner */ }
83
- { available && (
91
+ { ! isDevelopment && available && (
84
92
< div className = "mb-4 w-full" >
85
- < div className = "rounded-md border border-border p-3 text-text " >
93
+ < div className = "rounded-md border border-border p-3" >
86
94
< div className = "mb-2 flex items-center gap-2" >
87
95
< Download size = { 14 } className = "text-accent" />
88
- < span className = "font-mono text-xs" > Update Available</ span >
96
+ < span className = "font-mono text-text text- xs" > Update Available</ span >
89
97
</ div >
90
- < p className = "mb-3 font-mono text-xs" >
91
- Version { updateInfo ?. version } is ready to install
92
- </ p >
98
+ < p className = "mb-3 font-mono text-text-light text-xs" > v{ updateInfo ?. version } ready</ p >
93
99
< div className = "flex gap-2" >
94
100
< Button
95
101
onClick = { downloadAndInstall }
96
102
disabled = { downloading || installing }
97
103
variant = "ghost"
98
- className = "flex-1 gap-2 bg-secondary-bg py-1 text-xs transition-all duration-200 "
104
+ className = "flex-1 gap-1 bg-secondary-bg py-1 text-xs"
99
105
size = "sm"
100
106
>
101
107
{ downloading ? (
102
- "⟳ Downloading"
108
+ < >
109
+ < div className = "animate-spin" > ⟳</ div > Download
110
+ </ >
103
111
) : installing ? (
104
- "⟳ Installing"
112
+ < >
113
+ < div className = "animate-spin" > ⟳</ div > Install
114
+ </ >
105
115
) : (
106
116
< >
107
117
< Download size = { 12 } />
@@ -112,7 +122,7 @@ const WelcomeScreen = ({
112
122
< Button
113
123
onClick = { dismissUpdate }
114
124
variant = "ghost"
115
- className = "bg-secondary-bg px-2 py-1 text-xs transition-all duration-200 "
125
+ className = "bg-secondary-bg px-2 py-1 text-xs"
116
126
size = "sm"
117
127
>
118
128
Later
@@ -123,10 +133,10 @@ const WelcomeScreen = ({
123
133
) }
124
134
125
135
{ /* Error Banner */ }
126
- { error && (
136
+ { ! isDevelopment && error && (
127
137
< div className = "mb-4 w-full" >
128
138
< div className = "rounded-md border border-error p-3" >
129
- < div className = "flex items-center gap-2 " >
139
+ < div className = "flex items-center gap-2" >
130
140
< AlertCircle size = { 14 } className = "text-error" />
131
141
< span className = "font-mono text-text text-xs" > Update Error</ span >
132
142
</ div >
@@ -140,29 +150,31 @@ const WelcomeScreen = ({
140
150
< Button
141
151
onClick = { onOpenFolder }
142
152
variant = "ghost"
143
- className = "flex gap-2 border border-border bg-secondary-bg p -4 text-sm transition-all duration-200 "
153
+ className = "flex gap-2 border border-border bg-secondary-bg px -4 py-3 text-xs "
144
154
size = "sm"
145
155
>
146
- < Folder size = { 16 } />
156
+ < Folder size = { 14 } />
147
157
Open Folder
148
158
</ Button >
149
159
</ div >
150
160
151
161
{ /* Recent Folders */ }
152
162
{ recentFolders . length > 0 && (
153
163
< div className = "w-full" >
154
- < h3 className = "mb-2 font-mono text-text text-xs" > Recent({ recentFolders . length } )</ h3 >
164
+ < h3 className = "mb-2 font-mono text-text text-xs" > Recent ({ recentFolders . length } )</ h3 >
155
165
< div className = "space-y-1.5" >
156
166
{ recentFolders . map ( ( folder , index ) => (
157
167
< Button
158
168
key = { index }
159
169
onClick = { ( ) => handleRecentFolderClick ( folder . path ) }
160
170
variant = "ghost"
161
- className = "flex h-auto w-full flex-col justify-start gap-2 border border-border bg-secondary-bg p-2 transition-all duration-200 "
171
+ className = "flex h-auto w-full flex-col justify-start gap-1.5 border border-border bg-secondary-bg p-2"
162
172
size = "sm"
163
173
>
164
- < div className = "w-full truncate text-start font-mono text-sm" > { folder . name } </ div >
165
- < div className = "w-full text-start" >
174
+ < div className = "w-full truncate text-left font-mono text-text text-xs" >
175
+ { folder . name }
176
+ </ div >
177
+ < div className = "w-full text-left" >
166
178
< p className = "font-mono text-text-lighter text-xs" >
167
179
{ folder . path . startsWith ( "/Users/" )
168
180
? `~${ folder . path . substring ( folder . path . indexOf ( "/" , 7 ) ) } `
@@ -174,7 +186,50 @@ const WelcomeScreen = ({
174
186
</ div >
175
187
</ div >
176
188
) }
189
+
190
+ { /* Quick Links */ }
191
+ < div className = "mt-6 flex w-full justify-center gap-4" >
192
+ < button
193
+ onClick = { ( ) => openSettingsDialog ( ) }
194
+ className = "flex items-center gap-1 text-text-lighter transition-colors hover:text-text"
195
+ >
196
+ < Settings size = { 14 } />
197
+ < span className = "text-xs" > Settings</ span >
198
+ </ button >
199
+ < a
200
+ href = "https://docs.athas.dev"
201
+ target = "_blank"
202
+ rel = "noopener noreferrer"
203
+ onClick = { ( e ) => {
204
+ e . preventDefault ( ) ;
205
+ openExternalLink ( "https://docs.athas.dev" ) ;
206
+ } }
207
+ className = "flex items-center gap-1 text-text-lighter transition-colors hover:text-text"
208
+ >
209
+ < Book size = { 14 } />
210
+ < span className = "text-xs" > Docs</ span >
211
+ </ a >
212
+ < a
213
+ href = "https://github.com/athasdev/athas"
214
+ target = "_blank"
215
+ rel = "noopener noreferrer"
216
+ onClick = { ( e ) => {
217
+ e . preventDefault ( ) ;
218
+ openExternalLink ( "https://github.com/athasdev/athas" ) ;
219
+ } }
220
+ className = "flex items-center gap-1 text-text-lighter transition-colors hover:text-text"
221
+ >
222
+ < Github size = { 14 } />
223
+ < span className = "text-xs" > GitHub</ span >
224
+ </ a >
225
+ </ div >
177
226
</ div >
227
+
228
+ { /* Settings Dialog */ }
229
+ < SettingsDialog
230
+ isOpen = { isSettingsDialogVisible }
231
+ onClose = { ( ) => setIsSettingsDialogVisible ( false ) }
232
+ />
178
233
</ div >
179
234
) ;
180
235
} ;
0 commit comments