@huaqiu/dsh-hardware-ui 0.7.14 → 0.7.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +421 -142
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
- package/src/client/components.tsx +44 -38
- package/src/client/copy.ts +346 -0
- package/src/client/ecad.ts +2 -1
- package/src/client/index.ts +7 -4
- package/src/client/model.ts +14 -5
- package/src/client/order.tsx +63 -61
- package/src/client/preview.tsx +23 -26
- package/src/client/transport.ts +23 -1
- package/src/client/wizard.tsx +26 -30
package/src/client/wizard.tsx
CHANGED
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
} from 'react'
|
|
21
21
|
import type { HardwareInstallationConfig, InstallationsInfo } from './model.js'
|
|
22
22
|
import type { HardwareProps } from './components.js'
|
|
23
|
+
import { COPY } from './copy.js'
|
|
24
|
+
import { messageOf } from './transport.js'
|
|
23
25
|
import { buttonStyle, C, dotStyle, INPUT, MUTED, MONO_TEXT, pillStyle, R } from './theme.js'
|
|
24
26
|
|
|
25
27
|
const BACKDROP: CSSProperties = {
|
|
@@ -50,7 +52,8 @@ const FIELD_CARD: CSSProperties = {
|
|
|
50
52
|
display: 'flex', flexDirection: 'column', gap: 6,
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
/** Step titles, in order (also the dot-strip tooltips and the counter label). */
|
|
56
|
+
const STEPS = COPY.wizard.steps
|
|
54
57
|
|
|
55
58
|
/**
|
|
56
59
|
* Dismissal remembered for the life of this client bundle, not one mount.
|
|
@@ -183,7 +186,7 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
|
|
|
183
186
|
if (kicadRoot !== '') await saveInstallation('kicad', kicadRoot)
|
|
184
187
|
if (solidcraftRoot !== '') await saveInstallation('solidcraft', solidcraftRoot)
|
|
185
188
|
} catch (error) {
|
|
186
|
-
setMessage(
|
|
189
|
+
setMessage(messageOf(error))
|
|
187
190
|
setBusy(false)
|
|
188
191
|
return
|
|
189
192
|
}
|
|
@@ -218,20 +221,17 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
|
|
|
218
221
|
createElement(
|
|
219
222
|
'div',
|
|
220
223
|
{ style: { display: 'flex', flexDirection: 'column', gap: 1 } },
|
|
221
|
-
createElement('h2', { style: TITLE },
|
|
222
|
-
createElement('span', { style: STEP_LABEL },
|
|
224
|
+
createElement('h2', { style: TITLE }, COPY.wizard.welcomeTitle),
|
|
225
|
+
createElement('span', { style: STEP_LABEL }, COPY.wizard.welcomeKicker),
|
|
223
226
|
),
|
|
224
227
|
),
|
|
225
|
-
createElement('p', { style: LEAD },
|
|
226
|
-
'Hardware Engineering previews KiCad projects, exports PCB 3D models, packages fabrication files and opens native files. Point it at your local installations once.'),
|
|
228
|
+
createElement('p', { style: LEAD }, COPY.wizard.welcomeLead),
|
|
227
229
|
createElement('div',
|
|
228
230
|
{ style: FIELD_CARD },
|
|
229
|
-
createElement('span', { style: { fontSize: 11, fontWeight: 600 } },
|
|
230
|
-
createElement('p', { style: { ...MUTED, color: C.text3 } },
|
|
231
|
-
'kicad-cli for previews, BOM, GLB and gerber/drill packaging. SolidCraft is shared with the agent as environment context only.'),
|
|
231
|
+
createElement('span', { style: { fontSize: 11, fontWeight: 600 } }, COPY.wizard.welcomeUsesTitle),
|
|
232
|
+
createElement('p', { style: { ...MUTED, color: C.text3 } }, COPY.wizard.welcomeUses),
|
|
232
233
|
),
|
|
233
|
-
createElement('p', { style: { ...MUTED, color: C.text3 } },
|
|
234
|
-
'Only local executables are used. Nothing is uploaded, and nothing is installed for you.'),
|
|
234
|
+
createElement('p', { style: { ...MUTED, color: C.text3 } }, COPY.wizard.welcomeLocal),
|
|
235
235
|
)
|
|
236
236
|
}
|
|
237
237
|
if (step === 1) {
|
|
@@ -241,19 +241,17 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
|
|
|
241
241
|
createElement(
|
|
242
242
|
'div',
|
|
243
243
|
{ style: SPREAD },
|
|
244
|
-
createElement('h2', { style: TITLE },
|
|
244
|
+
createElement('h2', { style: TITLE }, COPY.wizard.kicadTitle),
|
|
245
245
|
createElement('span', { style: facts?.kicad?.configured === true ? pillStyle('ok') : pillStyle('muted') },
|
|
246
|
-
facts?.kicad?.configured === true ? `v${facts.kicad.version ?? '?'}` :
|
|
246
|
+
facts?.kicad?.configured === true ? `v${facts.kicad.version ?? '?'}` : COPY.wizard.kicadOptional),
|
|
247
247
|
),
|
|
248
|
-
createElement('p', { style: LEAD },
|
|
249
|
-
'Enter a KiCad installation folder or a kicad-cli path. It is used for .kicad_sch / .kicad_pcb previews, PCB GLB export, fabrication packaging, and “Open in KiCad”.'),
|
|
248
|
+
createElement('p', { style: LEAD }, COPY.wizard.kicadLead),
|
|
250
249
|
createElement('input', {
|
|
251
250
|
style: INPUT, value: kicadRoot, autoFocus: true, spellCheck: false,
|
|
252
|
-
placeholder:
|
|
251
|
+
placeholder: COPY.wizard.kicadPlaceholder,
|
|
253
252
|
onChange: event => setKicadRoot(event.currentTarget.value),
|
|
254
253
|
}),
|
|
255
|
-
createElement('p', { style: { ...MUTED, color: C.text3 } },
|
|
256
|
-
'Leave it empty to skip. You can configure it later in Settings → Hardware Engineering.'),
|
|
254
|
+
createElement('p', { style: { ...MUTED, color: C.text3 } }, COPY.wizard.kicadSkipHint),
|
|
257
255
|
)
|
|
258
256
|
}
|
|
259
257
|
return createElement(
|
|
@@ -262,14 +260,13 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
|
|
|
262
260
|
createElement(
|
|
263
261
|
'div',
|
|
264
262
|
{ style: SPREAD },
|
|
265
|
-
createElement('h2', { style: TITLE },
|
|
266
|
-
createElement('span', { style: pillStyle('muted') },
|
|
263
|
+
createElement('h2', { style: TITLE }, COPY.wizard.solidcraftTitle),
|
|
264
|
+
createElement('span', { style: pillStyle('muted') }, COPY.wizard.kicadOptional),
|
|
267
265
|
),
|
|
268
|
-
createElement('p', { style: LEAD },
|
|
269
|
-
'SolidCraft is shared with the agent as environment context only in this POC — no native launch, no mechanical preview.'),
|
|
266
|
+
createElement('p', { style: LEAD }, COPY.wizard.solidcraftLead),
|
|
270
267
|
createElement('input', {
|
|
271
268
|
style: INPUT, value: solidcraftRoot, autoFocus: true, spellCheck: false,
|
|
272
|
-
placeholder:
|
|
269
|
+
placeholder: COPY.wizard.solidcraftPlaceholder,
|
|
273
270
|
onChange: event => setSolidcraftRoot(event.currentTarget.value),
|
|
274
271
|
}),
|
|
275
272
|
)
|
|
@@ -277,7 +274,7 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
|
|
|
277
274
|
|
|
278
275
|
return createElement(
|
|
279
276
|
'div',
|
|
280
|
-
{ style: BACKDROP, role: 'dialog', 'aria-modal': true, 'aria-label':
|
|
277
|
+
{ style: BACKDROP, role: 'dialog', 'aria-modal': true, 'aria-label': COPY.wizard.aria, 'data-hardware-wizard': true },
|
|
281
278
|
createElement(
|
|
282
279
|
'div',
|
|
283
280
|
{ style: PANEL },
|
|
@@ -292,20 +289,19 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
|
|
|
292
289
|
style: { ...dotStyle(index === step ? C.accent : index < step ? C.ok : C.text3, 6) },
|
|
293
290
|
title: label,
|
|
294
291
|
})),
|
|
295
|
-
createElement('span', { style: { ...STEP_LABEL, ...MONO_TEXT } },
|
|
292
|
+
createElement('span', { style: { ...STEP_LABEL, ...MONO_TEXT } }, COPY.wizard.stepCounter(step + 1, STEPS.length, STEPS[step] ?? '')),
|
|
296
293
|
),
|
|
297
294
|
createElement('button', {
|
|
298
295
|
type: 'button', style: buttonStyle('quiet', { fontSize: 10.5 }),
|
|
299
296
|
onClick: () => { void complete() },
|
|
300
|
-
},
|
|
297
|
+
}, COPY.wizard.skip),
|
|
301
298
|
),
|
|
302
299
|
stepBody(),
|
|
303
300
|
...(message === '' ? [] : [createElement('p', { key: 'msg', style: { ...MUTED, color: C.text2 }, role: 'status' }, message)]),
|
|
304
301
|
createElement(
|
|
305
302
|
'div',
|
|
306
303
|
{ style: { ...SPREAD, paddingTop: 6, borderTop: `1px solid ${C.borderSoft}` } },
|
|
307
|
-
createElement('span', { style: { ...MUTED, color: C.text3, fontSize: 10 } },
|
|
308
|
-
'You can change this any time in Settings → Hardware Engineering.'),
|
|
304
|
+
createElement('span', { style: { ...MUTED, color: C.text3, fontSize: 10 } }, COPY.wizard.footerNote),
|
|
309
305
|
createElement(
|
|
310
306
|
'span',
|
|
311
307
|
{ style: ROW },
|
|
@@ -313,12 +309,12 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
|
|
|
313
309
|
? createElement('button', {
|
|
314
310
|
type: 'button', style: buttonStyle('secondary'),
|
|
315
311
|
onClick: () => { setStep(step - 1) },
|
|
316
|
-
},
|
|
312
|
+
}, COPY.wizard.back)
|
|
317
313
|
: null,
|
|
318
314
|
createElement('button', {
|
|
319
315
|
type: 'button', style: buttonStyle('primary'), disabled: busy,
|
|
320
316
|
onClick: () => { void next() },
|
|
321
|
-
}, busy ?
|
|
317
|
+
}, busy ? COPY.wizard.saving : step === STEPS.length - 1 ? COPY.wizard.finish : COPY.wizard.next),
|
|
322
318
|
),
|
|
323
319
|
),
|
|
324
320
|
),
|