@@ -126,86 +126,75 @@ const UpdateApp = ({ isCheckPage }: UpdateAppProps) => {
126
126
onClose = { noop }
127
127
>
128
128
< div className = "fixed inset-0 z-10 w-screen overflow-y-auto" >
129
- < div
130
- className = { clsx (
131
- "flex min-h-full items-center justify-center" ,
132
- {
133
- "p-4" : ! isCheckPage ,
134
- }
135
- ) } >
129
+ < div className = { clsx ( "flex min-h-full items-center justify-center" , ! isCheckPage && "p-4" ) } >
136
130
< DialogPanel
137
131
transition
138
- className = { clsx (
139
- "relative w-[340px] py-8 flex flex-col items-center bg-white shadow-md border border-[#EDEDED] rounded-lg dark:bg-[#333] dark:border-black/20" ,
140
- ) }
132
+ className = { `relative w-[340px] py-8 flex flex-col items-center bg-white shadow-md border border-[#EDEDED] dark:bg-[#333] dark:border-black/20 ${ isCheckPage ? "" : "rounded-lg" } ` }
141
133
>
142
- { isCheckPage ? null : < X
143
- className = { clsx (
144
- "absolute size-5 text-[#999] top-3 right-3 dark:text-[#D8D8D8]" ,
145
- cursorClassName ,
146
- {
147
- hidden : ! isOptional ,
148
- }
149
- ) }
150
- onClick = { handleCancel }
151
- /> }
134
+ { ! isCheckPage && isOptional && (
135
+ < X
136
+ className = { clsx ( "absolute size-5 top-3 right-3 text-[#999] dark:text-[#D8D8D8]" , cursorClassName ) }
137
+ onClick = { handleCancel }
138
+ />
139
+ ) }
152
140
153
141
< img src = { isDark ? darkIcon : lightIcon } className = "h-6" />
154
142
155
- < div className = "text-[#333] text-sm leading-5 py-2 dark:text-[#D8D8D8]" >
156
- { isOptional ? (
157
- t ( "update.optional_description" )
158
- ) : (
159
- < div className = "leading-5 text-center" >
160
- < p > { t ( "update.force_description1 " ) } </ p >
161
- < p > { t ( "update.force_description2" ) } </ p >
162
- </ div >
163
- ) }
143
+ < div className = "text-[#333] text-sm leading-5 py-2 dark:text-[#D8D8D8] text-center " >
144
+ { updateInfo ?. available ? (
145
+ isOptional ? t ( "update.optional_description" ) : (
146
+ < >
147
+ < p > { t ( "update.force_description1" ) } </ p >
148
+ < p > { t ( "update.force_description2 " ) } </ p >
149
+ </ >
150
+ )
151
+ ) : t ( "update.date" ) }
164
152
</ div >
165
153
166
- < div
167
- className = "text-xs text-[#0072FF] cursor-pointer"
168
- onClick = { ( ) => {
169
- OpenURLWithBrowser (
170
- "https://docs.infinilabs.com/coco-app/main/docs/release-notes"
171
- ) ;
172
- } }
173
- >
174
- v{ updateInfo ?. version } { t ( "update.releaseNotes" ) }
175
- </ div >
154
+ { updateInfo ?. available ? (
155
+ < div
156
+ className = "text-xs text-[#0072FF] cursor-pointer"
157
+ onClick = { ( ) =>
158
+ OpenURLWithBrowser ( "https://docs.infinilabs.com/coco-app/main/docs/release-notes" )
159
+ }
160
+ >
161
+ v{ updateInfo . version } { t ( "update.releaseNotes" ) }
162
+ </ div >
163
+ ) : (
164
+ < div className = { clsx ( "text-xs text-[#999]" , cursorClassName ) } >
165
+ { t ( "update.latest" , { replace : [ updateInfo ?. version ] } ) }
166
+ </ div >
167
+ ) }
176
168
177
169
< Button
178
170
className = { clsx (
179
171
"mb-3 mt-6 bg-[#0072FF] text-white text-sm px-[14px] py-[8px] rounded-lg" ,
180
172
cursorClassName ,
181
- {
182
- "opacity-50" : state . loading ,
183
- }
173
+ state . loading && "opacity-50"
184
174
) }
185
- onClick = { handleDownload }
175
+ onClick = { updateInfo ?. available ? handleDownload : handleSkip }
186
176
>
187
177
{ state . loading ? (
188
178
< div className = "flex justify-center items-center gap-2" >
189
179
< LoaderCircle className = "animate-spin size-5" />
190
180
{ percent } %
191
181
</ div >
192
- ) : (
193
- t ( "update.button.install" )
194
- ) }
182
+ ) : updateInfo ?. available ? t ( "update.button.install" ) : t ( "update.button.ok" ) }
195
183
</ Button >
196
184
197
- < div
198
- className = { clsx ( "text-xs text-[#999]" , cursorClassName , {
199
- hidden : ! isOptional ,
200
- } ) }
201
- onClick = { handleSkip }
202
- >
203
- { t ( "update.skip_version" ) }
204
- </ div >
185
+ { updateInfo ?. available && isOptional && (
186
+ < div
187
+ className = { clsx ( "text-xs text-[#999]" , cursorClassName ) }
188
+ onClick = { handleSkip }
189
+ >
190
+ { t ( "update.skip_version" ) }
191
+ </ div >
192
+ ) }
205
193
</ DialogPanel >
206
194
</ div >
207
195
</ div >
208
196
</ Dialog >
197
+
209
198
) ;
210
199
} ;
211
200
0 commit comments