32a95d09f0
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 1m49s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m10s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Successful in 2m40s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m48s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 1m17s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 5m1s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 5m10s
CI/CD Pipeline / Unit Tests (push) Failing after 5m58s
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Integration Tests (push) Successful in 2m33s
CI/CD Pipeline / Build Staging API Image (push) Successful in 17m18s
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 / ACR Image Cleanup (push) Has been cancelled
CI/CD Pipeline / Canary Release to Production (push) Has been cancelled
71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
import React from "react"
|
||
import { PlusOutlined, DeleteOutlined } from "@ant-design/icons"
|
||
import { Popconfirm } from "antd"
|
||
import type { LibraryItem } from "@/pages/assets/types"
|
||
import { kindLabel } from "@/pages/assets/utils/asset"
|
||
import { kindIcon } from "@/pages/assets/utils/kindIcon"
|
||
|
||
/* ============================================================
|
||
* LibrarySidebar — 左侧素材库列表
|
||
* ============================================================ */
|
||
export interface LibrarySidebarProps {
|
||
libraries: LibraryItem[]
|
||
activeLibId: string
|
||
onSelect: (id: string) => void
|
||
onDelete: (id: string) => void
|
||
onCreateClick: () => void
|
||
}
|
||
|
||
const LibrarySidebar: React.FC<LibrarySidebarProps> = ({
|
||
libraries,
|
||
activeLibId,
|
||
onSelect,
|
||
onDelete,
|
||
onCreateClick,
|
||
}) => (
|
||
<div className="xx-asset-library-list">
|
||
{libraries.map((lib) => (
|
||
<div
|
||
key={lib.id}
|
||
className={`xx-asset-library-item${lib.id === activeLibId ? " active" : ""}`}
|
||
onClick={() => onSelect(lib.id)}
|
||
>
|
||
<div className="xx-asset-library-header">
|
||
<h4>
|
||
{kindIcon(lib.kind)} {lib.name}
|
||
</h4>
|
||
<Popconfirm
|
||
title={`确定删除视频库 "${lib.name}"?`}
|
||
onConfirm={(e) => {
|
||
e?.stopPropagation()
|
||
onDelete(lib.id)
|
||
}}
|
||
onCancel={(e) => e?.stopPropagation()}
|
||
okText="删除"
|
||
cancelText="取消"
|
||
>
|
||
<button
|
||
className="xx-asset-library-delete"
|
||
onClick={(e) => e.stopPropagation()}
|
||
title="删除视频库"
|
||
>
|
||
<DeleteOutlined />
|
||
</button>
|
||
</Popconfirm>
|
||
</div>
|
||
<span>
|
||
{kindLabel(lib.kind)} · {lib.count} 个素材
|
||
</span>
|
||
</div>
|
||
))}
|
||
|
||
{/* 新建视频库 */}
|
||
<div className="xx-asset-library-add" onClick={onCreateClick}>
|
||
<PlusOutlined />
|
||
新建视频库
|
||
</div>
|
||
</div>
|
||
)
|
||
|
||
export default LibrarySidebar
|