Skip to content

Commit 179f48c

Browse files
authoredNov 3, 2024
Fix(import): design review (#6611)
Design fixes according to Mckayla's review light: <img width="689" alt="image" src="https://github.com/user-attachments/assets/346c684f-9828-4bff-95cf-a4968808474c"> dark: <img width="685" alt="image" src="https://github.com/user-attachments/assets/d9f407c7-1792-49df-a584-5a500a560db1"> **Manual Tests:** I hereby swear that: - [X] I opened a hydrogen project and it loaded - [X] I could navigate to various routes in Play mode
1 parent 07c6bd8 commit 179f48c

File tree

4 files changed

+27
-84
lines changed

4 files changed

+27
-84
lines changed
 

‎editor/src/components/editor/import-wizard/components.tsx

+13-59
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
} from '../../../core/shared/import/import-operation-types'
1010
import { ImportOperationResult } from '../../../core/shared/import/import-operation-types'
1111
import { assertNever } from '../../../core/shared/utils'
12-
import { Icons } from '../../../uuiui'
12+
import { Icn, Icons, useColorTheme } from '../../../uuiui'
1313
import { GithubSpinner } from '../../../components/navigator/left-pane/github-pane/github-spinner'
1414
import { RequirementResolutionResult } from '../../../core/shared/import/project-health-check/utopia-requirements-types'
1515

