@huaqiu/dsh-hardware-ui 0.7.14 → 0.7.16

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/index.d.mts CHANGED
@@ -11,7 +11,14 @@ declare const name = "@huaqiu/dsh-hardware-ui";
11
11
  declare function apply(): void;
12
12
  /** The tab kind owned by this product UI. */
13
13
  declare const HARDWARE_TAB_KIND = "hardware-engineering";
14
- /** Slots this product UI occupies. Exported for contract tests and readers. */
15
- declare const HARDWARE_UI_SLOTS: readonly ["conversation.header.leading", "conversation.session.header.corner", "sidebar.right.pane.tab", "settings.section"];
14
+ /**
15
+ * Slots this product UI occupies. Exported for contract tests and readers.
16
+ *
17
+ * `conversation.session.header.corner` is DSH's own expand button (we occupy
18
+ * nothing there); it is listed because the product depends on it. The
19
+ * conversation header carries no product navigation any more: the right panel's
20
+ * header is the only one.
21
+ */
22
+ declare const HARDWARE_UI_SLOTS: readonly ["conversation.session.header.corner", "sidebar.right.pane.tab", "settings.section"];
16
23
  //#endregion
17
24
  export { HARDWARE_TAB_KIND, HARDWARE_UI_SLOTS, apply, name };
package/lib/index.mjs CHANGED
@@ -11,9 +11,15 @@ const name = "@huaqiu/dsh-hardware-ui";
11
11
  function apply() {}
12
12
  /** The tab kind owned by this product UI. */
13
13
  const HARDWARE_TAB_KIND = "hardware-engineering";
