1
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-14 21:49:44 +08:00
parent fa435aa6a6
commit 6363267bca
13 changed files with 2743 additions and 237 deletions

View File

@@ -13,7 +13,17 @@ interface CustomWorldGenerationViewProps {
onBack: () => void;
onEditSetting: () => void;
onRetry: () => void;
onInterrupt: () => void;
onInterrupt?: () => void;
backLabel?: string;
settingActionLabel?: string;
retryLabel?: string;
interruptLabel?: string;
settingTitle?: string;
settingDescription?: string;
progressTitle?: string;
activeBadgeLabel?: string;
pausedBadgeLabel?: string;
idleBadgeLabel?: string;
}
function formatDuration(ms: number) {
@@ -46,6 +56,16 @@ export function CustomWorldGenerationView({
onEditSetting,
onRetry,
onInterrupt,
backLabel = '返回',
settingActionLabel = '修改设定',
retryLabel = '重新开始生成',
interruptLabel = '中断世界生成',
settingTitle = '玩家设定',
settingDescription = '这段文本会直接驱动本轮世界框架、角色与场景生成。',
progressTitle = '生成进度',
activeBadgeLabel = '世界建设中',
pausedBadgeLabel = '生成已暂停',
idleBadgeLabel = '等待操作',
}: CustomWorldGenerationViewProps) {
const progressValue = getProgressPercentage(progress);
const steps = progress?.steps ?? [];
@@ -68,10 +88,14 @@ export function CustomWorldGenerationView({
disabled={isGenerating}
className={`rounded-full border border-white/10 bg-black/18 px-3 py-1.5 text-[11px] text-zinc-300 transition-colors hover:text-white ${isGenerating ? 'cursor-not-allowed opacity-45' : ''}`}
>
{backLabel}
</button>
<div className="rounded-full border border-sky-300/16 bg-sky-500/10 px-3 py-1 text-[10px] tracking-[0.2em] text-sky-100">
{isGenerating ? '世界建设中' : error ? '生成已暂停' : '等待操作'}
{isGenerating
? activeBadgeLabel
: error
? pausedBadgeLabel
: idleBadgeLabel}
</div>
</div>
@@ -86,10 +110,10 @@ export function CustomWorldGenerationView({
<div className="mb-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0">
<div className="text-[11px] font-bold tracking-[0.2em] text-sky-100/85">
{settingTitle}
</div>
<div className="mt-1 text-sm text-zinc-400">
{settingDescription}
</div>
</div>
<button
@@ -98,7 +122,7 @@ export function CustomWorldGenerationView({
disabled={isGenerating}
className={`rounded-full border border-white/10 bg-black/20 px-3 py-1.5 text-[11px] text-zinc-300 transition-colors hover:text-white ${isGenerating ? 'cursor-not-allowed opacity-40' : ''}`}
>
{settingActionLabel}
</button>
</div>
<div className="whitespace-pre-line rounded-2xl border border-white/8 bg-black/22 px-4 py-4 text-sm leading-7 text-zinc-200 md:max-h-[16rem] md:overflow-y-auto">
@@ -116,7 +140,7 @@ export function CustomWorldGenerationView({
<div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
<div className="min-w-0">
<div className="text-[11px] font-bold tracking-[0.2em] text-zinc-400">
{progressTitle}
</div>
<div className="mt-1 text-xl font-black leading-tight text-white sm:text-[2rem]">
{progress?.phaseLabel ?? '正在启动世界生成'}
@@ -211,7 +235,7 @@ export function CustomWorldGenerationView({
onClick={onEditSetting}
className="rounded-full border border-white/10 bg-black/20 px-4 py-2 text-sm text-zinc-300 transition-colors hover:text-white"
>
{settingActionLabel}
</button>
<button
type="button"
@@ -224,21 +248,21 @@ export function CustomWorldGenerationView({
>
<div className="flex items-center justify-between gap-4">
<span className="text-sm font-semibold text-white">
{retryLabel}
</span>
<span className="text-white/60"></span>
</div>
</button>
</>
) : (
) : onInterrupt ? (
<button
type="button"
onClick={onInterrupt}
className="rounded-full border border-rose-300/18 bg-rose-500/10 px-4 py-2 text-sm text-rose-100 transition-colors hover:text-white"
>
{interruptLabel}
</button>
)}
) : null}
</div>
</section>
</div>