mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-05 15:47:00 +08:00
fix: update ConfigProvider cssVar prop and improve HTTP method tag rendering
This commit is contained in:
@@ -190,7 +190,7 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Ctx.Provider value={ctxValue}>
|
<Ctx.Provider value={ctxValue}>
|
||||||
<ConfigProvider theme={{ ...themeConfig, cssVar: true }} locale={locale}>
|
<ConfigProvider theme={{ ...themeConfig, cssVar: {} }} locale={locale}>
|
||||||
{children}
|
{children}
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
</Ctx.Provider>
|
</Ctx.Provider>
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ const SideNav = memo(function SideNav({ collapsed, activeKey, onChange, onToggle
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Divider orientation="left" plain>{t('Changelog')}</Divider>
|
<Divider titlePlacement="left" plain>{t('Changelog')}</Divider>
|
||||||
<div style={{
|
<div style={{
|
||||||
maxHeight: '40vh',
|
maxHeight: '40vh',
|
||||||
overflowY: 'auto',
|
overflowY: 'auto',
|
||||||
|
|||||||
@@ -22,6 +22,30 @@ const ACTION_OPTIONS = [
|
|||||||
'other'
|
'other'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const HTTP_METHOD_COLOR_MAP: Record<string, string> = {
|
||||||
|
GET: 'green',
|
||||||
|
POST: 'blue',
|
||||||
|
PUT: 'orange',
|
||||||
|
PATCH: 'gold',
|
||||||
|
DELETE: 'red',
|
||||||
|
HEAD: 'cyan',
|
||||||
|
OPTIONS: 'purple',
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderHttpMethodTag = (method: string) => {
|
||||||
|
const upper = method.toUpperCase();
|
||||||
|
const color = HTTP_METHOD_COLOR_MAP[upper] || 'default';
|
||||||
|
return (
|
||||||
|
<Tag
|
||||||
|
bordered={false}
|
||||||
|
color={color}
|
||||||
|
style={{ margin: 0, paddingInline: 8, minWidth: 56, textAlign: 'center', fontWeight: 500 }}
|
||||||
|
>
|
||||||
|
{upper}
|
||||||
|
</Tag>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const AuditLogsPage = memo(function AuditLogsPage() {
|
const AuditLogsPage = memo(function AuditLogsPage() {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [data, setData] = useState<PaginatedAuditLogs | null>(null);
|
const [data, setData] = useState<PaginatedAuditLogs | null>(null);
|
||||||
@@ -118,7 +142,7 @@ const AuditLogsPage = memo(function AuditLogsPage() {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (path: string, rec: AuditLogItem) => (
|
render: (path: string, rec: AuditLogItem) => (
|
||||||
<Space size={4}>
|
<Space size={4}>
|
||||||
<Tag bordered={false} color="default" style={{ margin: 0, paddingInline: 8 }}>{rec.method}</Tag>
|
{renderHttpMethodTag(rec.method)}
|
||||||
<span style={{ maxWidth: 320, display: 'inline-block' }}>{path}</span>
|
<span style={{ maxWidth: 320, display: 'inline-block' }}>{path}</span>
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
@@ -256,7 +280,7 @@ const AuditLogsPage = memo(function AuditLogsPage() {
|
|||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t('Path')} span={2}>
|
<Descriptions.Item label={t('Path')} span={2}>
|
||||||
<Space size={6} wrap style={{ wordBreak: 'break-all' }}>
|
<Space size={6} wrap style={{ wordBreak: 'break-all' }}>
|
||||||
<Tag bordered={false} color="default" style={{ margin: 0, paddingInline: 8 }}>{selectedLog.method}</Tag>
|
{renderHttpMethodTag(selectedLog.method)}
|
||||||
<Typography.Text copyable style={{ wordBreak: 'break-all' }}>{selectedLog.path}</Typography.Text>
|
<Typography.Text copyable style={{ wordBreak: 'break-all' }}>{selectedLog.path}</Typography.Text>
|
||||||
</Space>
|
</Space>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { useI18n } from '../i18n';
|
|||||||
import LanguageSwitcher from '../components/LanguageSwitcher';
|
import LanguageSwitcher from '../components/LanguageSwitcher';
|
||||||
|
|
||||||
const { Title, Text } = Typography;
|
const { Title, Text } = Typography;
|
||||||
const { Step } = Steps;
|
|
||||||
|
|
||||||
const SetupPage = () => {
|
const SetupPage = () => {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -243,11 +242,11 @@ const SetupPage = () => {
|
|||||||
<img src="/logo.svg" alt="Foxel Logo" style={{ width: 48, marginBottom: 16 }} />
|
<img src="/logo.svg" alt="Foxel Logo" style={{ width: 48, marginBottom: 16 }} />
|
||||||
<Title level={2}>{t('System Initialization')}</Title>
|
<Title level={2}>{t('System Initialization')}</Title>
|
||||||
</div>
|
</div>
|
||||||
<Steps current={currentStep} style={{ marginBottom: 32 }}>
|
<Steps
|
||||||
{steps.map(item => (
|
current={currentStep}
|
||||||
<Step key={item.title} title={item.title} />
|
style={{ marginBottom: 32 }}
|
||||||
))}
|
items={steps.map((item) => ({ title: item.title }))}
|
||||||
</Steps>
|
/>
|
||||||
|
|
||||||
<Form form={form} name="setup" onFinish={onFinish} layout="vertical">
|
<Form form={form} name="setup" onFinish={onFinish} layout="vertical">
|
||||||
{steps.map((step, index) => (
|
{steps.map((step, index) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user