feat(webui): unify dialog feedback
Move confirmations, editors, and help surfaces onto one consistent interaction model. Preserve accessible focus handling while making destructive and in-progress actions clearer.
This commit is contained in:
13 files changed
+805
-608
No files matched your search
@@ -1,10 +1,10 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { motion } from 'motion/react';
|
||||
import { ArrowRight, KeyRound, Sparkles } from 'lucide-react';
|
||||
import { Modal } from '@/components/interior/modal';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { ToggleSwitch } from '@/components/ui/toggle-switch';
|
||||
import { PasswordVisibilityIcon } from '@/components/ui/password-visibility-icon';
|
||||
import { ThemeToggle } from '@/components/theme-toggle';
|
||||
@@ -175,15 +175,15 @@ export function LoginPage({ onLogin }: LoginPageProps) {
|
||||
</motion.button>
|
||||
</motion.div>
|
||||
|
||||
<Dialog open={helpOpen} onOpenChange={setHelpOpen}>
|
||||
<DialogContent className="max-w-sm rounded-2xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>界面有点卡顿?</DialogTitle>
|
||||
<DialogDescription>
|
||||
登录页背景是一个跟随鼠标的动态线条效果,在部分设备上可能比较吃性能。可以在这里关掉它——该开关仅作用于本设备的登录页,与系统的动效设置相互独立。
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<Modal
|
||||
open={helpOpen}
|
||||
onClose={() => setHelpOpen(false)}
|
||||
title="界面有点卡顿?"
|
||||
description="登录页背景是一个跟随鼠标的动态线条效果,在部分设备上可能比较吃性能。可以在这里关掉它——该开关仅作用于本设备的登录页,与系统的动效设置相互独立。"
|
||||
closeLabel="关闭性能设置弹窗"
|
||||
maxWidth={384}
|
||||
>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex items-center justify-between gap-4 rounded-xl border bg-muted/30 px-4 py-3">
|
||||
<div className="min-w-0">
|
||||
<p className="text-sm font-medium">登录页动态背景</p>
|
||||
@@ -195,8 +195,8 @@ export function LoginPage({ onLogin }: LoginPageProps) {
|
||||
<p className="text-xs leading-relaxed text-muted-foreground">
|
||||
登录后,你还可以在「系统设置 → 无障碍」里进一步「减弱动效」或「关闭全部动效」。
|
||||
</p>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import { ScrollArea } from '@/components/ui/scroll-area';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { SkeletonSwap } from '@/components/interior/skeleton-swap';
|
||||
import { Modal } from '@/components/interior/modal';
|
||||
import { cn, formatBytes, formatUptime } from '@/lib/utils';
|
||||
import type { AppPath } from '@/router';
|
||||
import type {
|
||||
@@ -36,7 +37,6 @@ import {
|
||||
type AccountConfig, type AlertsConfig, type ConnectionsConfig, type HostConfig,
|
||||
type LinkConfig, type NoteConfig, type SessionsConfig,
|
||||
} from '@/lib/dashboard-layout';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { DashboardGrid, WIDGET_DRAG_TYPE, type GridCoord } from '@/components/pages/dashboard-grid';
|
||||
import {
|
||||
AccountConfigForm, AlertsConfigForm, ConnectionsConfigForm, HostConfigForm,
|
||||
@@ -212,11 +212,14 @@ export function OverviewPage() {
|
||||
/>
|
||||
)}
|
||||
|
||||
<Dialog open={!!configId} onOpenChange={(o) => { if (!o) setConfigId(null); }}>
|
||||
<DialogContent className="max-w-sm">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{configBlock ? `${widgetLabel(configBlock.id)} · 设置` : '设置'}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<Modal
|
||||
open={!!configId}
|
||||
onClose={() => setConfigId(null)}
|
||||
title={configBlock ? `${widgetLabel(configBlock.id)} · 设置` : '设置'}
|
||||
closeLabel="关闭卡片设置弹窗"
|
||||
maxWidth={384}
|
||||
>
|
||||
<div className="flex flex-col gap-4">
|
||||
{configBlock?.id === 'alerts' && <AlertsConfigForm config={configBlock.config} onChange={(c) => setBlockConfig('alerts', c)} />}
|
||||
{configBlock?.id === 'sessions' && <SessionsConfigForm config={configBlock.config} onChange={(c) => setBlockConfig('sessions', c)} />}
|
||||
{configBlock?.id === 'host' && <HostConfigForm config={configBlock.config} onChange={(c) => setBlockConfig('host', c)} />}
|
||||
@@ -224,8 +227,8 @@ export function OverviewPage() {
|
||||
{configBlock?.id === 'note' && <NoteConfigForm config={configBlock.config} onChange={(c) => setBlockConfig('note', c)} />}
|
||||
{configBlock?.id === 'link' && <LinkConfigForm config={configBlock.config} onChange={(c) => setBlockConfig('link', c)} />}
|
||||
{configBlock?.id === 'account' && <AccountConfigForm config={configBlock.config} onChange={(c) => setBlockConfig('account', c)} />}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user