14
- /** Slots this product UI occupies. Exported for contract tests and readers. */
14
+ /**
15
+ * Slots this product UI occupies. Exported for contract tests and readers.
16
+ *
17
+ * `conversation.session.header.corner` is DSH's own expand button (we occupy
18
+ * nothing there); it is listed because the product depends on it. The
19
+ * conversation header carries no product navigation any more: the right panel's
20
+ * header is the only one.
21
+ */
15
22
  const HARDWARE_UI_SLOTS = Object.freeze([
16
- "conversation.header.leading",
17
23
  "conversation.session.header.corner",
18
24
  "sidebar.right.pane.tab",
19
25
  "settings.section"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huaqiu/dsh-hardware-ui",
3
- "version": "0.7.14",
3
+ "version": "0.7.16",
4
4
  "type": "module",
5
5
  "description": "Hardware Engineering product UI for DSH: five-destination engineering navigation, right-panel artifact viewer, CAD installation settings and contextual native-application actions.",
6
6
  "license": "MIT",
@@ -22,9 +22,11 @@ import {
22
22
  } from './model.js'
23
23
  import { HardwarePreview } from './preview.js'
24
24
  import { OnboardingWizard } from './wizard.js'
25
+ import { COPY, issueText } from './copy.js'
26
+ import { messageOf } from './transport.js'
25
27
  import {
26
28
  buttonStyle, C, cardStyle, disabled, DOT_COLORS, dotStyle, INPUT, MUTED, MONO, MONO_TEXT,
27
- pillStyle, R, SECTION_TITLE,
29
+ pillStyle, R,
28
30
  } from './theme.js'
29
31
 
30
32
  type UseStore = <S>(selector: (state: HardwareState) => S) => S
@@ -63,10 +65,6 @@ const useEmptyTab = (): TabInfo => EMPTY_TAB
63
65
 
64
66
  const ROW: CSSProperties = { display: 'flex', alignItems: 'center', gap: 4, flexWrap: 'wrap', minWidth: 0 }
65
67
 
66
- const NAV: CSSProperties = {
67
- display: 'flex', alignItems: 'center', gap: 3, minWidth: 0, fontSize: 12,
68
- position: 'relative', flexWrap: 'nowrap',
69
- }
70
68
  const NAV_ITEM: CSSProperties = {
71
69
  display: 'inline-flex', alignItems: 'center', gap: 5, padding: '3px 8px', borderRadius: R.md,
72
70
  border: '1px solid transparent', background: 'transparent', color: C.text2,
@@ -79,28 +77,26 @@ const NAV_ITEM_ACTIVE: CSSProperties = {
79
77
  background: C.card,
80
78
  border: `1px solid ${C.border}`,
81
79
  }
82
- const BRAND: CSSProperties = {
83
- display: 'flex', alignItems: 'center', gap: 6, paddingRight: 8, flex: '0 0 auto',
84
- borderRight: `1px solid ${C.border}`, marginRight: 3,
85
- }
86
- const BRAND_MARK: CSSProperties = {
87
- width: 19, height: 19, borderRadius: R.sm, display: 'flex', alignItems: 'center', justifyContent: 'center',
88
- fontSize: 9.5, fontWeight: 700, color: '#fff', background: C.accent,
89
- boxShadow: '0 2px 8px rgba(225,37,27,0.35)',
90
- }
91
- const BRAND_NAME: CSSProperties = { fontSize: 10.5, fontWeight: 600, whiteSpace: 'nowrap', color: C.text }
92
- const CHIP: CSSProperties = {
93
- minWidth: 0, maxWidth: 168, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
94
- color: C.text3, fontSize: 10, fontFamily: MONO, flex: '0 1 auto',
95
- }
96
80
  const PANEL_ROOT: CSSProperties = {
97
81
  display: 'flex', flexDirection: 'column', height: '100%', minHeight: 0, minWidth: 0,
98
82
  boxSizing: 'border-box', background: C.base, color: C.text,
99
83
  }
100
- const STRIP: CSSProperties = {
84
+ /**
85
+ * The panel's top edge.
86
+ *
87
+ * The tab strip that used to sit here is gone: this page's destination switches
88
+ * ARE the panel's header. The right padding is the room the host lays its two
89
+ * panel controls (full screen, collapse) over — both rows are 38px, so the
90
+ * buttons centre on this row's centre line.
91
+ */
92
+ const HEADER: CSSProperties = {
101
93
  display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 6,
102
- padding: '5px 8px', background: C.panel, borderBottom: `1px solid ${C.border}`,
103
- flex: '0 0 auto', minWidth: 0,
94
+ // The panel's two controls (fullscreen + collapse) are laid over this row's
95
+ // right end: 28 + 8 + 28px wide, 12px from the column edge — the same inset
96
+ // the conversation header's own button uses. The row reserves that whole
97
+ // gutter, so nothing sits under them.
98
+ height: 38, boxSizing: 'border-box', padding: '0 76px 0 10px',
99
+ background: C.panel, borderBottom: `1px solid ${C.border}`, flex: '0 0 auto', minWidth: 0,
104
100
  }
105
101
  const STRIP_GROUP: CSSProperties = { ...ROW, gap: 2, flexWrap: 'nowrap', overflowX: 'auto', minWidth: 0 }
106
102
  const META: CSSProperties = {
@@ -131,62 +127,6 @@ export function navigationParams(info: TabInfo | undefined): ViewerNavigationPar
131
127
  return params as unknown as ViewerNavigationParams
132
128
  }
133
129
 
134
- /**
135
- * One product navigation row: brand, the five persistent destinations, and the
136
- * selected project. The first-run wizard renders from this root-scope seat
137
- * because it must be able to run before any session exists.
138
- */
139
- export function EngineeringNav(props: HardwareProps): ReactNode {
140
- const { useStore, actions, useSessions, discover, openDestination } = props
141
- const active = useStore(state => state.activeDestination)
142
- const projectPath = useStore(state => state.projectPath)
143
- const selected = useStore(state => state.discovery?.selected)
144
- // The navigation row is a `root` seat, so it has no session of its own; the
145
- // first listed session stands in for "the workspace this product is showing".
146
- const sessionId = useSessions?.(state => state.ids[0])
147
- const cwd = useSessions?.(state => {
148
- const id = state.ids[0]
149
- return id === undefined ? undefined : state.byId[id]?.cwd
150
- })
151
-
152
- useEffect(() => {
153
- let live = true
154
- discover(cwd, undefined, sessionId)
155
- .then((discovery) => { if (live) actions.setDiscovery(discovery) })
156
- .catch((error: unknown) => { if (live) actions.setNotice(`Artifact discovery failed: ${String(error)}`) })
157
- return () => { live = false }
158
- }, [cwd, sessionId, discover, actions])
159
-
160
- const projectName = selected?.name ?? (projectPath === undefined ? undefined : basename(projectPath))
161
-
162
- return createElement(
163
- 'div',
164
- { style: NAV, 'data-hardware-nav': true },
165
- ...DESTINATIONS.map(destination => createElement(
166
- 'button',
167
- {
168
- key: destination, type: 'button',
169
- style: destination === active ? NAV_ITEM_ACTIVE : NAV_ITEM,
170
- 'aria-pressed': destination === active,
171
- 'data-destination': destination,
172
- title: DESTINATION_LABELS[destination],
173
- onClick: () => {
174
- actions.setActive(destination)
175
- openDestination(destination)
176
- },
177
- },
178
- createElement('span', { style: dotStyle(DOT_COLORS[destination], 6) }),
179
- DESTINATION_LABELS[destination],
180
- )),
181
- ...(projectName === undefined
182
- ? []
183
- : [createElement('span', {
184
- key: 'project', style: { ...CHIP, paddingLeft: 4 }, title: projectPath ?? projectName,
185
- }, projectName)]),
186
- createElement(OnboardingWizard, props),
187
- )
188
- }
189
-
190
130
  /** The artifact a destination previews, with its canonical identity. */
191
131
  export function selectedArtifact(state: HardwareState, destination: HardwareDestination): HardwareArtifactInfo | undefined {
192
132
  const project = state.discovery?.selected
@@ -200,21 +140,48 @@ export function selectedArtifact(state: HardwareState, destination: HardwareDest
200
140
  return board
201
141
  }
202
142
 
203
- function missingReason(state: HardwareState, destination: HardwareDestination): string | undefined {
143
+ /** What an empty viewer says: what is missing, why, and how to get it. */
144
+ export interface MissingView {
145
+ /** The destination-shaped absence, in the user's words. */
146
+ readonly title: string
147
+ readonly reason: string
148
+ /** How the artifact can exist. Absent when the fix is a control already on screen. */
149
+ readonly guidance?: string
150
+ }
151
+
152
+ /**
153
+ * Resolve the placeholder for one destination, or `undefined` while there is
154
+ * nothing to say (no discovery yet, or an artifact to render).
155
+ *
156
+ * The guidance points at the agent: this product's hardware is authored in the
157
+ * conversation, so "暂无原理图" alone leaves the user with no next step.
158
+ */
159
+ export function missingState(state: HardwareState, destination: HardwareDestination): MissingView | undefined {
204
160
  const discovery = state.discovery
205
161
  if (discovery === undefined) return undefined
162
+ const title = COPY.placeholder.title[destination]
206
163
  if (discovery.issue?.code === 'selection-required' && (discovery.projects?.length ?? 0) > 1) {
207
- return `${String(discovery.projects?.length)} hardware projects found; choose one explicitly.`
164
+ // The project select sits directly above this card; a second instruction
165
+ // would point at a choice the user can already see.
166
+ return { title, reason: COPY.discovery.selectionRequiredCount(discovery.projects?.length ?? 0) }
167
+ }
168
+ if (discovery.selected === undefined) {
169
+ return { title, reason: COPY.discovery.noProjectSelected, guidance: COPY.placeholder.noProject }
208
170
  }
209
- if (discovery.selected === undefined) return 'No hardware project selected. Open or select a hardware project.'
210
171
  if (destination === 'schematic' || destination === 'bom') {
211
- if (discovery.selected.schematic === undefined) return 'This project has no discoverable root schematic.'
172
+ if (discovery.selected.schematic === undefined) {
173
+ return { title, reason: COPY.discovery.noSchematic, guidance: COPY.placeholder.guide[destination] }
174
+ }
212
175
  }
213
176
  if (destination === 'pcb' || destination === '3d') {
214
- if ((discovery.selected.boards?.length ?? 0) === 0) return 'This project has no discoverable .kicad_pcb board.'
177
+ if ((discovery.selected.boards?.length ?? 0) === 0) {
178
+ return { title, reason: COPY.discovery.noBoard, guidance: COPY.placeholder.guide[destination] }
179
+ }
215
180
  }
216
181
  if (destination === 'order') {
217
- if ((discovery.selected.boards?.length ?? 0) === 0) return 'Select a board before quoting or ordering fabrication.'
182
+ if ((discovery.selected.boards?.length ?? 0) === 0) {
183
+ return { title, reason: COPY.discovery.noBoardToOrder, guidance: COPY.placeholder.guide.order }
184
+ }
218
185
  }
219
186
  return undefined
220
187
  }
@@ -238,19 +205,19 @@ function nativeAction(
238
205
  disabled: !canOpen,
239
206
  'data-hardware-native-open': true,
240
207
  title: canOpen
241
- ? `Open ${artifact.path} in KiCad`
242
- : configured ? 'Select an artifact first' : 'Configure KiCad in Settings → Hardware Engineering',
208
+ ? COPY.viewer.openInKicadTitle(artifact.path)
209
+ : configured ? COPY.viewer.selectArtifactFirst : COPY.viewer.configureKicad,
243
210
  onClick: () => {
244
211
  if (artifact === undefined) return
245
212
  openNative({
246
213
  application,
247
214
  artifactPath: artifact.path,
248
215
  kind: active === '3d' ? 'pcb-3d' : active === 'bom' ? 'bom' : artifact.kind,
249
- }).catch((error: unknown) => { notice(String(error)) })
216
+ }).catch((error: unknown) => { notice(messageOf(error)) })
250
217
  },
251
218
  },
252
219
  createElement('span', { style: dotStyle(configured ? C.ok : C.text3, 6) }),
253
- 'Open in KiCad',
220
+ COPY.viewer.openInKicad,
254
221
  )
255
222
  }
256
223
 
@@ -282,7 +249,7 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
282
249
  const noticeText = useStore(state => state.notice)
283
250
  const installed = useStore(state => state.installations)
284
251
  const artifact = useStore(state => selectedArtifact(state, active))
285
- const reason = useStore(state => missingReason(state, active))
252
+ const missing = useStore(state => missingState(state, active))
286
253
  const workspaceRoot = useStore(state => state.workspaceRoot)
287
254
  const cwd = useSessions?.(state => {
288
255
  if (sessionId === undefined) return undefined
@@ -298,7 +265,7 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
298
265
  let live = true
299
266
  discover(cwd, params?.projectPath, sessionId)
300
267
  .then((result) => { if (live) actions.setDiscovery(result, params?.path !== undefined) })
301
- .catch((error: unknown) => { if (live) actions.setNotice(`Artifact discovery failed: ${String(error)}`) })
268
+ .catch((error: unknown) => { if (live) actions.setNotice(COPY.viewer.discoveryFailed(messageOf(error))) })
302
269
  return () => { live = false }
303
270
  }, [cwd, sessionId, params?.projectPath, actions, discover])
304
271
 
@@ -306,7 +273,7 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
306
273
  let live = true
307
274
  installations()
308
275
  .then((result) => { if (live) actions.setInstallations(result) })
309
- .catch((error: unknown) => { if (live) actions.setNotice(`Installation check failed: ${String(error)}`) })
276
+ .catch((error: unknown) => { if (live) actions.setNotice(COPY.viewer.installationFailed(messageOf(error))) })
310
277
  return () => { live = false }
311
278
  }, [actions, installations])
