c039475119
* docs: 添加组件文档注释和类型导入 refactor: 统一使用 SnackbarOptions 类型 style: 优化导入语句顺序和格式 * refactor: 简化假数据生成器中的faker导入和使用 Co-authored-by: Copilot <copilot@github.com> * feat(form-recognizer): 增强表单识别功能并优化UI交互 - 新增字段类型偏好设置功能,支持按域名保存字段类型 - 重构FieldList组件,改进字段选择和类型修改体验 - 添加字段定位闪烁功能,便于在页面上快速找到对应字段 - 优化表单填充逻辑,支持单个字段覆盖默认填充模式 - 移除独立的侧边栏页面,统一使用主页面组件 - 改进useStorageState钩子,增加加载状态管理和防抖处理 * refactor: 移除未使用的组件文件 * refactor(页面头部): 提取通用 PageHeader 组件并替换各页面头部实现 重构各页面头部为统一的 PageHeader 组件,提高代码复用性和维护性 * style(组件): 调整自动刷新开关和存储选项网格的样式 优化自动刷新开关的文本内边距,重构存储选项网格的布局结构,调整间距和边框样式 * style(ui): 调整时间戳页面和结果视图的样式 - 为时区选择器添加圆角 - 优化结果视图的布局和对齐方式 - 调整结果项的内边距和文本样式 * ci(workflow): 移除Firefox测试以简化CI流程 仅保留Chrome浏览器的构建步骤,减少CI运行时间和资源消耗
65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
import { Box, Stack, Container, CircularProgress } from '@mui/material';
|
|
import QrCodeIcon from '@mui/icons-material/QrCode';
|
|
import GlobalSnackbar, { useSnackbar } from '@/components/GlobalSnackbar';
|
|
import UrlToQrCodeSection from '@/components/UrlToQrCodeSection';
|
|
import QrCodeToUrlSection from '@/components/QrCodeToUrlSection';
|
|
import { useStorageState } from '@/utils/useStorageState';
|
|
import { dashboardPageStyles } from '@/config/pageTheme';
|
|
import PageHeader from '@/components/PageHeader';
|
|
|
|
const QrCodePage = () => {
|
|
const { snackbarProps, showMessage } = useSnackbar({ autoHideDuration: 1500 });
|
|
|
|
// 使用自定义钩子管理展开状态
|
|
const [urlExpanded, setUrlExpanded, urlInitialized] = useStorageState('qrCode/urlExpanded', true);
|
|
const [qrExpanded, setQrExpanded, qrInitialized] = useStorageState('qrCode/qrExpanded', false);
|
|
|
|
// 初始化未完成时显示加载状态
|
|
if (!urlInitialized || !qrInitialized) {
|
|
return (
|
|
<Container
|
|
sx={{
|
|
py: 4,
|
|
maxWidth: 400,
|
|
display: 'flex',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
minHeight: 200,
|
|
}}
|
|
>
|
|
<CircularProgress />
|
|
</Container>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Box sx={{ minHeight: '100%', pb: 3, bgcolor: dashboardPageStyles.backgroundColor }}>
|
|
<Container sx={{ py: 2, maxWidth: 400, bgcolor: dashboardPageStyles.backgroundColor }}>
|
|
<PageHeader
|
|
title="二维码工具"
|
|
subtitle="生成和解析二维码"
|
|
icon={<QrCodeIcon />}
|
|
sx={{ mb: 2.5 }}
|
|
/>
|
|
|
|
<Stack spacing={3}>
|
|
<UrlToQrCodeSection
|
|
expanded={urlExpanded}
|
|
onExpandedChange={setUrlExpanded}
|
|
showMessage={showMessage}
|
|
/>
|
|
|
|
<QrCodeToUrlSection
|
|
expanded={qrExpanded}
|
|
onExpandedChange={setQrExpanded}
|
|
showMessage={showMessage}
|
|
/>
|
|
</Stack>
|
|
<GlobalSnackbar {...snackbarProps} />
|
|
</Container>
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
export default QrCodePage;
|