fix: make batch processing panel opaque and improve mode interactions
This commit is contained in:
parent
166fec6b0d
commit
f83a3037fc
@ -18,7 +18,7 @@ interface SceneFusionDialogProps {
|
||||
export function SceneFusionDialog({ open, onOpenChange }: SceneFusionDialogProps) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-6xl h-[92vh] flex flex-col p-0 gap-0 overflow-hidden">
|
||||
<DialogContent className="z-[10050] max-w-6xl h-[92vh] flex flex-col p-0 gap-0 overflow-hidden bg-background">
|
||||
<DialogHeader className="sr-only">
|
||||
<DialogTitle>批量处理</DialogTitle>
|
||||
<DialogDescription>批量处理图片与场景裂变。</DialogDescription>
|
||||
@ -28,4 +28,3 @@ export function SceneFusionDialog({ open, onOpenChange }: SceneFusionDialogProps
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import useSWR from "swr";
|
||||
import {
|
||||
CheckCircle2,
|
||||
Download,
|
||||
Image as ImageIcon,
|
||||
Layers,
|
||||
@ -13,6 +14,7 @@ import {
|
||||
Trash2,
|
||||
Upload,
|
||||
Wand2,
|
||||
Eraser,
|
||||
} from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { requestLongTaskResult } from "@/lib/client/long-task";
|
||||
@ -73,12 +75,12 @@ const randomBackgroundStyles = [
|
||||
"高端商业橱窗",
|
||||
];
|
||||
|
||||
const modeOptions: Array<{ id: BatchMode; label: string; description: string }> = [
|
||||
{ id: "scene-fission", label: "裂变场景", description: "1张产品图 + 多张参考图" },
|
||||
{ id: "random-bg", label: "随机换背景", description: "1张图随机生成多种背景" },
|
||||
{ id: "rmbg", label: "批量抠图", description: "多图同步去背景" },
|
||||
{ id: "enhance", label: "批量变清晰", description: "多图同步增强画质" },
|
||||
{ id: "watermark", label: "批量去水印", description: "多图同步去除水印" },
|
||||
const modeOptions: Array<{ id: BatchMode; label: string; description: string; icon: React.ComponentType<{ className?: string }> }> = [
|
||||
{ id: "scene-fission", label: "裂变场景", description: "1张产品图 + 多张参考图", icon: Layers },
|
||||
{ id: "random-bg", label: "随机换背景", description: "1张图随机生成多种背景", icon: Wand2 },
|
||||
{ id: "rmbg", label: "批量抠图", description: "多图同步去背景", icon: Eraser },
|
||||
{ id: "enhance", label: "批量变清晰", description: "多图同步增强画质", icon: Sparkles },
|
||||
{ id: "watermark", label: "批量去水印", description: "多图同步去除水印", icon: RefreshCw },
|
||||
];
|
||||
|
||||
function getModeActionLabel(mode: BatchMode, count: number) {
|
||||
@ -699,7 +701,7 @@ export function SceneFusionView({ onBack, initialProductImage, initialProductNam
|
||||
return (
|
||||
<div className="flex h-full min-h-0 w-full flex-col bg-background">
|
||||
<div className="flex min-h-0 flex-1 flex-col overflow-hidden md:flex-row">
|
||||
<div className="w-full md:w-[420px] border-r flex min-h-0 flex-col bg-muted/10 shrink-0">
|
||||
<div className="w-full md:w-[420px] border-r flex min-h-0 flex-col bg-background shrink-0">
|
||||
<div className="border-b px-4 py-3 shrink-0 bg-background">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
@ -712,8 +714,8 @@ export function SceneFusionView({ onBack, initialProductImage, initialProductNam
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ScrollArea className="flex-1 min-h-0">
|
||||
<div className="space-y-6 p-4">
|
||||
<div className="flex-1 min-h-0 overflow-y-auto overscroll-contain px-4 py-4">
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-2">
|
||||
<Label className="text-base font-medium">处理模式</Label>
|
||||
<div className="grid grid-cols-1 gap-2">
|
||||
@ -722,15 +724,29 @@ export function SceneFusionView({ onBack, initialProductImage, initialProductNam
|
||||
key={option.id}
|
||||
type="button"
|
||||
onClick={() => setMode(option.id)}
|
||||
aria-pressed={mode === option.id}
|
||||
className={cn(
|
||||
"rounded-lg border px-3 py-2 text-left transition-colors",
|
||||
"rounded-lg border px-3 py-2 text-left transition-all duration-150 active:scale-[0.99]",
|
||||
mode === option.id
|
||||
? "border-primary bg-primary/10"
|
||||
: "border-border bg-background hover:bg-muted/60"
|
||||
? "border-primary bg-primary/12 shadow-[0_0_0_1px_hsl(var(--primary)/0.35)]"
|
||||
: "border-border bg-background hover:bg-muted/60 hover:border-primary/40"
|
||||
)}
|
||||
>
|
||||
<div className="text-sm font-medium">{option.label}</div>
|
||||
<div className="text-xs text-muted-foreground mt-0.5">{option.description}</div>
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<div className="flex items-start gap-2">
|
||||
<option.icon
|
||||
className={cn(
|
||||
"mt-0.5 h-4 w-4",
|
||||
mode === option.id ? "text-primary" : "text-muted-foreground"
|
||||
)}
|
||||
/>
|
||||
<div>
|
||||
<div className="text-sm font-medium leading-5">{option.label}</div>
|
||||
<div className="text-xs text-muted-foreground mt-0.5">{option.description}</div>
|
||||
</div>
|
||||
</div>
|
||||
{mode === option.id && <CheckCircle2 className="h-4 w-4 text-primary shrink-0" />}
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
@ -1019,7 +1035,7 @@ export function SceneFusionView({ onBack, initialProductImage, initialProductNam
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
|
||||
<div className="p-4 border-t bg-background shrink-0">
|
||||
<Button className="w-full" size="lg" onClick={startProcessing} disabled={isProcessing || !modeCanStart}>
|
||||
@ -1038,7 +1054,7 @@ export function SceneFusionView({ onBack, initialProductImage, initialProductNam
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex h-full min-h-0 flex-1 flex-col bg-background/50">
|
||||
<div className="flex h-full min-h-0 flex-1 flex-col bg-background">
|
||||
<div className="p-4 border-b flex items-center justify-between bg-background shrink-0">
|
||||
<h3 className="font-medium">处理结果</h3>
|
||||
{resultItems.some((item) => item.status === "completed") && (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user