fix: simplify 3d world asset actions
This commit is contained in:
parent
85b28885a4
commit
898ed98f1a
@ -11,6 +11,7 @@ import {
|
||||
Check,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
CircleDashed,
|
||||
Crosshair,
|
||||
Download,
|
||||
Eye,
|
||||
@ -4197,111 +4198,91 @@ export default function CanvasModel3DPage() {
|
||||
</div>
|
||||
)}
|
||||
</button>
|
||||
<div className="space-y-2 border-white/10 border-t bg-zinc-950/95 p-2">
|
||||
<div className="flex items-center justify-between gap-1">
|
||||
<Badge
|
||||
className="h-4 px-1 text-[9px]"
|
||||
variant={task.status === "success" ? "default" : "secondary"}
|
||||
>
|
||||
{currentTask?.taskId === task.taskId
|
||||
? "当前"
|
||||
: statusLabel(task.status)}
|
||||
</Badge>
|
||||
<Badge
|
||||
className="border-white/10 bg-zinc-900 text-[9px] text-zinc-200"
|
||||
variant="outline"
|
||||
>
|
||||
{task.provider === "worldlabs-3d" ? "WORLD" : "MODEL"}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="space-y-0.5 text-left text-[10px] leading-tight">
|
||||
<div className="truncate text-zinc-300">{modeLabel(task.mode)}</div>
|
||||
<div className="flex items-center justify-between gap-1 text-zinc-500">
|
||||
<span className="truncate">
|
||||
{formatDistanceToNow(new Date(task.createdAt), {
|
||||
addSuffix: true,
|
||||
locale: zhCN,
|
||||
})}
|
||||
</span>
|
||||
{task.provider === "worldlabs-3d" && task.shareEnabled ? (
|
||||
<span className="shrink-0 text-amber-300">已分享</span>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-3 gap-1">
|
||||
<div className="border-white/10 border-t bg-zinc-950/95 px-1.5 py-2">
|
||||
<div className="flex items-center justify-center gap-1">
|
||||
{canShareWorld ? (
|
||||
<Button
|
||||
aria-label={task.shareEnabled ? "复制分享链接" : "开启分享"}
|
||||
className={cn(
|
||||
"h-7 border-white/10 bg-zinc-900 px-0 text-[10px] text-zinc-200 hover:bg-zinc-800",
|
||||
"h-7 w-7 rounded-full border-white/10 bg-zinc-900/90 p-0 text-zinc-200 hover:bg-zinc-800 hover:text-white",
|
||||
task.shareEnabled &&
|
||||
"border-amber-400/40 bg-amber-400/15 text-amber-100"
|
||||
)}
|
||||
onClick={(event) => void handleShareTask(task, event)}
|
||||
size="sm"
|
||||
size="icon"
|
||||
title={task.shareEnabled ? "复制分享链接" : "开启分享"}
|
||||
type="button"
|
||||
variant="outline"
|
||||
>
|
||||
<Link2 className="mr-1 h-3 w-3" />
|
||||
分享
|
||||
<Link2 className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
) : (
|
||||
<div />
|
||||
)}
|
||||
) : null}
|
||||
{canShareWorld ? (
|
||||
<Button
|
||||
aria-label={
|
||||
isSelectedForShare ? "取消分享选择" : "选中分享"
|
||||
}
|
||||
className={cn(
|
||||
"h-7 border-white/10 bg-zinc-900 px-0 text-[10px] text-zinc-200 hover:bg-zinc-800",
|
||||
"h-7 w-7 rounded-full border-white/10 bg-zinc-900/90 p-0 text-zinc-200 hover:bg-zinc-800 hover:text-white",
|
||||
isSelectedForShare &&
|
||||
"border-cyan-300/60 bg-cyan-400/20 text-cyan-50"
|
||||
)}
|
||||
onClick={(event) => handleToggleWorldShareSelection(task, event)}
|
||||
size="sm"
|
||||
size="icon"
|
||||
title={isSelectedForShare ? "取消分享选择" : "选中分享"}
|
||||
type="button"
|
||||
variant="outline"
|
||||
>
|
||||
{isSelectedForShare ? (
|
||||
<Check className="mr-1 h-3 w-3" />
|
||||
) : null}
|
||||
{isSelectedForShare ? "已选" : "选择"}
|
||||
<Check className="h-3.5 w-3.5" />
|
||||
) : (
|
||||
<CircleDashed className="h-3.5 w-3.5" />
|
||||
)}
|
||||
</Button>
|
||||
) : (
|
||||
<div />
|
||||
)}
|
||||
) : null}
|
||||
{canImportWorld ? (
|
||||
<Button
|
||||
aria-label={
|
||||
isSelectedForCanvas
|
||||
? "取消添加选择"
|
||||
: "选中添加到画布"
|
||||
}
|
||||
className={cn(
|
||||
"h-7 w-7 rounded-full border-yellow-400/25 bg-yellow-400/10 p-0 text-yellow-100 hover:bg-yellow-400/20",
|
||||
isSelectedForCanvas &&
|
||||
"border-yellow-300/60 bg-yellow-400/25 text-yellow-50"
|
||||
)}
|
||||
onClick={(event) => handleToggleWorldCanvasSelection(task, event)}
|
||||
size="icon"
|
||||
title={
|
||||
isSelectedForCanvas
|
||||
? "取消添加选择"
|
||||
: "选中添加到画布"
|
||||
}
|
||||
type="button"
|
||||
variant="outline"
|
||||
>
|
||||
{isSelectedForCanvas ? (
|
||||
<Check className="h-3.5 w-3.5" />
|
||||
) : (
|
||||
<PlusCircle className="h-3.5 w-3.5" />
|
||||
)}
|
||||
</Button>
|
||||
) : null}
|
||||
{task.status === "success" && resolveTaskModelUrl(task) ? (
|
||||
<Button
|
||||
className="h-7 border-white/10 bg-zinc-900 px-0 text-[10px] text-zinc-200 hover:bg-zinc-800"
|
||||
aria-label="下载模型"
|
||||
className="h-7 w-7 rounded-full border-white/10 bg-zinc-900/90 p-0 text-zinc-200 hover:bg-zinc-800 hover:text-white"
|
||||
onClick={(event) => handleDownloadTask(task, event)}
|
||||
size="sm"
|
||||
size="icon"
|
||||
title="下载模型"
|
||||
type="button"
|
||||
variant="outline"
|
||||
>
|
||||
<Download className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
) : (
|
||||
<div />
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
{canImportWorld ? (
|
||||
<Button
|
||||
className={cn(
|
||||
"h-7 w-full border-yellow-400/25 bg-yellow-400/10 text-[10px] text-yellow-100 hover:bg-yellow-400/20",
|
||||
isSelectedForCanvas &&
|
||||
"border-yellow-300/60 bg-yellow-400/25 text-yellow-50"
|
||||
)}
|
||||
onClick={(event) => handleToggleWorldCanvasSelection(task, event)}
|
||||
size="sm"
|
||||
title={isSelectedForCanvas ? "取消添加选择" : "选中添加到画布"}
|
||||
type="button"
|
||||
variant="outline"
|
||||
>
|
||||
{isSelectedForCanvas ? (
|
||||
<Check className="mr-1 h-3.5 w-3.5" />
|
||||
) : (
|
||||
<PlusCircle className="mr-1 h-3.5 w-3.5" />
|
||||
)}
|
||||
{isSelectedForCanvas ? "已选添加" : "选中添加"}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user