[优化] 界面优化

This commit is contained in:
ryan
2026-03-11 21:51:32 +08:00
parent 0edc024cbd
commit c0ec718563
8 changed files with 536 additions and 623 deletions
@@ -1,7 +1,7 @@
'use client';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useState } from 'react';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useState } from 'react';
import { EmptyState } from '@/components/feedback/empty-state';
import { ErrorState } from '@/components/feedback/error-state';
@@ -28,7 +28,7 @@ import {
PrimaryButton,
SecondaryButton,
} from '@/features/shared/components/resource-primitives';
import { formatDateTime } from '@/lib/utils/date';
import { formatDateTime } from '@/lib/utils/date';
const versionsQueryKey = ['config-versions'];
@@ -249,7 +249,7 @@ export function ConfigVersionsPage() {
},
});
const handleOpenPublishPreview = async () => {
const handleOpenPublishPreview = async () => {
setFeedback(null);
setIsPreviewLoading(true);
@@ -280,20 +280,20 @@ export function ConfigVersionsPage() {
return (
<div className='space-y-6'>
<PageHeader
title='配置版本'
description='查看历史快照、预览待发布配置差异,并在需要时重新激活旧版本。'
action={
<PrimaryButton type='button' onClick={handleOpenPublishPreview} disabled={isPreviewLoading}>
{isPreviewLoading ? '加载预览中...' : '预览并发布'}
</PrimaryButton>
}
/>
<PageHeader
title='配置版本'
description='查看历史快照、预览待发布配置差异,并在需要时重新激活旧版本。'
action={
<PrimaryButton type='button' onClick={handleOpenPublishPreview} disabled={isPreviewLoading}>
{isPreviewLoading ? '加载预览中...' : '预览并发布'}
</PrimaryButton>
}
/>
{feedback ? <InlineMessage tone={feedback.tone} message={feedback.message} /> : null}
<div className='grid gap-6'>
{publishPreview ? (
<div className='grid gap-6'>
{publishPreview ? (
<PublishPreviewCard
preview={publishPreview.preview}
diff={publishPreview.diff}
@@ -301,18 +301,10 @@ export function ConfigVersionsPage() {
onConfirm={() => publishMutation.mutate()}
onCancel={() => setPublishPreview(null)}
/>
) : (
<AppCard title='发布建议' description='建议先查看变更摘要,再决定是否发布为新的激活版本。'>
<div className='space-y-3 text-sm leading-6 text-[var(--foreground-secondary)]'>
<p>1. 使用“预览并发布”查看新增、删除和修改的域名清单。</p>
<p>2. 确认渲染出的 Nginx 配置与支持文件内容符合预期。</p>
<p>3. 若需要回滚,可在下方历史版本列表中重新激活旧版本。</p>
</div>
</AppCard>
)}
) : null}
</div>
<AppCard title='历史版本' description='支持查看快照详情,并在必要时将旧版本重新设为当前激活版本。'>
<AppCard title='历史版本'>
{versionsQuery.isLoading ? (
<LoadingState />
) : versionsQuery.isError ? (