fix: restore agent workflow controls and nav
This commit is contained in:
parent
281593ff29
commit
d6411076fa
@ -642,7 +642,7 @@ const updateSchema = z.object({
|
||||
subtitle: z.string().max(300).optional(),
|
||||
actionText: z.string().max(48).optional(),
|
||||
videoUrl: z.string().max(2000).optional(),
|
||||
posterUrl: z.string().max(2000).optional(),
|
||||
posterUrl: z.string().max(2000).nullable().optional(),
|
||||
overlayText: z.string().max(200).optional(),
|
||||
footerText: z.string().max(64).optional(),
|
||||
})
|
||||
|
||||
@ -127,6 +127,7 @@ export default function CanvasEditorPage({ params }: PageProps) {
|
||||
const id = (routeParams?.id as string) || use(params).id;
|
||||
const router = useRouter();
|
||||
const mode = searchParams.get("mode");
|
||||
const shouldOpenBatchProcessing = searchParams.get("batch") === "1";
|
||||
const goHome = useCallback(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
window.location.assign("/");
|
||||
@ -386,6 +387,12 @@ export default function CanvasEditorPage({ params }: PageProps) {
|
||||
}
|
||||
}, [isAgentMode]);
|
||||
|
||||
useEffect(() => {
|
||||
if (shouldOpenBatchProcessing) {
|
||||
setSceneFusionDialogOpen(true);
|
||||
}
|
||||
}, [shouldOpenBatchProcessing]);
|
||||
|
||||
const workflowStorageKey = useMemo(() => `canvas-workflow-state:${id}`, [id]);
|
||||
const buildPersistedCanvasData = useCallback(() => {
|
||||
const workflowState: AgentWorkflowPersistedState = {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import type { ReactNode } from "react";
|
||||
import { ArrowLeft, Images, LayoutGrid, Sparkles, Wand2 } from "lucide-react";
|
||||
import { ArrowLeft, Images, Layers, LayoutGrid, Wand2 } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@ -17,9 +17,9 @@ interface AgentCanvasTopNavDarkProps {
|
||||
const NAV_ITEMS = [
|
||||
{
|
||||
key: "featured" as const,
|
||||
label: "AI精选",
|
||||
icon: Sparkles,
|
||||
onClick: () => window.location.assign("/featured"),
|
||||
label: "批量处理",
|
||||
icon: Layers,
|
||||
onClick: () => window.location.assign(`/canvas/${crypto.randomUUID()}?batch=1`),
|
||||
},
|
||||
{
|
||||
key: "agent" as const,
|
||||
@ -92,30 +92,32 @@ export function AgentCanvasTopNavDark({
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<nav className="hidden items-center gap-2 md:flex">
|
||||
{NAV_ITEMS.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const isActive = item.key === activeKey;
|
||||
return (
|
||||
<button
|
||||
key={item.key}
|
||||
type="button"
|
||||
onClick={item.onClick}
|
||||
className={cn(
|
||||
"flex items-center gap-2 rounded-full px-4 py-2 text-sm font-medium transition-all duration-300",
|
||||
isActive
|
||||
? "bg-white text-black"
|
||||
: "bg-white/5 text-white/60 hover:bg-white/10 hover:text-white"
|
||||
)}
|
||||
>
|
||||
<Icon className="h-4 w-4" />
|
||||
{item.label}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
<div className="ml-auto flex shrink-0 items-center gap-3">
|
||||
<nav className="hidden items-center gap-2 md:flex">
|
||||
{NAV_ITEMS.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const isActive = item.key === activeKey;
|
||||
return (
|
||||
<button
|
||||
key={item.key}
|
||||
type="button"
|
||||
onClick={item.onClick}
|
||||
className={cn(
|
||||
"flex items-center gap-2 rounded-full px-4 py-2 text-sm font-medium transition-all duration-300",
|
||||
isActive
|
||||
? "bg-white text-black"
|
||||
: "bg-white/5 text-white/60 hover:bg-white/10 hover:text-white"
|
||||
)}
|
||||
>
|
||||
<Icon className="h-4 w-4" />
|
||||
{item.label}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
|
||||
<div className="flex shrink-0 items-center justify-end">{rightSlot}</div>
|
||||
{rightSlot ? <div className="flex items-center justify-end">{rightSlot}</div> : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@ -614,7 +614,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
{selectedAgentPresetId && brandModelPanel ? (
|
||||
{brandModelPanel ? (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
|
||||
@ -153,8 +153,8 @@ export function AgentPresetPanelDarkV2({
|
||||
return (
|
||||
<>
|
||||
{/* 搜索栏 */}
|
||||
<div className="mb-4">
|
||||
<div className="relative">
|
||||
<div className="mb-4 flex items-center gap-2">
|
||||
<div className="relative flex-1">
|
||||
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-white/40" />
|
||||
<Input
|
||||
placeholder={`搜索${embeddedEntityLabel}...`}
|
||||
@ -167,6 +167,18 @@ export function AgentPresetPanelDarkV2({
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={() => (onCreateClick ? onCreateClick() : setShowCreateDialog(true))}
|
||||
className={cn(
|
||||
"h-9 shrink-0 gap-1.5 rounded-lg px-3",
|
||||
"bg-gradient-to-r from-emerald-500 to-teal-500 text-white",
|
||||
"hover:from-emerald-400 hover:to-teal-400"
|
||||
)}
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
新建
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* 导航标签(简化版) */}
|
||||
@ -209,8 +221,20 @@ export function AgentPresetPanelDarkV2({
|
||||
))}
|
||||
</AnimatePresence>
|
||||
) : (
|
||||
<div className="text-center py-8 text-white/40 text-sm">
|
||||
暂无{embeddedEntityLabel}
|
||||
<div className="rounded-2xl border border-white/10 bg-white/[0.03] px-4 py-8 text-center">
|
||||
<div className="text-sm text-white/40">暂无{embeddedEntityLabel}</div>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={() => (onCreateClick ? onCreateClick() : setShowCreateDialog(true))}
|
||||
className={cn(
|
||||
"mt-4 h-9 gap-1.5 rounded-lg px-4",
|
||||
"bg-gradient-to-r from-emerald-500 to-teal-500 text-white",
|
||||
"hover:from-emerald-400 hover:to-teal-400"
|
||||
)}
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
新建{embeddedEntityLabel}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@ -2,14 +2,13 @@
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { motion } from "framer-motion";
|
||||
import { ArrowRight, Check, Copy, RotateCcw, Sparkles, ChevronRight } from "lucide-react";
|
||||
import { ArrowRight, Check, Copy, Sparkles, ChevronRight } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { SearchableSelect } from "@/components/ui/searchable-select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { defaultAgentWorkflowUiConfig } from "@/lib/agents/workflow-ui-config";
|
||||
import { createEmptyAgentWorkflowMaterialSelection } from "@/lib/agents/workflow-material-config";
|
||||
import { AgentCanvasTopNavDark } from "@/components/agents/AgentCanvasTopNavDark";
|
||||
import { AgentWorkflowShowcaseBanner } from "@/components/agents/AgentWorkflowShowcaseBanner";
|
||||
import {
|
||||
@ -164,7 +163,6 @@ export function AgentWorkflowPanelDarkV2({
|
||||
onMaterialsChange,
|
||||
selections,
|
||||
onSelectionsChange,
|
||||
onReset,
|
||||
onNextStep,
|
||||
onSkipStep,
|
||||
siteName,
|
||||
@ -239,28 +237,6 @@ export function AgentWorkflowPanelDarkV2({
|
||||
siteLogo={siteLogo}
|
||||
siteLogoDark={siteLogoDark}
|
||||
activeKey="agent"
|
||||
rightSlot={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
if (onReset) {
|
||||
onReset();
|
||||
return;
|
||||
}
|
||||
onInputsChange({ primarySku: "", secondarySku: "", brand: "", store: "" });
|
||||
onMaterialsChange({
|
||||
primary: createEmptyAgentWorkflowMaterialSelection(),
|
||||
secondary: createEmptyAgentWorkflowMaterialSelection(),
|
||||
});
|
||||
onSelectionsChange({});
|
||||
}}
|
||||
className="h-9 gap-1.5 rounded-full text-white/60 hover:bg-white/10 hover:text-white"
|
||||
>
|
||||
<RotateCcw className="h-3.5 w-3.5" />
|
||||
重置
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="flex-1 overflow-y-auto overscroll-contain pt-16">
|
||||
@ -269,11 +245,14 @@ export function AgentWorkflowPanelDarkV2({
|
||||
<div className="mx-auto max-w-[1480px] px-6 py-8 lg:px-8 xl:px-10">
|
||||
<AgentWorkflowShowcaseBanner
|
||||
config={showcaseConfig}
|
||||
actionLabel="开始选择风格"
|
||||
secondaryActionLabel={onSkipStep ? "进入风格生图" : undefined}
|
||||
onActionClick={() => {
|
||||
const target = document.getElementById("agent-workflow-content");
|
||||
if (!target) return;
|
||||
target.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
}}
|
||||
onSecondaryActionClick={onSkipStep}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@ -10,18 +10,25 @@ import type { AgentWorkflowShowcaseConfig } from "@/types/agent";
|
||||
interface AgentWorkflowShowcaseBannerProps {
|
||||
config?: AgentWorkflowShowcaseConfig | null;
|
||||
onActionClick?: () => void;
|
||||
actionLabel?: string;
|
||||
secondaryActionLabel?: string;
|
||||
onSecondaryActionClick?: () => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function AgentWorkflowShowcaseBanner({
|
||||
config,
|
||||
onActionClick,
|
||||
actionLabel,
|
||||
secondaryActionLabel,
|
||||
onSecondaryActionClick,
|
||||
className,
|
||||
}: AgentWorkflowShowcaseBannerProps) {
|
||||
const resolved = config || defaultAgentWorkflowShowcaseConfig;
|
||||
const hasVideo = Boolean(resolved.videoUrl);
|
||||
const hasPoster = Boolean(resolved.posterUrl);
|
||||
const shouldRenderMedia = resolved.enabled !== false;
|
||||
const resolvedActionLabel = actionLabel || resolved.actionText;
|
||||
|
||||
return (
|
||||
<div className={cn("space-y-8", className)}>
|
||||
@ -33,22 +40,36 @@ export function AgentWorkflowShowcaseBanner({
|
||||
>
|
||||
<h1 className="mb-3 text-3xl font-bold text-white md:text-4xl">{resolved.title}</h1>
|
||||
<p className="mb-6 text-base text-white/50">{resolved.subtitle}</p>
|
||||
{resolved.actionText ? (
|
||||
<Button
|
||||
type="button"
|
||||
onClick={onActionClick}
|
||||
className={cn(
|
||||
"h-12 gap-2 rounded-full px-8",
|
||||
"bg-gradient-to-r from-emerald-500 to-teal-500",
|
||||
"text-base font-medium text-white",
|
||||
"hover:from-emerald-400 hover:to-teal-400",
|
||||
"shadow-[0_0_30px_rgba(16,185,129,0.3)]",
|
||||
"transition-all duration-300"
|
||||
)}
|
||||
>
|
||||
{resolved.actionText}
|
||||
<ArrowRight className="h-5 w-5" />
|
||||
</Button>
|
||||
{resolvedActionLabel || secondaryActionLabel ? (
|
||||
<div className="flex flex-col items-center justify-center gap-4 sm:flex-row">
|
||||
{resolvedActionLabel ? (
|
||||
<Button
|
||||
type="button"
|
||||
onClick={onActionClick}
|
||||
className={cn(
|
||||
"h-12 gap-2 rounded-full px-8",
|
||||
"bg-gradient-to-r from-emerald-500 to-teal-500",
|
||||
"text-base font-medium text-white",
|
||||
"hover:from-emerald-400 hover:to-teal-400",
|
||||
"shadow-[0_0_30px_rgba(16,185,129,0.3)]",
|
||||
"transition-all duration-300"
|
||||
)}
|
||||
>
|
||||
{resolvedActionLabel}
|
||||
<ArrowRight className="h-5 w-5" />
|
||||
</Button>
|
||||
) : null}
|
||||
{secondaryActionLabel ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={onSecondaryActionClick}
|
||||
className="h-12 rounded-2xl border-white/20 bg-transparent px-12 text-base font-medium text-white hover:border-emerald-400/50 hover:bg-white/[0.04]"
|
||||
>
|
||||
{secondaryActionLabel}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</motion.div>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user