db733a1574
CI/CD Pipeline / Check if frontend-only change (push) Has been cancelled
CI/CD Pipeline / Validate - Code Quality (push) Has been cancelled
CI/CD Pipeline / Validate - Type Check (mypy) (push) Has been cancelled
CI/CD Pipeline / Validate - Migration (alembic) (push) Has been cancelled
CI/CD Pipeline / Unit Tests (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (push) Has been cancelled
CI/CD Pipeline / PR Build API Image (push) Has been cancelled
CI/CD Pipeline / PR Build Web Image (push) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (push) Has been cancelled
CI/CD Pipeline / Build Staging API Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / Build Production API Image (push) Has been cancelled
CI/CD Pipeline / Build Production Web Image (push) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Production (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (push) Has been cancelled
CI/CD Pipeline / Canary Release to Production (push) Has been cancelled
CI/CD Pipeline / CI Gate (push) Has been cancelled
94 lines
2.3 KiB
TypeScript
94 lines
2.3 KiB
TypeScript
/**
|
|
* AssetLibrary 素材网格区域(含加载/错误/空状态)
|
|
*/
|
|
import React from "react"
|
|
import { PictureOutlined, ExclamationCircleOutlined } from "@ant-design/icons"
|
|
import { Button } from "@/components/ui"
|
|
import type { AssetItem } from "../types"
|
|
import AssetCard from "./AssetCard"
|
|
import { SkeletonCard } from "./AssetSkeleton"
|
|
|
|
export interface AssetGridSectionProps {
|
|
loading: boolean
|
|
error: boolean
|
|
errorMessage?: string
|
|
assets: AssetItem[]
|
|
selectedIds: Set<string>
|
|
diagnosingId: string | null
|
|
onRetry?: () => void
|
|
onToggleSelect: (id: string) => void
|
|
onDiagnose: (asset: AssetItem) => void
|
|
onPlay: (asset: AssetItem) => void
|
|
onDelete: (id: string) => void
|
|
}
|
|
|
|
export const AssetGridSection: React.FC<AssetGridSectionProps> = ({
|
|
loading,
|
|
error,
|
|
errorMessage,
|
|
assets,
|
|
selectedIds,
|
|
diagnosingId,
|
|
onRetry,
|
|
onToggleSelect,
|
|
onDiagnose,
|
|
onPlay,
|
|
onDelete,
|
|
}) => {
|
|
if (loading) {
|
|
return (
|
|
<div className="xx-asset-grid">
|
|
{Array.from({ length: 8 }).map((_, i) => (
|
|
<SkeletonCard key={i} />
|
|
))}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (error) {
|
|
return (
|
|
<div className="xx-assets-empty">
|
|
<div className="xx-assets-empty-icon">
|
|
<ExclamationCircleOutlined />
|
|
</div>
|
|
<p className="xx-assets-empty-title">{errorMessage || "加载失败"}</p>
|
|
{onRetry && (
|
|
<Button buttonType="primary" buttonSize="sm" onClick={onRetry}>
|
|
重新加载
|
|
</Button>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (assets.length > 0) {
|
|
return (
|
|
<div className="xx-asset-grid">
|
|
{assets.map((asset) => (
|
|
<AssetCard
|
|
key={asset.id}
|
|
asset={asset}
|
|
selected={selectedIds.has(asset.id)}
|
|
diagnosing={diagnosingId === asset.id}
|
|
onToggle={() => onToggleSelect(asset.id)}
|
|
onDiagnose={() => onDiagnose(asset)}
|
|
onPlay={() => onPlay(asset)}
|
|
onDelete={() => onDelete(asset.id)}
|
|
/>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div className="xx-assets-empty">
|
|
<div className="xx-assets-empty-icon">
|
|
<PictureOutlined />
|
|
</div>
|
|
<p className="xx-assets-empty-title">暂无素材,请上传或切换视频库</p>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default AssetGridSection
|