Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

refactor(components): rename InfoRow to Info and switch update dialog to AlertDialog

hairyf82dd03d23534
diff --git a/src/components/config-core.tsx b/src/components/config-core.tsx
index 7cba8ae6..b164a387 100644
--- a/src/components/config-core.tsx
+++ b/src/components/config-core.tsx
@@ -264,7 +264,7 @@ export function ConfigCore() {
onRemove(core)
}}
>
- <If cond={busyId === core.id} then={<Spinner size="sm" color="current" />} />
+ <If cond={busyId === core.id && busy} then={<Spinner size="sm" color="current" />} />
{t('core.uninstall')}
</Button>
</If>
diff --git a/src/components/config-debug.tsx b/src/components/config-debug.tsx
index 01e1c78c..a33df275 100644
--- a/src/components/config-debug.tsx
+++ b/src/components/config-debug.tsx
@@ -8,7 +8,7 @@ import { If } from 'react-if-lite'
import { useStore } from 'valtio-define'
import { store } from '@/store'
import { toast } from '@/utils'
-import { InfoRow } from './info-row'
+import { Info } from './info'
export interface RuntimeInfo {
app_version: string
@@ -189,8 +189,8 @@ export function ConfigDebug() {
<div className="border-t border-line/30" />
<div>
<div className="space-y-1">
- <InfoRow term={t('ui.current_version')}>{info?.app_version ?? '-'}</InfoRow>
- <InfoRow term={t('ui.dsh_version')}>
+ <Info term={t('ui.current_version')}>{info?.app_version ?? '-'}</Info>
+ <Info term={t('ui.dsh_version')}>
<span>{info?.dsh_version ?? '-'}</span>
<If cond={updateInfo}>
<Link className="ml-2 text-[10px] text-accent" onClick={store.harnessUpdater.showToast}>
@@ -199,11 +199,11 @@ export function ConfigDebug() {
</Link>
</If>
- </InfoRow>
- <InfoRow term={t('ui.node_version')}>{info?.node_version ? `v${info.node_version}` : '-'}</InfoRow>
- <InfoRow term="Platform">
+ </Info>
+ <Info term={t('ui.node_version')}>{info?.node_version ? `v${info.node_version}` : '-'}</Info>
+ <Info term="Platform">
{info ? `${info.platform} / ${info.arch}` : '-'}
- </InfoRow>
+ </Info>
<div className="flex items-center justify-between gap-2 text-xs">
<span className="shrink-0 min-w-[30%] text-muted font-medium">{t('ui.data_dir')}</span>
<span className="min-w-0 flex items-center gap-1">
diff --git a/src/components/desktop-about-dialog.tsx b/src/components/desktop-about-dialog.tsx
index 59134793..7a40244d 100644
--- a/src/components/desktop-about-dialog.tsx
+++ b/src/components/desktop-about-dialog.tsx
@@ -7,7 +7,7 @@ import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import { useStore } from 'valtio-define'
import { store } from '@/store'
-import { InfoRow } from './info-row'
+import { Info } from './info'
export interface DesktopAboutDialogProps extends PropsWithOverlays {}
@@ -45,8 +45,8 @@ export function DesktopAboutDialog(props: DesktopAboutDialogProps) {
</Description>
</div>
<div className="space-y-1.5 border-t border-line/40 pt-3">
- <InfoRow term={t('ui.current_version')}>{about?.version ?? '-'}</InfoRow>
- <InfoRow term={t('about.release_date')}>{about?.published_at ? formatDate(about.published_at) : '-'}</InfoRow>
+ <Info term={t('ui.current_version')}>{about?.version ?? '-'}</Info>
+ <Info term={t('about.release_date')}>{about?.published_at ? formatDate(about.published_at) : '-'}</Info>
<div className="flex items-center justify-between text-sm border-t border-line/40 pt-2 ">
<span className="text-muted">{t('about.source_code')}</span>
<Button
diff --git a/src/components/desktop-update-dialog.tsx b/src/components/desktop-update-dialog.tsx
index 6a178c9c..f1accfe7 100644
--- a/src/components/desktop-update-dialog.tsx
+++ b/src/components/desktop-update-dialog.tsx
@@ -1,13 +1,13 @@
import type { PropsWithOverlays } from '@overlastic/react'
import { useWatch } from '@hairy/react-lib'
-import { Button, Description, Modal, ProgressBar } from '@heroui/react'
+import { AlertDialog, Button, Description, ProgressBar } from '@heroui/react'
import { useDisclosure } from '@overlastic/react'
import { useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { If } from 'react-if-lite'
import { useStore } from 'valtio-define'
import { store } from '@/store'
-import { InfoRow } from './info-row'
+import { Info } from './info'
export interface DesktopUpdateDialogProps extends PropsWithOverlays {}
@@ -47,19 +47,20 @@ export function DesktopUpdateDialog(props: DesktopUpdateDialogProps) {
}
return (
- <Modal isOpen={disclosure.visible} onOpenChange={disclosure.cancel}>
- <Modal.Backdrop isDismissable={!downloading}>
- <Modal.Container size="sm">
- <Modal.Dialog>
- <Modal.Header>
- <Modal.Heading>{t('update.desktop_title')}</Modal.Heading>
- <Modal.CloseTrigger isDisabled={downloading} />
- </Modal.Header>
- <Modal.Body className="space-y-3">
+ <AlertDialog onOpenChange={disclosure.cancel} isOpen={disclosure.visible}>
+ <AlertDialog.Backdrop isDismissable={!downloading}>
+ <AlertDialog.Container>
+ <AlertDialog.Dialog className="sm:max-w-[420px]">
+ <AlertDialog.CloseTrigger isDisabled={downloading} />
+ <AlertDialog.Header>
+ <AlertDialog.Icon status="default" />
+ <AlertDialog.Heading>{t('update.desktop_title')}</AlertDialog.Heading>
+ </AlertDialog.Header>
+ <AlertDialog.Body className="space-y-3">
<If cond={updateInfo != null}>
<div className="space-y-1.5">
- <InfoRow term={t('ui.current_version')}>{updateInfo?.currentVersion}</InfoRow>
- <InfoRow term={t('update.new_version_label')}>{updateInfo?.version}</InfoRow>
+ <Info term={t('ui.current_version')}>{updateInfo?.currentVersion}</Info>
+ <Info term={t('update.new_version_label')}>{updateInfo?.version}</Info>
<If cond={updateInfo?.downloaded}>
<Description className="text-xs">
{t('update.desktop_downloaded')}
@@ -84,8 +85,8 @@ export function DesktopUpdateDialog(props: DesktopUpdateDialogProps) {
</ProgressBar>
</div>
</If>
- </Modal.Body>
- <Modal.Footer>
+ </AlertDialog.Body>
+ <AlertDialog.Footer>
<Button
variant="tertiary"
className="rounded-md"
@@ -104,10 +105,10 @@ export function DesktopUpdateDialog(props: DesktopUpdateDialogProps) {
? t('update.open_installer')
: t('update.now')}
</Button>
- </Modal.Footer>
- </Modal.Dialog>
- </Modal.Container>
- </Modal.Backdrop>
- </Modal>
+ </AlertDialog.Footer>
+ </AlertDialog.Dialog>
+ </AlertDialog.Container>
+ </AlertDialog.Backdrop>
+ </AlertDialog>
)
}
diff --git a/src/components/info-row.tsx b/src/components/info.tsx
similarity index 88%
rename from src/components/info-row.tsx
rename to src/components/info.tsx
index 50832adb..e3abdacc 100644
--- a/src/components/info-row.tsx
+++ b/src/components/info.tsx
@@ -6,7 +6,7 @@ import { cn } from 'tailwind-variants'
* 供 config-debug 的运行时信息与「关于 / 检查更新」对话框共用,
* 值默认用等宽字体(版本号/路径等类代码内容)。
*/
-export interface InfoRowProps {
+export interface InfoProps {
/** 左侧项名 */
term: string
/** 右侧值(可为节点;无则显示 '-' 由调用方决定) */
@@ -14,7 +14,7 @@ export interface InfoRowProps {
className?: string
}
-export function InfoRow({ term, children, className }: InfoRowProps) {
+export function Info({ term, children, className }: InfoProps) {
return (
<div className={cn('flex items-center justify-between gap-2 text-xs py-0.5', className)}>
<span className="shrink-0 text-muted font-medium">{term}</span>