Files
ele-HeiXiu/src/pages/settings/blocks/SystemInfoSetting.tsx
YoungestSongMo 53df926973 refactor: Context 与 Provider 合并 — 消除 contexts/ 目录,一文件一状态单元
- ThemeContext + useTheme → ThemeProvider.tsx(原 hooks/use-theme.ts 删除)
- AppContext + useAppContext → AppProvider.tsx(原 contexts/app-context.ts 删除)
- SettingsContext + useSettings → SettingsProvider.tsx(原 contexts/settings-context.ts 删除)
- HomeContext + useHomeContext → HomeContent.tsx(原 contexts/home-context.ts 删除)
- 删除空的 contexts/ 目录,20+ 导入路径同步更新
- TypeScript 编译通过(npx tsc --noEmit 零错误)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 14:02:48 +08:00

66 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ============================================================
// SystemInfoSetting — 系统信息区块(只读展示)
// ============================================================
import { Card, Tag, Typography } from 'antd';
import {
WindowsOutlined,
AppleOutlined,
InfoCircleOutlined,
EnvironmentOutlined,
} from '@ant-design/icons';
import { useAppContext } from '@/components/AppProvider';
import { getPlatformName } from '@/utils/platform';
import { APP_VERSION } from '@shared/constants/version';
import { getEditionName } from '@shared/constants/app';
const { Text } = Typography;
export function SystemInfoSetting() {
const { platform, edition, isDevMode } = useAppContext();
const platformIcon =
platform === 'darwin' ? (
<AppleOutlined />
) : platform === 'win32' ? (
<WindowsOutlined />
) : (
<InfoCircleOutlined />
);
const infoItems = [
{ label: '运行平台', value: getPlatformName(), icon: platformIcon, color: 'purple' },
{ label: '应用版本', value: `V${APP_VERSION}`, icon: <InfoCircleOutlined />, color: 'blue' },
{
label: '版本类型',
value: getEditionName(edition),
icon: <InfoCircleOutlined />,
color: edition === 'enterprise' ? 'gold' : 'green',
},
{
label: '运行环境',
value: isDevMode ? '开发模式' : '生产模式',
icon: <EnvironmentOutlined />,
color: isDevMode ? 'orange' : 'green',
},
];
return (
<Card size="small" title="系统信息(开发显示信息)" className="rounded-md!">
<div className="flex flex-col gap-2">
{infoItems.map((item) => (
<div key={item.label} className="flex items-center gap-2">
<span style={{ color: 'var(--color-primary, #4F46E5)', fontSize: 14 }}>
{item.icon}
</span>
<Text type="secondary" className="text-sm min-w-16">
{item.label}
</Text>
<Tag color={item.color}>{item.value}</Tag>
</div>
))}
</div>
</Card>
);
}