312
279
 
@@ -318,9 +285,9 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
318
285
  openDestination(destination, destination === 'schematic' || destination === 'bom' ? schematicPath : pcbPath)
319
286
  }
320
287
 
321
- const strip = createElement(
288
+ const header = createElement(
322
289
  'div',
323
- { style: STRIP, 'data-hardware-destinations': true },
290
+ { style: HEADER, 'data-hardware-header': true, 'data-hardware-destinations': true },
324
291
  createElement(
325
292
  'div',
326
293
  { style: STRIP_GROUP },
@@ -330,6 +297,8 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
330
297
  key: destination, type: 'button',
331
298
  style: destination === active ? { ...NAV_ITEM_ACTIVE, fontSize: 11 } : { ...NAV_ITEM, fontSize: 11 },
332
299
  'aria-pressed': destination === active,
300
+ 'data-destination': destination,
301
+ title: DESTINATION_LABELS[destination],
333
302
  onClick: () => { go(destination) },
334
303
  },
335
304
  createElement('span', { style: dotStyle(DOT_COLORS[destination], 6) }),
@@ -343,14 +312,14 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
343
312
  'div',
344
313
  { style: META },
345
314
  createElement('span', { style: META_PATH, title: artifact?.path ?? '' },
346
- artifact === undefined ? 'no artifact selected' : artifact.path),
315
+ artifact === undefined ? COPY.viewer.noArtifact : artifact.path),
347
316
  createElement(
348
317
  'span',
349
318
  { style: { display: 'flex', alignItems: 'center', gap: 4, flex: '0 0 auto' } },
350
319
  ...(selectedProject === undefined ? [] : [createElement('span', { key: 'project', style: pillStyle('muted') }, selectedProject.name)]),
351
320
  ...(kicadConfigured
352
- ? [createElement('span', { key: 'kicad', style: pillStyle('ok') }, `KiCad ${installed?.kicad?.version ?? ''}`.trim())]
353
- : [createElement('span', { key: 'kicad', style: pillStyle('warn'), title: installed?.kicad?.error ?? '' }, 'KiCad missing')]),
321
+ ? [createElement('span', { key: 'kicad', style: pillStyle('ok') }, COPY.viewer.kicadVersion(installed?.kicad?.version ?? '').trim())]
322
+ : [createElement('span', { key: 'kicad', style: pillStyle('warn'), title: installed?.kicad?.error ?? '' }, COPY.viewer.kicadMissing)]),
354
323
  ),
