mirror of
https://ghproxy.cflmy.top/https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-11-29 08:39:35 +08:00
fix(cua): unify helper-unavailable notice box and primary-ink warning titles
This commit is contained in:
1 parent
49b2d29be5
commit
72257d2bb2
2 files changed
+26
-47
No files matched your search
@@ -3,21 +3,23 @@
|
||||
.guidance { display: grid; gap: 12px; overflow-wrap: anywhere; }
|
||||
.panelGuidance { margin-bottom: 12px; }
|
||||
.guidance p, .panel p { margin: 0; color: var(--dsw-alias-label-secondary); line-height: 1.6; }
|
||||
.caution {
|
||||
.caution, .dangerNotice {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: var(--dsw-radius-md);
|
||||
background: var(--dsw-alias-state-warn-tertiary);
|
||||
}
|
||||
.dangerNotice {
|
||||
.caution { background: var(--dsw-alias-state-warn-tertiary); }
|
||||
.dangerNotice { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 8%, transparent); }
|
||||
.noticeMain {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
border-radius: var(--dsw-radius-md);
|
||||
background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 8%, transparent);
|
||||
flex: 1;
|
||||
min-width: 180px;
|
||||
}
|
||||
.cautionIcon {
|
||||
display: inline-flex;
|
||||
@@ -36,31 +38,12 @@
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.cautionBody .cautionTitle {
|
||||
color: var(--dsw-alias-label-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
.cautionBody .dangerTitle {
|
||||
color: var(--dsw-alias-state-error-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
.systemError {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: var(--dsw-radius-md);
|
||||
background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 8%, transparent);
|
||||
}
|
||||
.systemErrorBody {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
flex: 1;
|
||||
min-width: 180px;
|
||||
}
|
||||
.card { min-width: 0; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-md); }
|
||||
.card > * + * { border-top: 0.5px solid var(--dsw-alias-border-l3); }
|
||||
.panel h3 { margin: 0; font-size: 14px; font-weight: 500; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Native permission status and revocable application consent on the existing plugin page. */
|
||||
import { useEffect } from 'react'
|
||||
import { useEffect, type ReactNode } from 'react'
|
||||
import { Button, IconLayersOutlineRegular, IconSettingsOutlineRegular, IconWarningOutlineRegular, Modal, Toast } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import { assertNever } from '@deepseek-ai/dsh-util-values'
|
||||
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
@@ -85,19 +85,23 @@ function UnknownStatus({ loading, t }: Pick<PermissionProps, 't'> & { loading: b
|
||||
})
|
||||
}
|
||||
|
||||
function NoticeBox({ tone, role, title, body }: {
|
||||
function NoticeBox({ tone, role, title, body, action }: {
|
||||
tone: 'warn' | 'danger'
|
||||
role: 'note' | 'alert'
|
||||
title: string
|
||||
body: string
|
||||
action?: ReactNode
|
||||
}) {
|
||||
const danger = tone === 'danger'
|
||||
return <div className={danger ? css.dangerNotice : css.caution} role={role}>
|
||||
<span className={danger ? css.dangerIcon : css.cautionIcon} aria-hidden="true"><IconWarningOutlineRegular size={14} /></span>
|
||||
<div className={css.cautionBody}>
|
||||
<p className={danger ? css.dangerTitle : css.cautionTitle}>{title}</p>
|
||||
<p>{body}</p>
|
||||
<div className={css.noticeMain}>
|
||||
<span className={danger ? css.dangerIcon : css.cautionIcon} aria-hidden="true"><IconWarningOutlineRegular size={14} /></span>
|
||||
<div className={css.cautionBody}>
|
||||
<p className={css.cautionTitle}>{title}</p>
|
||||
<p>{body}</p>
|
||||
</div>
|
||||
</div>
|
||||
{action}
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -107,13 +111,9 @@ function WindowsGuidance({ system, error, busy, refresh, t }: Pick<PermissionPro
|
||||
busy: boolean
|
||||
}) {
|
||||
return <div className={css.guidance} data-cua-guidance>
|
||||
{error !== null && <div className={css.systemError} role="alert">
|
||||
<div className={css.systemErrorBody}>
|
||||
<p className={css.error}>{t('windowsHelperFailed', { message: error })}</p>
|
||||
<p>{t('queryFailedHint')}</p>
|
||||
</div>
|
||||
<Button size="sm" variant="outline" disabled={busy} onClick={refresh}>{t('retry')}</Button>
|
||||
</div>}
|
||||
{error !== null && <NoticeBox tone="danger" role="alert"
|
||||
title={t('windowsHelperFailed', { message: error })} body={t('queryFailedHint')}
|
||||
action={<Button size="sm" variant="outline" disabled={busy} onClick={refresh}>{t('retry')}</Button>} />}
|
||||
{error === null && system !== null && <>
|
||||
{system.sessionLocked === true && <NoticeBox tone="danger" role="alert"
|
||||
title={t('windowsLockedTitle')} body={t('windowsLockedBody')} />}
|
||||
@@ -167,13 +167,9 @@ export function PermissionPanel(props: PermissionProps) {
|
||||
<p>{t('ptcRecommendation')}</p>
|
||||
</div>
|
||||
<h3>{t('title')}</h3>
|
||||
{state.system.error !== null && <div className={css.systemError} role="alert">
|
||||
<div className={css.systemErrorBody}>
|
||||
<p className={css.error}>{t('queryFailed', { message: state.system.error })}</p>
|
||||
<p>{t('queryFailedHint')}</p>
|
||||
</div>
|
||||
<Button size="sm" variant="outline" disabled={busy} onClick={refresh}>{t('retry')}</Button>
|
||||
</div>}
|
||||
{state.system.error !== null && <NoticeBox tone="danger" role="alert"
|
||||
title={t('queryFailed', { message: state.system.error })} body={t('queryFailedHint')}
|
||||
action={<Button size="sm" variant="outline" disabled={busy} onClick={refresh}>{t('retry')}</Button>} />}
|
||||
{(observed !== null || state.system.error === null) && <p
|
||||
className={observed === null ? css.pendingHint : undefined}
|
||||
aria-hidden={observed === null || undefined}
|
||||
|
||||
Reference in new issue
Block a user