@@ -21,11 +21,8 @@ export function OperationLine({ operation }: { operation: ImportOperation }) {
2121
? 'running'
2222
: 'done'
2323
}, [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
2926

3027
const [childrenShown, serChildrenShown] = React.useState(false)
3128
const shouldShowChildren = React.useMemo(
@@ -77,7 +74,7 @@ function OperationChildrenList({ operation }: { operation: ImportOperation }) {
7774
style={{
7875
display: 'flex',
7976
flexDirection: 'column',
80-
gap: 10,
77+
gap: 15,
8178
}}
8279
>
8380
{operation.type === 'refreshDependencies' ? (
@@ -114,14 +111,15 @@ function AggregatedChildrenStatus<T extends ImportOperation>({
114111
successFn: (operation: T) => boolean
115112
successTextFn: (successCount: number) => string
116113
}) {
114+
const colorTheme = useColorTheme()
117115
const doneDependencies = childOperations.filter(successFn)
118116
const restOfDependencies = childOperations.filter((op) => !successFn(op))
119117
return (
120118
<React.Fragment>
121119
{doneDependencies.length > 0 ? (
122120
<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' />
125123
<div>{successTextFn(doneDependencies.length)}</div>
126124
</OperationLineContent>
127125
</OperationLineWrapper>
@@ -140,20 +138,16 @@ function OperationIcon({
140138
runningStatus: 'waiting' | 'running' | 'done'
141139
result?: ImportOperationResult
142140
}) {
143-
const iconColorStyle = React.useMemo(
144-
() => (result != null ? getIconColorStyle(result) : {}),
145-
[result],
146-
)
147141
if (runningStatus === 'running') {
148142
return <GithubSpinner />
149143
} else if (runningStatus === 'done' && result === 'success') {
150-
return <Icons.Checkmark style={iconColorStyle} />
144+
return <Icn color='green' type='checkmark' />
151145
} else if (runningStatus === 'done' && result === 'warn') {
152-
return <Icons.WarningTriangle style={iconColorStyle} />
146+
return <Icn color='component-orange' type='warningtriangle' category='navigator-element' />
153147
} else if (runningStatus === 'waiting') {
154148
return <Icons.Dot />
155149
} else {
156-
return <Icons.Cross style={iconColorStyle} />
150+
return <Icn color='error' type='cross' />
157151
}
158152
}
159153

@@ -164,6 +158,7 @@ function TimeFromInSeconds({
164158
operation: ImportOperation
165159
runningStatus: 'waiting' | 'running' | 'done'
166160
}) {
161+
const colorTheme = useColorTheme()
167162
const [currentTime, setCurrentTime] = React.useState(Date.now())
168163
React.useEffect(() => {
169164
const interval = setInterval(() => {
@@ -188,7 +183,7 @@ function TimeFromInSeconds({
188183
<div
189184
data-short-time={operationTime < 100}
190185
style={{
191-
color: runningStatus === 'running' ? 'black' : 'gray',
186+
color: runningStatus === 'running' ? colorTheme.fg0.value : 'gray',
192187
fontSize: runningStatus === 'running' ? undefined : 12,
193188
}}
194189
>
@@ -212,16 +207,11 @@ function OperationLineWrapper({
212207
style={{
213208
display: 'flex',
214209
flexDirection: 'column',
215-
gap: 10,
210+
gap: 15,
216211
}}
217212
css={{
218213
'.import-wizard-operation-children > &': {
219214
paddingLeft: 26,
220-
fontSize: 12,
221-
img: {
222-
width: 12,
223-
height: 12,
224-
},
225215
},
226216
'.import-wizard-operation-children .operation-done [data-short-time=true]': {
227217
visibility: 'hidden',
@@ -285,39 +275,3 @@ function getImportOperationText(operation: ImportOperation): React.ReactNode {
285275
assertNever(operation)
286276
}
287277
}
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-
}

‎editor/src/components/editor/import-wizard/import-wizard.tsx

+12-25
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ export const ImportWizard = React.memo(() => {
8282
<div
8383
style={{
8484
background: colorTheme.bg0.value,
85+
color: colorTheme.fg0.value,
8586
boxShadow: UtopiaStyles.popup.boxShadow,
8687
borderRadius: 10,
8788
width: 600,
88-
height: 500,
89+
height: 420,
8990
position: 'relative',
9091
display: 'flex',
9192
flexDirection: 'column',
@@ -105,18 +106,18 @@ export const ImportWizard = React.memo(() => {
105106
width: '100%',
106107
}}
107108
>
108-
<div css={{ fontSize: 16, fontWeight: 400 }}>Project Import</div>
109+
<div css={{ fontSize: 16, fontWeight: 400 }}>Loading Project</div>
109110
{when(
110-
totalImportResult != null,
111+
totalImportResult == null,
111112
<Button
112113
highlight
113114
style={{
114-
width: 22,
115-
height: 22,
115+
padding: 15,
116+
color: colorTheme.fg6.value,
116117
}}
117118
onClick={handleDismiss}
118119
>
119-
<Icons.Cross />
120+
Cancel
120121
</Button>,
121122
)}
122123
</FlexRow>
@@ -157,41 +158,27 @@ export const ImportWizard = React.memo(() => {
157158
ImportWizard.displayName = 'ImportWizard'
158159

159160
function ActionButtons({ importResult }: { importResult: ImportOperationResult | null }) {
161+
const colorTheme = useColorTheme()
160162
const textColor = React.useMemo(() => {
161163
switch (importResult) {
162164
case ImportOperationResult.Success:
163165
return 'green'
164166
case ImportOperationResult.Warn:
165-
return 'orange'
166-
case ImportOperationResult.Error:
167-
return 'var(--utopitheme-githubIndicatorFailed)'
168-
case null:
169-
return 'black'
170-
default:
171-
assertNever(importResult)
172-
}
173-
}, [importResult])
174-
const buttonColor = React.useMemo(() => {
175-
switch (importResult) {
176-
case ImportOperationResult.Success:
177-
return 'var(--utopitheme-green)'
178-
case ImportOperationResult.Warn:
179-
return 'var(--utopitheme-githubMUDModified)'
167+
return colorTheme.warningOrange.value
180168
case ImportOperationResult.Error:
181169
return 'var(--utopitheme-githubIndicatorFailed)'
182170
case null:
183171
return 'black'
184172
default:
185173
assertNever(importResult)
186174
}
187-
}, [importResult])
175+
}, [colorTheme.warningOrange.value, importResult])
188176
const textStyle = {
189177
color: textColor,
190-
fontSize: 16,
178+
fontSize: 14,
191179
}
192180
const buttonStyle = {
193-
backgroundColor: buttonColor,
194-
color: 'white',
181+
backgroundColor: colorTheme.buttonBackground.value,
195182
padding: 20,
196183
fontSize: 14,
197184
cursor: 'pointer',

‎editor/src/uuiui/styles/theme/dark.ts

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const darkErrorStates = {
111111
// TODO vv only used by image-thumbnail-control, consider removing
112112
warningBgTranslucent: createUtopiColor('rgba(250, 94, 0, 0.2)'),
113113
warningBgSolid: createUtopiColor('rgba(252,142,77,1)'),
114+
warningOrange: createUtopiColor('#FFB751'),
114115
}
115116

116117
// TEMP colors with preset opacity pulled from within the app

‎editor/src/uuiui/styles/theme/light.ts

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const lightErrorStates = {
111111
// TODO vv only used by image-thumbnail-control, consider removing
112112
warningBgTranslucent: createUtopiColor('rgba(250, 94, 0, 0.2)'),
113113
warningBgSolid: createUtopiColor('rgba(252,142,77,1)'),
114+
warningOrange: createUtopiColor('#FF8A44'),
114115
}
115116

116117
// TEMP colors with preset opacity pulled from within the app

0 commit comments

Comments
 (0)