355
324
  )
356
325
 
@@ -360,16 +329,16 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
360
329
  selectors.push(createElement(
361
330
  'select',
362
331
  {
363
- key: 'project', style: selectStyle, value: projectPath ?? '', 'aria-label': 'Project',
332
+ key: 'project', style: selectStyle, value: projectPath ?? '', 'aria-label': COPY.viewer.projectField,
364
333
  onChange: (event: ChangeEvent<HTMLSelectElement>) => {
365
334
  const path = event.currentTarget.value
366
335
  actions.selectProject(path)
367
336
  discover(cwd, path, sessionId)
368
337
  .then(result => actions.setDiscovery(result))
369
- .catch((error: unknown) => actions.setNotice(String(error)))
338
+ .catch((error: unknown) => actions.setNotice(messageOf(error)))
370
339
  },
371
340
  },
372
- option('', 'Select a project…'),
341
+ option('', COPY.viewer.selectProject),
373
342
  ...(discovery?.projects ?? []).map(project => option(project.path, project.name)),
374
343
  ))
375
344
  }
@@ -380,7 +349,7 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
380
349
  selectors.push(createElement(
381
350
  'select',
382
351
  {
383
- key: 'sheet', style: selectStyle, value: schematicPath ?? '', 'aria-label': 'Schematic sheet',
352
+ key: 'sheet', style: selectStyle, value: schematicPath ?? '', 'aria-label': COPY.viewer.schematicSheetField,
384
353
  onChange: (event: ChangeEvent<HTMLSelectElement>) => {
385
354
  const path = event.currentTarget.value
386
355
  actions.selectArtifact(path, 'schematic')
@@ -396,7 +365,7 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
396
365
  selectors.push(createElement(
397
366
  'select',
398
367
  {
399
- key: 'board', style: selectStyle, value: pcbPath ?? '', 'aria-label': 'Board',
368
+ key: 'board', style: selectStyle, value: pcbPath ?? '', 'aria-label': COPY.viewer.boardField,
400
369
  onChange: (event: ChangeEvent<HTMLSelectElement>) => {
401
370
  const path = event.currentTarget.value
402
371
  actions.selectArtifact(path, 'pcb')
@@ -417,14 +386,18 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
417
386
  : [createElement('span', { key: 'notice', role: 'status', style: { ...MUTED, color: C.warn } }, noticeText)]),
418
387
  ...(discovery?.issue === undefined || discovery.issue.code === 'selection-required'
419
388
  ? []
420
- : [createElement('span', { key: 'issue', role: 'status', style: MUTED }, discovery.issue.message)]),
389
+ : [createElement('span', { key: 'issue', role: 'status', style: MUTED },
390
+ issueText(discovery.issue, {
391
+ ...(discovery.cwd === undefined ? {} : { cwd: discovery.cwd }),
392
+ ...(discovery.projects === undefined ? {} : { count: discovery.projects.length }),
393
+ }))]),
421
394
  )
422
395
 
423
396
  return createElement(
424
397
  'div',
425
398
  { style: PANEL_ROOT, 'data-hardware-destination': active },
426
399
  createElement('style', null, PANEL_STYLE),
427
- strip,
400
+ header,
428
401
  meta,
429
402
  selectors.length === 0 && noticeText === undefined && (discovery?.issue === undefined || discovery.issue.code === 'selection-required')
430
403
  ? null
@@ -432,7 +405,7 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
432
405
  createElement(
433
406
  'div',
434
407
  { style: { ...BODY, overflow: active === 'order' || active === 'bom' ? 'auto' : 'hidden' } },
435
- ...(reason === undefined
408
+ ...(missing === undefined
436
409
  ? [createElement(HardwarePreview, {
437
410
  key: `preview:${info.tab.id}:${String(navRevision)}:${active}:${artifact?.path ?? ''}`,
438
411
  destination: active,
@@ -444,13 +417,26 @@ export function HardwareViewerBody(props: HardwareProps): ReactNode {
444
417
  configured: kicadConfigured,
445
418
  })]
446
419
  : [createElement('div', {
447
- key: 'reason',
448
- style: cardStyle({ alignItems: 'center', justifyContent: 'center', flex: '1 1 0', gap: 6 }),
420
+ key: 'missing',
421
+ style: cardStyle({ alignItems: 'center', justifyContent: 'center', flex: '1 1 0', gap: 6, padding: 20 }),
449
422
  'data-hardware-state': 'missing',
450
423
  },
451
- createElement('span', { style: pillStyle('warn') }, 'nothing to show'),
452
- createElement('p', { role: 'status', style: { ...MUTED, textAlign: 'center', maxWidth: 320 } }, reason))]),
424
+ createElement('span', { style: pillStyle('warn') }, missing.title),
425
+ createElement('p', {
426
+ role: 'status',
427
+ style: { ...MUTED, fontSize: 11.5, textAlign: 'center', maxWidth: 320 },
428
+ }, missing.reason),
429
+ ...(missing.guidance === undefined
430
+ ? []
431
+ : [createElement('p', {
432
+ key: 'guidance',
433
+ 'data-hardware-guidance': true,
434
+ style: { ...MUTED, color: C.text2, fontSize: 10.5, lineHeight: 1.6, textAlign: 'center', maxWidth: 360 },
435
+ }, missing.guidance)]))]),
453
436
  ),
437
+ // The first-run wizard rides the panel rather than the conversation header:
438
+ // this page is the product, and it is what the expand button opens.
439
+ createElement(OnboardingWizard, props),
454
440
  )
455
441
  }
456
442
 
@@ -488,11 +474,12 @@ export function HardwareSettingsSection(props: HardwareProps): ReactNode {
488
474
  const refreshed = await installations()
489
475
  actions.setInstallations(refreshed)
490
476
  const state = application === 'kicad' ? refreshed.kicad : refreshed.solidcraft
477
+ const applicationName = application === 'kicad' ? 'KiCad' : 'SolidCraft'
491
478
  setMessage(state?.configured === true
492
- ? `${application === 'kicad' ? 'KiCad' : 'SolidCraft'} validated and saved.`
493
- : `${application === 'kicad' ? 'KiCad' : 'SolidCraft'} saved, but validation failed: ${state?.error ?? 'not detected'}`)
479
+ ? COPY.settings.savedAndValidated(applicationName)
480
+ : COPY.settings.savedButInvalid(applicationName, state?.error ?? COPY.settings.notDetected))
494
481
  } catch (error) {
495
- setMessage(String(error))
482
+ setMessage(messageOf(error))
496
483
  } finally {
497
484
  setBusy(undefined)
498
485
  }
@@ -537,7 +524,7 @@ export function HardwareSettingsSection(props: HardwareProps): ReactNode {
537
524
  createElement('p', { style: MUTED }, input.blurb),
538
525
  createElement('input', {
539
526
  style: INPUT, value: input.value, placeholder: input.placeholder, spellCheck: false,
540
- 'aria-label': `${input.title} path`,
527
+ 'aria-label': COPY.settings.pathField(input.title),
541
528
  onChange: (event: ChangeEvent<HTMLInputElement>) => input.onChange(event.currentTarget.value),
542
529
  }),
543
530
  createElement(
@@ -547,7 +534,7 @@ export function HardwareSettingsSection(props: HardwareProps): ReactNode {
547
534
  type: 'button', style: { ...buttonStyle('secondary'), ...disabled(busy !== undefined) },
548
535
  disabled: busy !== undefined,
549
536
  onClick: () => { void save(input.key, input.value) },
550
- }, busy === input.key ? 'Validating…' : 'Validate / save'),
537
+ }, busy === input.key ? COPY.settings.validating : COPY.settings.validate),
551
538
  input.detail === undefined
552
539
  ? null
553
540
  : createElement('span', { style: { ...MUTED, ...MONO_TEXT, fontSize: 10, maxWidth: 240, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, input.detail),
@@ -557,19 +544,18 @@ export function HardwareSettingsSection(props: HardwareProps): ReactNode {
557
544
  return createElement(
558
545
  'div',
559
546
  { style: { display: 'flex', flexDirection: 'column', gap: 10 }, 'data-hardware-settings': true },
560
- createElement('h2', { style: { margin: 0, fontSize: 15, fontWeight: 600 } }, 'Hardware Engineering'),
561
- createElement('p', { style: MUTED },
562
- 'Local EDA and MCAD executables used for previews, fabrication packaging, one-click native open, and the agent environment context.'),
547
+ createElement('h2', { style: { margin: 0, fontSize: 15, fontWeight: 600 } }, COPY.settings.title),
548
+ createElement('p', { style: MUTED }, COPY.settings.lead),
563
549
  installationCard({
564
550
  key: 'kicad',
565
551
  letter: 'Ki',
566
552
  color: C.info,
567
- title: 'KiCad EDA suite',
568
- blurb: 'Accepts a KiCad installation root or a kicad-cli path. Drives .kicad_sch / .kicad_pcb preview, GLB export, BOM, gerber packaging and native open.',
553
+ title: COPY.settings.kicadTitle,
554
+ blurb: COPY.settings.kicadBlurb,
569
555
  value: kicadRoot,
570
- placeholder: 'C:\\Program Files\\KiCad\\8.0\\ or /usr/bin/kicad-cli',
556
+ placeholder: COPY.settings.kicadPlaceholder,
571
557
  ok: kicad?.configured === true,
572
- status: kicad?.configured ? `v${kicad.version ?? '?'}` : 'not configured',
558
+ status: kicad?.configured ? `v${kicad.version ?? '?'}` : COPY.settings.notConfigured,
573
559
  ...(kicad?.cli === undefined ? {} : { detail: kicad.cli }),
574
560
  onChange: setKicadRoot,
575
561
  }),
@@ -577,12 +563,12 @@ export function HardwareSettingsSection(props: HardwareProps): ReactNode {
577
563
  key: 'solidcraft',
578
564
  letter: 'Sc',
579
565
  color: C.warn,
580
- title: 'SolidCraft 3D CAD',
581
- blurb: 'Agent environment context only in this POC. No native launch and no mechanical preview; the 3D destination renders the selected PCB.',
566
+ title: COPY.settings.solidcraftTitle,
567
+ blurb: COPY.settings.solidcraftBlurb,
582
568
  value: solidcraftRoot,
583
- placeholder: 'C:\\Program Files\\SolidCraft\\bin\\SolidCraft.exe',
569
+ placeholder: COPY.settings.solidcraftPlaceholder,
584
570
  ok: solidcraft?.configured === true,
585
- status: solidcraft?.configured ? 'configured' : 'not configured',
571
+ status: solidcraft?.configured ? COPY.settings.configured : COPY.settings.notConfigured,
586
572
  ...(solidcraft?.executable === undefined ? {} : { detail: solidcraft.executable }),
587
573
  onChange: setSolidcraftRoot,
588
574
  }),