echoes/frontend/app/dashboard/settings.tsx

230 lines
7.4 KiB
TypeScript
Raw Normal View History

import { Template } from "interface/template";
import {
Container,
Heading,
Text,
Box,
Flex,
Card,
Button,
TextField,
Switch,
Tabs,
TextArea
} from "@radix-ui/themes";
import {
GearIcon,
PersonIcon,
LockClosedIcon,
BellIcon,
GlobeIcon
} from "@radix-ui/react-icons";
import { useState } from "react";
export default new Template({}, ({ http, args }) => {
const [siteName, setSiteName] = useState("我的博客");
const [siteDescription, setSiteDescription] = useState("一个优雅的博客系统");
const [emailNotifications, setEmailNotifications] = useState(true);
return (
<Box>
<Heading size="6" className="text-[--gray-12] mb-6">
</Heading>
<Tabs.Root defaultValue="general">
<Tabs.List>
<Tabs.Trigger value="general">
<GearIcon className="w-4 h-4 mr-2" />
</Tabs.Trigger>
<Tabs.Trigger value="profile">
<PersonIcon className="w-4 h-4 mr-2" />
</Tabs.Trigger>
<Tabs.Trigger value="security">
<LockClosedIcon className="w-4 h-4 mr-2" />
</Tabs.Trigger>
<Tabs.Trigger value="notifications">
<BellIcon className="w-4 h-4 mr-2" />
</Tabs.Trigger>
</Tabs.List>
{/* 常规设置 */}
<Tabs.Content value="general">
<Card className="mt-6 p-6 border border-[--gray-6]">
<Flex direction="column" gap="4">
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<TextField.Root
value={siteName}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setSiteName(e.target.value)}
/>
</Box>
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<TextArea
value={siteDescription}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => setSiteDescription(e.target.value)}
className="min-h-[100px]"
/>
</Box>
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<select
className="w-full h-9 px-3 rounded-md bg-[--gray-1] border border-[--gray-6] text-[--gray-12]"
>
<option value="zh-CN"></option>
<option value="en-US">English</option>
</select>
</Box>
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<select
className="w-full h-9 px-3 rounded-md bg-[--gray-1] border border-[--gray-6] text-[--gray-12]"
>
<option value="UTC+8">UTC+8 </option>
<option value="UTC+0">UTC+0 </option>
</select>
</Box>
</Flex>
</Card>
</Tabs.Content>
{/* 个人资料 */}
<Tabs.Content value="profile">
<Card className="mt-6 p-6 border border-[--gray-6]">
<Flex direction="column" gap="4">
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<Flex align="center" gap="4">
<Box className="w-20 h-20 rounded-full bg-[--gray-3] flex items-center justify-center">
<PersonIcon className="w-8 h-8 text-[--gray-9]" />
</Box>
<Button variant="soft"></Button>
</Flex>
</Box>
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<TextField.Root defaultValue="admin" />
</Box>
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<TextField.Root defaultValue="admin@example.com" />
</Box>
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<TextArea
placeholder="介绍一下自己..."
className="min-h-[100px]"
/>
</Box>
</Flex>
</Card>
</Tabs.Content>
{/* 安全设置 */}
<Tabs.Content value="security">
<Card className="mt-6 p-6 border border-[--gray-6]">
<Flex direction="column" gap="4">
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<Flex direction="column" gap="2">
<TextField.Root
type="password"
placeholder="当前密码"
/>
<TextField.Root
type="password"
placeholder="新密码"
/>
<TextField.Root
type="password"
placeholder="确认新密码"
/>
</Flex>
</Box>
<Box>
<Text as="label" size="2" weight="bold" className="block mb-2">
</Text>
<Flex align="center" gap="4">
<Switch defaultChecked />
<Text></Text>
</Flex>
</Box>
</Flex>
</Card>
</Tabs.Content>
{/* 通知设置 */}
<Tabs.Content value="notifications">
<Card className="mt-6 p-6 border border-[--gray-6]">
<Flex direction="column" gap="4">
<Box>
<Flex justify="between" align="center">
<Box>
<Text weight="bold"></Text>
<Text size="1" className="text-[--gray-11]">
</Text>
</Box>
<Switch
checked={emailNotifications}
onCheckedChange={setEmailNotifications}
/>
</Flex>
</Box>
<Box>
<Flex justify="between" align="center">
<Box>
<Text weight="bold"></Text>
<Text size="1" className="text-[--gray-11]">
</Text>
</Box>
<Switch defaultChecked />
</Flex>
</Box>
</Flex>
</Card>
</Tabs.Content>
</Tabs.Root>
{/* 保存按钮 */}
<Flex justify="end" className="mt-6">
<Button className="bg-[--accent-9]">
</Button>
</Flex>
</Box>
);
});