@@ -9,7 +9,7 @@ import type {
9
9
} from '../../../core/shared/import/import-operation-types'
10
10
import { ImportOperationResult } from '../../../core/shared/import/import-operation-types'
11
11
import { assertNever } from '../../../core/shared/utils'
12
- import { Icons } from '../../../uuiui'
12
+ import { Icn , Icons , useColorTheme } from '../../../uuiui'
13
13
import { GithubSpinner } from '../../../components/navigator/left-pane/github-pane/github-spinner'
14
14
import { RequirementResolutionResult } from '../../../core/shared/import/project-health-check/utopia-requirements-types'
15
15
@@ -21,11 +21,8 @@ export function OperationLine({ operation }: { operation: ImportOperation }) {
21
21
? 'running'
22
22
: 'done'
23
23
} , [ operation . timeStarted , operation . timeDone ] )
24
-
25
- const textColor = React . useMemo (
26
- ( ) => getTextColor ( operationRunningStatus , operation ) ,
27
- [ operationRunningStatus , operation ] ,
28
- )
24
+ const colorTheme = useColorTheme ( )
25
+ const textColor = operationRunningStatus === 'waiting' ? 'gray' : colorTheme . fg0 . value
29
26
30
27
const [ childrenShown , serChildrenShown ] = React . useState ( false )
31
28
const shouldShowChildren = React . useMemo (
@@ -77,7 +74,7 @@ function OperationChildrenList({ operation }: { operation: ImportOperation }) {
77
74
style = { {
78
75
display : 'flex' ,
79
76
flexDirection : 'column' ,
80
- gap : 10 ,
77
+ gap : 15 ,
81
78
} }
82
79
>
83
80
{ operation . type === 'refreshDependencies' ? (
@@ -114,14 +111,15 @@ function AggregatedChildrenStatus<T extends ImportOperation>({
114
111
successFn : ( operation : T ) => boolean
115
112
successTextFn : ( successCount : number ) => string
116
113
} ) {
114
+ const colorTheme = useColorTheme ( )
117
115
const doneDependencies = childOperations . filter ( successFn )
118
116
const restOfDependencies = childOperations . filter ( ( op ) => ! successFn ( op ) )
119
117
return (
120
118
< React . Fragment >
121
119
{ doneDependencies . length > 0 ? (
122
120
< OperationLineWrapper className = 'operation-done' >
123
- < OperationLineContent textColor = 'black' >
124
- < Icons . Checkmark style = { getIconColorStyle ( ImportOperationResult . Success ) } />
121
+ < OperationLineContent textColor = { colorTheme . fg0 . value } >
122
+ < Icn color = 'green' type = 'checkmark' />
125
123
< div > { successTextFn ( doneDependencies . length ) } </ div >
126
124
</ OperationLineContent >
127
125
</ OperationLineWrapper >
@@ -140,20 +138,16 @@ function OperationIcon({
140
138
runningStatus : 'waiting' | 'running' | 'done'
141
139
result ?: ImportOperationResult
142
140
} ) {
143
- const iconColorStyle = React . useMemo (
144
- ( ) => ( result != null ? getIconColorStyle ( result ) : { } ) ,
145
- [ result ] ,
146
- )
147
141
if ( runningStatus === 'running' ) {
148
142
return < GithubSpinner />
149
143
} else if ( runningStatus === 'done' && result === 'success' ) {
150
- return < Icons . Checkmark style = { iconColorStyle } />
144
+ return < Icn color = 'green' type = 'checkmark' />
151
145
} else if ( runningStatus === 'done' && result === 'warn' ) {
152
- return < Icons . WarningTriangle style = { iconColorStyle } />
146
+ return < Icn color = 'component-orange' type = 'warningtriangle' category = 'navigator-element' />
153
147
} else if ( runningStatus === 'waiting' ) {
154
148
return < Icons . Dot />
155
149
} else {
156
- return < Icons . Cross style = { iconColorStyle } />
150
+ return < Icn color = 'error' type = 'cross' />
157
151
}
158
152
}
159
153
@@ -164,6 +158,7 @@ function TimeFromInSeconds({
164
158
operation : ImportOperation
165
159
runningStatus : 'waiting' | 'running' | 'done'
166
160
} ) {
161
+ const colorTheme = useColorTheme ( )
167
162
const [ currentTime , setCurrentTime ] = React . useState ( Date . now ( ) )
168
163
React . useEffect ( ( ) => {
169
164
const interval = setInterval ( ( ) => {
@@ -188,7 +183,7 @@ function TimeFromInSeconds({
188
183
< div
189
184
data-short-time = { operationTime < 100 }
190
185
style = { {
191
- color : runningStatus === 'running' ? 'black' : 'gray' ,
186
+ color : runningStatus === 'running' ? colorTheme . fg0 . value : 'gray' ,
192
187
fontSize : runningStatus === 'running' ? undefined : 12 ,
193
188
} }
194
189
>
@@ -212,16 +207,11 @@ function OperationLineWrapper({
212
207
style = { {
213
208
display : 'flex' ,
214
209
flexDirection : 'column' ,
215
- gap : 10 ,
210
+ gap : 15 ,
216
211
} }
217
212
css = { {
218
213
'.import-wizard-operation-children > &' : {
219
214
paddingLeft : 26 ,
220
- fontSize : 12 ,
221
- img : {
222
- width : 12 ,
223
- height : 12 ,
224
- } ,
225
215
} ,
226
216
'.import-wizard-operation-children .operation-done [data-short-time=true]' : {
227
217
visibility : 'hidden' ,
@@ -285,39 +275,3 @@ function getImportOperationText(operation: ImportOperation): React.ReactNode {
285
275
assertNever ( operation )
286
276
}
287
277
}
288
-
289
- function getTextColor (
290
- operationRunningStatus : 'waiting' | 'running' | 'done' ,
291
- operation : ImportOperation ,
292
- ) {
293
- if ( operationRunningStatus === 'waiting' ) {
294
- return 'gray'
295
- } else {
296
- return 'black'
297
- }
298
- }
299
-
300
- function getIconColorStyle ( result : ImportOperationResult ) {
301
- // temp solution since we currently only have black icons
302
- // https://codepen.io/sosuke/pen/Pjoqqp
303
- if ( result === ImportOperationResult . Error ) {
304
- return {
305
- // our error red
306
- filter :
307
- 'invert(14%) sepia(99%) saturate(4041%) hue-rotate(328deg) brightness(101%) contrast(115%)' ,
308
- }
309
- } else if ( result === ImportOperationResult . Warn ) {
310
- return {
311
- // orange
312
- filter :
313
- 'invert(72%) sepia(90%) saturate(3088%) hue-rotate(1deg) brightness(105%) contrast(104%)' ,
314
- }
315
- } else if ( result === ImportOperationResult . Success ) {
316
- return {
317
- // green
318
- filter :
319
- 'invert(72%) sepia(60%) saturate(3628%) hue-rotate(126deg) brightness(104%) contrast(76%)' ,
320
- }
321
- }
322
- return { }
323
- }
0 commit comments