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