refactor(clues): settings facts, errors and empty state use the shared components
Dependency, plan, install and connection rows are FactRows (with a trailing action seat and data-* passthrough); source-list failures are ErrorBlocks; the empty catalogue is an EmptyState. Drops the settings sheet's dead rules.
This commit is contained in:
1 parent
3af5dd0a9c
commit
594d75cd13
6 files changed
+106
-286
No files matched your search
@@ -27,7 +27,7 @@ import { encode as encodeQr } from 'uqr'
|
||||
import { t, type CopyKey } from '../../locales.ts'
|
||||
import { clueRuntimeApi, type ClueRuntimeApi } from '../runtime-api.ts'
|
||||
import { LoadingIndicator } from '../../ui/LoadingIndicator.tsx'
|
||||
import { ActionButton, Checkbox, Notice, TextInput } from '../../ui/index.ts'
|
||||
import { ActionButton, Checkbox, FactRow, Notice, TextInput } from '../../ui/index.ts'
|
||||
import {
|
||||
publishClueStatuses,
|
||||
publishClueTask,
|
||||
@@ -1205,35 +1205,19 @@ export function SourceConfigPage(props: SourceConfigPageProps) {
|
||||
{current?.manualPath !== undefined && <span className={css.disclosureMeta}>{t('clueDependencyManualPath')}</span>}
|
||||
</summary>
|
||||
<div className={css.advancedBody}>
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueDependencyActualPath')}</span>
|
||||
<span className={`${css.configValue} ${css.configMono}`}>
|
||||
{current?.executablePath ?? missingDependencyValue(current)}
|
||||
</span>
|
||||
</div>
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueDependencyVersion')}</span>
|
||||
<span className={`${css.configValue} ${css.configMono}`}>
|
||||
{current?.version ?? missingDependencyValue(current)}
|
||||
</span>
|
||||
</div>
|
||||
<FactRow label={t('clueDependencyActualPath')} mono
|
||||
value={current?.executablePath ?? missingDependencyValue(current)} />
|
||||
<FactRow label={t('clueDependencyVersion')} mono
|
||||
value={current?.version ?? missingDependencyValue(current)} />
|
||||
{current !== undefined && (
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueDependencyCompat')}</span>
|
||||
<span className={css.configValue}>
|
||||
{t('clueDependencyRequirement', {
|
||||
minimum: current.minimumVersion,
|
||||
recommended: current.recommendedVersion,
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
<FactRow label={t('clueDependencyCompat')} value={t('clueDependencyRequirement', {
|
||||
minimum: current.minimumVersion,
|
||||
recommended: current.recommendedVersion,
|
||||
})} />
|
||||
)}
|
||||
{current?.manualPath !== undefined && (
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueDependencyManualPath')}</span>
|
||||
<span className={`${css.configValue} ${css.configMono}`}>{current.manualPath}</span>
|
||||
<Action label={t('clueDependencyClearPath')} onClick={() => { void clearPath(dependencyId) }} />
|
||||
</div>
|
||||
<FactRow label={t('clueDependencyManualPath')} mono value={current.manualPath}
|
||||
action={<Action label={t('clueDependencyClearPath')} onClick={() => { void clearPath(dependencyId) }} />} />
|
||||
)}
|
||||
<div className={css.configInputRow}>
|
||||
<TextInput
|
||||
@@ -1280,70 +1264,39 @@ export function SourceConfigPage(props: SourceConfigPageProps) {
|
||||
<>
|
||||
<p className={css.configHint}>{t('clueDependencyInstallUnavailable')}</p>
|
||||
{current.manualInstall !== undefined && (
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueDependencyManualInstall')}</span>
|
||||
<span className={css.configValue}>
|
||||
{current.manualInstall.instructions}
|
||||
{current.manualInstall.url !== undefined && (
|
||||
<>
|
||||
{' '}
|
||||
<a className={css.authLink} href={current.manualInstall.url} target="_blank" rel="noreferrer">
|
||||
{current.manualInstall.url}
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<FactRow label={t('clueDependencyManualInstall')} value={<>
|
||||
{current.manualInstall.instructions}
|
||||
{current.manualInstall.url !== undefined && (
|
||||
<>
|
||||
{' '}
|
||||
<a className={css.authLink} href={current.manualInstall.url} target="_blank" rel="noreferrer">
|
||||
{current.manualInstall.url}
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</>} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{current?.state === 'installing' && current.installation !== undefined && currentTask === undefined && (
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueDependencyInstall')}</span>
|
||||
<span className={css.configValue}>
|
||||
{current.installation.stage === undefined
|
||||
? t('clueStateInstalling')
|
||||
: t(STAGE_COPY[current.installation.stage])}
|
||||
</span>
|
||||
</div>
|
||||
<FactRow label={t('clueDependencyInstall')} value={current.installation.stage === undefined
|
||||
? t('clueStateInstalling')
|
||||
: t(STAGE_COPY[current.installation.stage])} />
|
||||
)}
|
||||
|
||||
{currentPlan !== undefined && (
|
||||
<div className={css.plan} data-clue-plan={currentPlan.planId}>
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configValue}>
|
||||
{t('clueDependencyPlanTitle', { name: currentPlan.name, version: currentPlan.version })}
|
||||
</span>
|
||||
</div>
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configValue}>
|
||||
{t('clueDependencyPlanTarget', { path: currentPlan.targetDir })}
|
||||
</span>
|
||||
</div>
|
||||
<FactRow value={t('clueDependencyPlanTitle', { name: currentPlan.name, version: currentPlan.version })} />
|
||||
<FactRow value={t('clueDependencyPlanTarget', { path: currentPlan.targetDir })} />
|
||||
{/* S2 §6.1: confirm the exact asset being installed --
|
||||
platform/arch, distribution source+kind, the PATH copy
|
||||
that will be left untouched, and the plan's expiry. */}
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueDependencyPlanPlatform')}</span>
|
||||
<span className={`${css.configValue} ${css.configMono}`}>
|
||||
{currentPlan.platform} / {currentPlan.arch}
|
||||
</span>
|
||||
</div>
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueDependencyPlanDistribution')}</span>
|
||||
<span className={css.configValue}>
|
||||
{currentPlan.distribution.source}
|
||||
{' · '}
|
||||
{t(DISTRIBUTION_COPY[currentPlan.distribution.kind])}
|
||||
</span>
|
||||
</div>
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>
|
||||
{t('clueDependencyPlanExpires', {
|
||||
time: new Date(currentPlan.expiresAt).toLocaleString(),
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
<FactRow label={t('clueDependencyPlanPlatform')} mono value={`${currentPlan.platform} / ${currentPlan.arch}`} />
|
||||
<FactRow label={t('clueDependencyPlanDistribution')}
|
||||
value={`${currentPlan.distribution.source} · ${t(DISTRIBUTION_COPY[currentPlan.distribution.kind])}`} />
|
||||
<p className={css.configHint}>
|
||||
{t('clueDependencyPlanExpires', { time: new Date(currentPlan.expiresAt).toLocaleString() })}
|
||||
</p>
|
||||
{!currentPlan.installable && (
|
||||
<p className={css.configHint}>
|
||||
{t('clueDependencyInstallUnavailable')}
|
||||
@@ -1366,25 +1319,20 @@ export function SourceConfigPage(props: SourceConfigPageProps) {
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueDependencyPlanSystemInstall')}</span>
|
||||
<span className={css.configValue}>
|
||||
{currentPlan.systemInstall === undefined
|
||||
? t('clueDependencyPlanSystemInstallNone')
|
||||
: (
|
||||
<>
|
||||
<span className={css.configMono}>{currentPlan.systemInstall.executablePath}</span>
|
||||
{currentPlan.systemInstall.version === undefined
|
||||
? ''
|
||||
: ` · ${currentPlan.systemInstall.version}`}
|
||||
{' · '}
|
||||
{currentPlan.systemInstall.compatible
|
||||
? t('clueDependencyPlanSystemInstallCompatible')
|
||||
: t('clueDependencyPlanSystemInstallIncompatible')}
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<FactRow label={t('clueDependencyPlanSystemInstall')} value={currentPlan.systemInstall === undefined
|
||||
? t('clueDependencyPlanSystemInstallNone')
|
||||
: (
|
||||
<>
|
||||
<span className={css.configMono}>{currentPlan.systemInstall.executablePath}</span>
|
||||
{currentPlan.systemInstall.version === undefined
|
||||
? ''
|
||||
: ` · ${currentPlan.systemInstall.version}`}
|
||||
{' · '}
|
||||
{currentPlan.systemInstall.compatible
|
||||
? t('clueDependencyPlanSystemInstallCompatible')
|
||||
: t('clueDependencyPlanSystemInstallIncompatible')}
|
||||
</>
|
||||
)} />
|
||||
</div>
|
||||
</details>
|
||||
<div className={css.configActions}>
|
||||
@@ -1406,17 +1354,14 @@ export function SourceConfigPage(props: SourceConfigPageProps) {
|
||||
)}
|
||||
|
||||
{currentTask !== undefined && currentTask.state !== 'running' && (
|
||||
<div className={css.configRow} data-clue-task={currentTask.taskId}>
|
||||
<span className={css.configLabel}>{t('clueDependencyInstall')}</span>
|
||||
<span className={css.configValue}>
|
||||
{currentTask.state === 'succeeded'
|
||||
? t('tasksStateDone')
|
||||
: currentTask.state === 'cancelled'
|
||||
? t('clueDependencyInstallCancelled')
|
||||
: t('clueDependencyInstallFailed')}
|
||||
{currentTask.error !== undefined && ` — ${currentTask.error.message}`}
|
||||
</span>
|
||||
</div>
|
||||
<FactRow data-clue-task={currentTask.taskId} label={t('clueDependencyInstall')} value={<>
|
||||
{currentTask.state === 'succeeded'
|
||||
? t('tasksStateDone')
|
||||
: currentTask.state === 'cancelled'
|
||||
? t('clueDependencyInstallCancelled')
|
||||
: t('clueDependencyInstallFailed')}
|
||||
{currentTask.error !== undefined && ` — ${currentTask.error.message}`}
|
||||
</>} />
|
||||
)}
|
||||
|
||||
{currentTask !== undefined && currentTask.state === 'running' && currentTask.progress !== undefined && (
|
||||
@@ -1457,47 +1402,29 @@ export function SourceConfigPage(props: SourceConfigPageProps) {
|
||||
// The first explicit read is still in flight. "Not configured" is
|
||||
// a terminal verdict this page has not earned yet (the table's
|
||||
// `checked` rule, applied here too).
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueConnectionAuthorization')}</span>
|
||||
<span className={css.status} data-kind="unchecked">{t(CLUE_SOURCE_STATUS_COPY.unchecked)}</span>
|
||||
</div>
|
||||
<FactRow label={t('clueConnectionAuthorization')}
|
||||
value={<span className={css.status} data-kind="unchecked">{t(CLUE_SOURCE_STATUS_COPY.unchecked)}</span>} />
|
||||
) : connection === undefined ? (
|
||||
// A failed read is NOT "this source was never configured": the
|
||||
// distinction is the whole point of the status surface.
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueConnectionAuthorization')}</span>
|
||||
<span
|
||||
className={css.status}
|
||||
data-kind={connectionReadFailed ? 'request-failed' : 'not-configured'}
|
||||
>
|
||||
<FactRow label={t('clueConnectionAuthorization')} value={
|
||||
<span className={css.status} data-kind={connectionReadFailed ? 'request-failed' : 'not-configured'}>
|
||||
{t(connectionReadFailed
|
||||
? CLUE_SOURCE_STATUS_COPY['request-failed']
|
||||
: CLUE_SOURCE_STATUS_COPY['not-configured'])}
|
||||
</span>
|
||||
</div>
|
||||
} />
|
||||
) : (
|
||||
<>
|
||||
|
||||
<div className={css.configRow} data-stale={connectionReadFailed ? 'true' : undefined}>
|
||||
<span className={css.configLabel}>{t('clueConnectionAuthorization')}</span>
|
||||
{connectionReadFailed ? (
|
||||
// A failed re-read must mark the row itself, even when a
|
||||
// previous projection is still on screen — the old "Ready"
|
||||
// is not the current answer.
|
||||
<span className={css.status} data-kind="request-failed">
|
||||
{t(CLUE_SOURCE_STATUS_COPY['request-failed'])}
|
||||
</span>
|
||||
) : (
|
||||
<span className={css.configValue} data-authorization={connection.authorization}>
|
||||
{t(CONNECTION_AUTHORIZATION_COPY[connection.authorization])}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{/* A failed re-read marks the row itself, even when a previous
|
||||
projection is still on screen: the old "Ready" is not the answer. */}
|
||||
<FactRow data-stale={connectionReadFailed ? 'true' : undefined} label={t('clueConnectionAuthorization')}
|
||||
value={connectionReadFailed
|
||||
? <span className={css.status} data-kind="request-failed">{t(CLUE_SOURCE_STATUS_COPY['request-failed'])}</span>
|
||||
: <span data-authorization={connection.authorization}>{t(CONNECTION_AUTHORIZATION_COPY[connection.authorization])}</span>} />
|
||||
{connection.account !== undefined && (
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueConnectionAccount')}</span>
|
||||
<span className={css.configValue}>{connection.account}</span>
|
||||
</div>
|
||||
<FactRow label={t('clueConnectionAccount')} value={connection.account} />
|
||||
)}
|
||||
{connection.detail !== undefined && <p className={css.configHint}>{connection.detail}</p>}
|
||||
{connection.error !== undefined && <p className={css.configError} role="alert">{connection.error.message}</p>}
|
||||
@@ -1568,25 +1495,14 @@ export function SourceConfigPage(props: SourceConfigPageProps) {
|
||||
{connection.prompt !== undefined && (
|
||||
<div className={css.authPrompt} data-clue-auth-prompt="">
|
||||
{connection.prompt.verificationUrl !== undefined && (
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueConnectionUrl')}</span>
|
||||
<span className={css.configValue}>
|
||||
<a
|
||||
className={css.authLink}
|
||||
href={connection.prompt.verificationUrl}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{connection.prompt.verificationUrl}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<FactRow label={t('clueConnectionUrl')} value={
|
||||
<a className={css.authLink} href={connection.prompt.verificationUrl} target="_blank" rel="noreferrer">
|
||||
{connection.prompt.verificationUrl}
|
||||
</a>
|
||||
} />
|
||||
)}
|
||||
{connection.prompt.userCode !== undefined && (
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueConnectionCode')}</span>
|
||||
<span className={`${css.configValue} ${css.configMono}`}>{connection.prompt.userCode}</span>
|
||||
</div>
|
||||
<FactRow label={t('clueConnectionCode')} mono value={connection.prompt.userCode} />
|
||||
)}
|
||||
{connection.prompt.qr !== undefined && (
|
||||
<div className={css.qrBlock} data-clue-qr={connection.prompt.qr.uri}>
|
||||
@@ -1601,17 +1517,12 @@ export function SourceConfigPage(props: SourceConfigPageProps) {
|
||||
<path d={qrPath} fill="currentColor" />
|
||||
</svg>
|
||||
)}
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueConnectionQrPayload')}</span>
|
||||
<span className={`${css.configValue} ${css.configMono}`}>{connection.prompt.qr.uri}</span>
|
||||
</div>
|
||||
<FactRow label={t('clueConnectionQrPayload')} mono value={connection.prompt.qr.uri} />
|
||||
</div>
|
||||
)}
|
||||
<div className={css.configRow}>
|
||||
<span className={css.configLabel}>{t('clueConnectionExpires', {
|
||||
time: new Date(connection.prompt.expiresAt).toLocaleString(),
|
||||
})}</span>
|
||||
</div>
|
||||
<p className={css.configHint}>
|
||||
{t('clueConnectionExpires', { time: new Date(connection.prompt.expiresAt).toLocaleString() })}
|
||||
</p>
|
||||
{connection.prompt.instructions !== undefined && (
|
||||
<p className={css.configHint}>{connection.prompt.instructions}</p>
|
||||
)}
|
||||
@@ -1620,13 +1531,11 @@ export function SourceConfigPage(props: SourceConfigPageProps) {
|
||||
<details className={css.advanced} data-clue-connection-details open={connection.configuration !== 'ready' || connectionReadFailed}>
|
||||
<summary className={css.advancedSummary}>{t('clueConnectionConfiguration')} · {t('windowReadOnly')}</summary>
|
||||
<div className={css.advancedBody}>
|
||||
<div className={css.configRow} data-stale={connectionReadFailed ? 'true' : undefined}>
|
||||
<span className={css.configLabel}>{t('clueConnectionConfiguration')}</span>
|
||||
{connectionReadFailed ? (
|
||||
// The old projection is kept as LAST-KNOWN context, but it
|
||||
// is no longer the current answer: the row itself says the
|
||||
// read failed instead of presenting a stale "Ready".
|
||||
<span className={css.configValue}>
|
||||
{/* The old projection stays as LAST-KNOWN context, but the row
|
||||
itself says the read failed instead of presenting a stale "Ready". */}
|
||||
<FactRow data-stale={connectionReadFailed ? 'true' : undefined} label={t('clueConnectionConfiguration')}
|
||||
value={connectionReadFailed ? (
|
||||
<>
|
||||
<span className={css.status} data-kind="request-failed">
|
||||
{t(CLUE_SOURCE_STATUS_COPY['request-failed'])}
|
||||
</span>
|
||||
@@ -1634,13 +1543,10 @@ export function SourceConfigPage(props: SourceConfigPageProps) {
|
||||
<span className={css.configHint}>
|
||||
{t('clueConnectionLastKnown')} {configurationCopy(connection.configuration)}
|
||||
</span>
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<span className={css.configValue} data-configuration={connection.configuration}>
|
||||
{configurationCopy(connection.configuration)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<span data-configuration={connection.configuration}>{configurationCopy(connection.configuration)}</span>
|
||||
)} />
|
||||
</div>
|
||||
</details>
|
||||
</>
|
||||
|
||||
@@ -21,31 +21,6 @@
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.sourcesIntro {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.error {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: var(--ds-sidebar-space-2) var(--ds-sidebar-space-3);
|
||||
border: 1px solid var(--dsw-alias-border-l2);
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
background: var(--dsw-alias-bg-layer-1);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.loading {
|
||||
padding: var(--ds-sidebar-space-2) 0;
|
||||
font-size: 12px;
|
||||
@@ -53,14 +28,6 @@
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
}
|
||||
|
||||
.empty {
|
||||
padding: var(--ds-sidebar-space-3) 0;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* Batch controls: a scope line plus the four explicit actions. */
|
||||
.batchBar {
|
||||
display: flex;
|
||||
@@ -155,13 +122,6 @@
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.sourceId {
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* Derived state badge: neutral by default, warning tint for actionable faults. */
|
||||
.status {
|
||||
display: inline-flex;
|
||||
@@ -318,15 +278,6 @@
|
||||
}
|
||||
|
||||
/* The local pack library: same row geometry, no source switch. */
|
||||
.packsRow {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-2) var(--ds-sidebar-space-3);
|
||||
min-width: 0;
|
||||
padding: var(--ds-sidebar-space-3) 0;
|
||||
border-top: 1px solid var(--dsw-alias-border-l1);
|
||||
}
|
||||
|
||||
.addSource {
|
||||
display: flex;
|
||||
@@ -336,15 +287,6 @@
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.addSourceDesc {
|
||||
flex: 1 1 220px;
|
||||
min-width: 0;
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* ── Source configuration window body (S6 window content) ───────────────── */
|
||||
|
||||
.config {
|
||||
@@ -384,29 +326,6 @@
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
}
|
||||
|
||||
.configRow {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: var(--ds-sidebar-space-1) var(--ds-sidebar-space-3);
|
||||
min-width: 0;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.configLabel {
|
||||
flex: none;
|
||||
min-width: 72px;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
}
|
||||
|
||||
.configValue {
|
||||
flex: 1 1 180px;
|
||||
min-width: 0;
|
||||
color: var(--dsw-alias-label-primary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.configMono {
|
||||
font-family: var(--ds-font-family-code, monospace);
|
||||
font-size: 11px;
|
||||
@@ -592,17 +511,12 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.configLabel {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.advancedRow {
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
.configSection + .configSection { padding-top: var(--ds-sidebar-space-2); }
|
||||
.sourceId { font-family: var(--ds-font-family-code, monospace); }
|
||||
@media (pointer: coarse) {
|
||||
.smallButton,
|
||||
.configInput,
|
||||
@@ -627,7 +541,6 @@
|
||||
@media (pointer: coarse) { .permissionChoice { min-height: 44px; } }
|
||||
|
||||
@container sidebar-clue-config (max-width: 480px) {
|
||||
.configLabel { min-width: 0; }
|
||||
.configInputRow { align-items: stretch; }
|
||||
.configInput { flex-basis: 100%; }
|
||||
.permissionGrid { grid-template-columns: 1fr; }
|
||||
|
||||
@@ -24,7 +24,7 @@ import { FileTypeIcon, IconLinkOutlineRegular } from '@deepseek-ai/dsh-client-ui
|
||||
import { BUILTIN_SOURCE_IDS } from '../../../clues/types.ts'
|
||||
import { CluePackArtwork } from '../artwork.tsx'
|
||||
import { LoadingIndicator } from '../../ui/LoadingIndicator.tsx'
|
||||
import { ActionButton, ToggleSwitch } from '../../ui/index.ts'
|
||||
import { ActionButton, EmptyState, ErrorBlock, ToggleSwitch } from '../../ui/index.ts'
|
||||
import { t, type CopyKey } from '../../locales.ts'
|
||||
import {
|
||||
isCluePacksMentionEnabled,
|
||||
@@ -211,21 +211,11 @@ export function ClueSourcesPanel(props: ClueSourcesPanelProps) {
|
||||
<div className={css.sources}>
|
||||
|
||||
{error !== null && (
|
||||
<div className={css.error} role="alert">
|
||||
<span>{t('clueSourcesLoadFailed')} {error}</span>
|
||||
<ActionButton variant="outline" type="button" className={css.smallButton} onClick={props.onReload}>
|
||||
{t('retry')}
|
||||
</ActionButton>
|
||||
</div>
|
||||
<ErrorBlock message={t('clueSourcesLoadFailed')} detail={error} retryLabel={t('retry')} onRetry={props.onReload} />
|
||||
)}
|
||||
|
||||
{statusError !== null && (
|
||||
<div className={css.error} role="alert">
|
||||
<span>{t('clueStateRequestFailed')} {statusError}</span>
|
||||
<ActionButton variant="outline" type="button" className={css.smallButton} onClick={props.onReload}>
|
||||
{t('retry')}
|
||||
</ActionButton>
|
||||
</div>
|
||||
<ErrorBlock message={t('clueStateRequestFailed')} detail={statusError} retryLabel={t('retry')} onRetry={props.onReload} />
|
||||
)}
|
||||
|
||||
{loading && !catalogueLoaded ? (
|
||||
@@ -245,7 +235,7 @@ export function ClueSourcesPanel(props: ClueSourcesPanelProps) {
|
||||
<LoadingIndicator className={css.loading} />
|
||||
) : catalogueLoaded ? (
|
||||
sources.length === 0 && configuredOnly.length === 0
|
||||
? <div className={css.empty}>{t('clueSourcesEmpty')}</div>
|
||||
? <EmptyState title={t('clueSourcesEmpty')} />
|
||||
: (
|
||||
<ul className={css.sourceList} aria-label={t('settingsGroupSources')}>
|
||||
{sources.map(source => {
|
||||
|
||||
@@ -24,10 +24,12 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* A long value wraps under its label instead of squeezing it. */
|
||||
.factRow {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
gap: var(--ds-sidebar-space-1) var(--ds-sidebar-space-3);
|
||||
min-width: 0;
|
||||
padding: 3px 0;
|
||||
font: var(--dsw-font-xxs-12);
|
||||
@@ -35,15 +37,19 @@
|
||||
|
||||
.factLabel {
|
||||
flex: none;
|
||||
min-width: 72px;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
}
|
||||
|
||||
.factValue {
|
||||
flex: 1 1 160px;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--dsw-alias-label-primary);
|
||||
}
|
||||
|
||||
.factAction { flex: none; }
|
||||
|
||||
/* One ink rung per fact tone; a default fact stays secondary. */
|
||||
.factRow[data-tone='error'] .factValue { color: var(--dsw-alias-state-error-primary); }
|
||||
.factRow[data-tone='warn'] .factValue { color: var(--dsw-alias-state-warn-primary); }
|
||||
|
||||
@@ -50,11 +50,13 @@ export interface Fact {
|
||||
}
|
||||
|
||||
/** Props of {@link FactRow}. */
|
||||
export interface FactRowProps {
|
||||
readonly label?: string
|
||||
export interface FactRowProps extends DataAttributes {
|
||||
readonly label?: ReactNode
|
||||
readonly value: ReactNode
|
||||
readonly mono?: boolean
|
||||
readonly tone?: PatternTone
|
||||
/** One trailing control that acts on this fact (clear, copy). */
|
||||
readonly action?: ReactNode
|
||||
readonly className?: string
|
||||
}
|
||||
|
||||
@@ -66,11 +68,12 @@ export interface FactRowProps {
|
||||
* would fight the surrounding semantics. The label/value pair is readable in
|
||||
* order either way.
|
||||
*/
|
||||
export function FactRow({ label, value, mono, tone, className }: FactRowProps): ReactNode {
|
||||
export function FactRow({ label, value, mono, tone, action, className, ...dataProps }: FactRowProps): ReactNode {
|
||||
return (
|
||||
<div className={clsx(css.factRow, className)} {...(tone === undefined ? {} : { 'data-tone': tone })}>
|
||||
<div {...dataProps} className={clsx(css.factRow, className)} {...(tone === undefined ? {} : { 'data-tone': tone })}>
|
||||
{label !== undefined && <span className={css.factLabel}>{label}</span>}
|
||||
<span className={clsx(css.factValue, mono === true && css.mono)}>{value}</span>
|
||||
{action !== undefined && <span className={css.factAction}>{action}</span>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ beforeAll(() => {
|
||||
const SECTION_SHEET = readFileSync(resolve(process.cwd(), 'src/client/SideCardSection.module.css'), 'utf8')
|
||||
const KIT_SHEET = readFileSync(resolve(process.cwd(), 'src/client/ui/kit.module.css'), 'utf8')
|
||||
const CLUE_SHEET = readFileSync(resolve(process.cwd(), 'src/client/clues/settings/settings.module.css'), 'utf8')
|
||||
const PATTERN_SHEET = readFileSync(resolve(process.cwd(), 'src/client/ui/patterns.module.css'), 'utf8')
|
||||
|
||||
function ruleBody(sheet: string, selector: string): string | undefined {
|
||||
return new RegExp(`${selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*\\{([^}]*?)\\}`).exec(sheet)?.[1]
|
||||
@@ -53,7 +54,8 @@ describe('grouped settings layout', () => {
|
||||
for (const selector of ['.settingsShell', '.groupPane']) expect(ruleBody(SECTION_SHEET, selector)).toContain('min-width: 0')
|
||||
expect(ruleBody(CLUE_SHEET, '.sources')).toContain('container: sidebar-clue-sources / inline-size')
|
||||
expect(ruleBody(CLUE_SHEET, '.sourceRow')).toContain('flex-wrap: wrap')
|
||||
for (const selector of ['.sourceName', '.sourceId', '.configValue']) expect(ruleBody(CLUE_SHEET, selector)).toContain('overflow-wrap: anywhere')
|
||||
expect(ruleBody(CLUE_SHEET, '.sourceName')).toContain('overflow-wrap: anywhere')
|
||||
expect(ruleBody(PATTERN_SHEET, '.factValue')).toContain('overflow-wrap: anywhere')
|
||||
const narrow = containerBlock(CLUE_SHEET, 'sidebar-clue-sources', 420)
|
||||
expect(narrow).toMatch(/\.sourceIdentity\s*\{[^}]*flex-basis: 100%;/)
|
||||
expect(narrow).toMatch(/\.sourceControls\s*\{[^}]*width: 100%;/)
|
||||
|
||||
Reference in new issue
Block a user