mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-22 21:27:11 +08:00
- 重构工具中心为侧边分组导航,固定弹窗高度并支持内部滚动 - 新增通用可拖拽可缩放 Modal,统一主要弹窗打开体验 - 为工具中心内嵌入口补充返回上一步交互与底部操作区 - 补充多语言文案和工具中心/Modal/i18n 回归测试
137 lines
3.8 KiB
TypeScript
137 lines
3.8 KiB
TypeScript
import Modal from './common/ResizableDraggableModal';
|
|
import { Button } from 'antd';
|
|
import { SafetyCertificateOutlined } from '@ant-design/icons';
|
|
import type { CSSProperties } from 'react';
|
|
|
|
import type { OverlayWorkbenchTheme } from '../utils/overlayWorkbenchTheme';
|
|
import {
|
|
SECURITY_UPDATE_ACTION_BUTTON_CLASS,
|
|
SECURITY_UPDATE_MODAL_CLASS,
|
|
getSecurityUpdateActionButtonStyle,
|
|
getSecurityUpdateShellSurfaceStyle,
|
|
} from '../utils/securityUpdateVisuals';
|
|
import { useI18n } from '../i18n/provider';
|
|
|
|
interface SecurityUpdateIntroModalProps {
|
|
open: boolean;
|
|
loading?: boolean;
|
|
darkMode: boolean;
|
|
overlayTheme: OverlayWorkbenchTheme;
|
|
surfaceOpacity?: number;
|
|
onStart: () => void;
|
|
onPostpone: () => void;
|
|
onViewDetails: () => void;
|
|
}
|
|
|
|
const actionButtonStyle: CSSProperties = {
|
|
...getSecurityUpdateActionButtonStyle(),
|
|
height: 38,
|
|
paddingInline: 18,
|
|
};
|
|
|
|
const SecurityUpdateIntroModal = ({
|
|
open,
|
|
loading = false,
|
|
darkMode,
|
|
overlayTheme,
|
|
surfaceOpacity = 1,
|
|
onStart,
|
|
onPostpone,
|
|
onViewDetails,
|
|
}: SecurityUpdateIntroModalProps) => {
|
|
const { t } = useI18n();
|
|
|
|
return (
|
|
<Modal
|
|
rootClassName={SECURITY_UPDATE_MODAL_CLASS}
|
|
title={(
|
|
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 12 }}>
|
|
<div
|
|
style={{
|
|
width: 38,
|
|
height: 38,
|
|
borderRadius: 12,
|
|
display: 'grid',
|
|
placeItems: 'center',
|
|
background: overlayTheme.iconBg,
|
|
color: overlayTheme.iconColor,
|
|
fontSize: 18,
|
|
flexShrink: 0,
|
|
}}
|
|
>
|
|
<SafetyCertificateOutlined />
|
|
</div>
|
|
<div>
|
|
<div style={{ fontSize: 16, fontWeight: 800, color: overlayTheme.titleText }}>
|
|
{t('security_update.intro.title')}
|
|
</div>
|
|
<div style={{ marginTop: 3, color: overlayTheme.mutedText, fontSize: 12 }}>
|
|
{t('security_update.intro.subtitle')}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
open={open}
|
|
closable={!loading}
|
|
maskClosable={!loading}
|
|
keyboard={!loading}
|
|
onCancel={onPostpone}
|
|
width={560}
|
|
styles={{
|
|
content: getSecurityUpdateShellSurfaceStyle(overlayTheme, surfaceOpacity),
|
|
header: { background: 'transparent', borderBottom: 'none', paddingBottom: 8 },
|
|
body: { paddingTop: 8 },
|
|
footer: { background: 'transparent', borderTop: 'none', paddingTop: 10 },
|
|
}}
|
|
footer={[
|
|
<Button
|
|
key="details"
|
|
className={SECURITY_UPDATE_ACTION_BUTTON_CLASS}
|
|
type="primary"
|
|
ghost
|
|
style={actionButtonStyle}
|
|
onClick={onViewDetails}
|
|
disabled={loading}
|
|
>
|
|
{t('security_update.intro.action.details')}
|
|
</Button>,
|
|
<Button
|
|
key="later"
|
|
className={SECURITY_UPDATE_ACTION_BUTTON_CLASS}
|
|
type="primary"
|
|
ghost
|
|
style={actionButtonStyle}
|
|
onClick={onPostpone}
|
|
disabled={loading}
|
|
>
|
|
{t('security_update.intro.action.later')}
|
|
</Button>,
|
|
<Button
|
|
key="start"
|
|
className={SECURITY_UPDATE_ACTION_BUTTON_CLASS}
|
|
type="primary"
|
|
style={actionButtonStyle}
|
|
loading={loading}
|
|
onClick={onStart}
|
|
>
|
|
{t('security_update.intro.action.start_now')}
|
|
</Button>,
|
|
]}
|
|
>
|
|
<div
|
|
style={{
|
|
padding: '12px 0 6px',
|
|
color: darkMode ? 'rgba(255,255,255,0.82)' : '#2f3b52',
|
|
lineHeight: 1.8,
|
|
fontSize: 14,
|
|
}}
|
|
>
|
|
{t('security_update.intro.description')}
|
|
</div>
|
|
</Modal>
|
|
);
|
|
};
|
|
|
|
export type { SecurityUpdateIntroModalProps };
|
|
export default SecurityUpdateIntroModal;
|