cf544881fd
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m9s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m11s
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 2m26s
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m45s
CI/CD Pipeline / Validate - Code Quality (push) Failing after 2m55s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 1m5s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 5m14s
CI/CD Pipeline / Integration Tests (push) Successful in 3m8s
CI/CD Pipeline / Unit Tests (push) Successful in 7m24s
CI/CD Pipeline / Build Staging API Image (push) Successful in 15m59s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m22s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 35s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 3m21s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 4m8s
96 lines
2.9 KiB
TypeScript
96 lines
2.9 KiB
TypeScript
/**
|
|
* Step 2 素材选择组件
|
|
*/
|
|
import React from "react"
|
|
import { useStep2Materials } from "../hooks/useStep2Materials"
|
|
import MaterialModeTabs from "./material/MaterialModeTabs"
|
|
import ManualMaterialList from "./material/ManualMaterialList"
|
|
import SmartMatchInput from "./material/SmartMatchInput"
|
|
import SmartMatchResults from "./material/SmartMatchResults"
|
|
|
|
interface Step2MaterialSelectProps {
|
|
materialMode: "manual" | "auto"
|
|
onMaterialModeChange: (mode: "manual" | "auto") => void
|
|
selectedMaterials: string[]
|
|
onSelectedMaterialsChange: (ids: string[]) => void
|
|
smartSelectedIds: string[]
|
|
onSmartSelectedIdsChange: (ids: string[]) => void
|
|
}
|
|
|
|
const Step2MaterialSelect: React.FC<Step2MaterialSelectProps> = (props) => {
|
|
const m = useStep2Materials(props)
|
|
|
|
return (
|
|
<div className="xx-form-section">
|
|
<h3>📦 选择素材</h3>
|
|
|
|
<MaterialModeTabs mode={m.materialMode} onModeChange={m.onMaterialModeChange} />
|
|
|
|
<div className="xx-form-field" style={{ marginTop: 12 }}>
|
|
<label>选择视频库</label>
|
|
<select
|
|
value={m.selectedLibraryId}
|
|
onChange={(e) => m.setSelectedLibraryId(e.target.value)}
|
|
>
|
|
{m.libraries.map((lib) => (
|
|
<option key={lib.id} value={lib.id}>
|
|
{lib.name}
|
|
</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
|
|
{m.materialMode === "manual" && (
|
|
<>
|
|
<div
|
|
style={{
|
|
marginTop: 14,
|
|
display: "flex",
|
|
alignItems: "center",
|
|
gap: 10,
|
|
}}
|
|
>
|
|
<span className="xx-pill xx-pill-ok">已选 {m.selectedMaterials.length} 个素材</span>
|
|
</div>
|
|
|
|
<ManualMaterialList
|
|
materials={m.materials}
|
|
materialsLoading={m.materialsLoading}
|
|
selectedMaterials={m.selectedMaterials}
|
|
onToggle={m.handleToggleMaterial}
|
|
/>
|
|
</>
|
|
)}
|
|
|
|
{m.materialMode === "auto" && (
|
|
<div className="xx-smart-match-section">
|
|
<SmartMatchInput
|
|
inputValue={m.smartMatchInput}
|
|
onInputChange={m.setSmartMatchInput}
|
|
matching={m.smartMatching}
|
|
onMatch={m.handleSmartMatch}
|
|
hasMatched={m.hasMatched}
|
|
onRefresh={m.handleRefreshMatch}
|
|
materialsCount={m.materials.items.length}
|
|
loading={m.materialsLoading}
|
|
/>
|
|
|
|
<SmartMatchResults
|
|
results={m.smartMatchedResults}
|
|
selectedIds={m.smartSelectedIds}
|
|
matching={m.smartMatching}
|
|
hasMatched={m.hasMatched}
|
|
onToggle={m.handleToggleSmartSelect}
|
|
onSelectAll={m.handleSelectAllMatched}
|
|
onClear={m.handleClearSmartSelect}
|
|
formatDuration={m.formatDuration}
|
|
selectedTotalDuration={m.smartSelectedTotalDuration}
|
|
/>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default Step2MaterialSelect
|