fix(web): 任务中心 - 资源失效时显示预览占位 (#286)
This commit is contained in:
1 parent
8be5334d9c
commit
38f596e28a
7 files changed
+138
-21
No files matched your search
@@ -19,6 +19,7 @@ import { listProjects, type ProjectSummary } from "@/services/api/projects";
|
||||
import { TaskGridCard } from "./task-grid-card";
|
||||
import { TaskGroupHeader, type TaskGroup } from "./task-group-header";
|
||||
import { TaskListRow } from "./task-list-row";
|
||||
import { TaskMediaPreview } from "./task-media-preview";
|
||||
import { formatModelName, getTaskCanvasContext, isTaskFailed, providerCancelStatusLabel, taskMediaKind } from "./task-shared";
|
||||
import { TaskStatusFilterBar, type TaskStatusFilter } from "./task-status-filter";
|
||||
|
||||
@@ -585,9 +586,16 @@ export default function TasksPage() {
|
||||
destroyOnHidden
|
||||
className="library-modal task-media-preview-modal"
|
||||
>
|
||||
{mediaPreview?.kind === "video"
|
||||
? <video src={mediaPreview.url} className="max-h-[76vh] w-full bg-black object-contain" controls playsInline preload="metadata" />
|
||||
: mediaPreview ? <img src={mediaPreview.url} alt={mediaPreview.title} className="max-h-[76vh] w-full bg-black object-contain" /> : null}
|
||||
{mediaPreview ? (
|
||||
<TaskMediaPreview
|
||||
src={mediaPreview.url}
|
||||
kind={mediaPreview.kind}
|
||||
alt={mediaPreview.title}
|
||||
controls={mediaPreview.kind === "video"}
|
||||
className="max-h-[76vh] w-full bg-black object-contain"
|
||||
fallbackClassName="task-media-preview-unavailable"
|
||||
/>
|
||||
) : null}
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
@@ -617,9 +625,20 @@ function TaskResultMedia({ value, taskType }: { value?: string; taskType: string
|
||||
<div>
|
||||
<Typography.Text strong>生成结果</Typography.Text>
|
||||
<div className="mt-2 grid max-h-[360px] grid-cols-2 gap-2 overflow-auto rounded-lg bg-stone-950 p-2 md:grid-cols-3">
|
||||
{urls.map((url, index) => isVideoResult(url, taskType)
|
||||
? <video key={`${url}-${index}`} src={url} className="aspect-video w-full rounded-md bg-black object-contain" controls preload="metadata" />
|
||||
: <img key={`${url}-${index}`} src={url} alt={`生成结果 ${index + 1}`} className="aspect-square w-full rounded-md bg-black object-contain" />)}
|
||||
{urls.map((url, index) => {
|
||||
const isVideo = isVideoResult(url, taskType);
|
||||
return (
|
||||
<TaskMediaPreview
|
||||
key={`${url}-${index}`}
|
||||
src={url}
|
||||
kind={isVideo ? "video" : "image"}
|
||||
alt={`生成结果 ${index + 1}`}
|
||||
controls={isVideo}
|
||||
className={isVideo ? "task-result-media is-video" : "task-result-media"}
|
||||
fallbackClassName={isVideo ? "task-result-media is-video" : "task-result-media"}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user