4263e7f6ca
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 5s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 6s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 5s
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Check push changed paths (push) Successful in 8s
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 / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m6s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 2m7s
CI/CD Pipeline / Validate - Style (pull_request) Has been skipped
CI/CD Pipeline / Validate - Security (pull_request) Has been skipped
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (push) Successful in 2m9s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 28s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 28s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (push) Successful in 33s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 34s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 3s
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (push) Successful in 23s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 24s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m11s
CI/CD Pipeline / Retag skipped Staging API Image (push) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 56s
CI/CD Pipeline / Validate - Style (push) Has been cancelled
CI/CD Pipeline / Validate - Security (push) Has been cancelled
CI/CD Pipeline / Unit Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Waiting to run
CI/CD Pipeline / Staging API Integration Tests (push) Waiting to run
CI/CD Pipeline / Build Production API Image (push) Blocked by required conditions
CI/CD Pipeline / Build Production Web Image (push) Blocked by required conditions
CI/CD Pipeline / Build Production Worker Image (push) Blocked by required conditions
CI/CD Pipeline / Deploy Production (push) Blocked by required conditions
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Blocked by required conditions
CI/CD Pipeline / ACR Image Cleanup (push) Waiting to run
CI/CD Pipeline / Canary Release to Production (push) Blocked by required conditions
CI/CD Pipeline / CI Gate (push) Blocked by required conditions
AI Code Review / AI Code Review (pull_request) Has been cancelled
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
85 lines
2.6 KiB
TypeScript
85 lines
2.6 KiB
TypeScript
/**
|
|
* Step 1 模板选择组件
|
|
*/
|
|
import React from "react"
|
|
import type { EditingTemplate } from "@/api/editing-planner"
|
|
import { MODE_GRADIENTS } from "../constants"
|
|
import { useStep1Template } from "../hooks/useStep1Template"
|
|
|
|
interface Step1TemplateSelectProps {
|
|
templates: EditingTemplate[]
|
|
selectedTemplate: string
|
|
onSelectTemplate: (id: string) => void
|
|
}
|
|
|
|
const Step1TemplateSelect: React.FC<Step1TemplateSelectProps> = (props) => {
|
|
const { templates, selectedTemplate, handleSelect, handleKeySelect } = useStep1Template(props)
|
|
|
|
return (
|
|
<div className="xx-form-section">
|
|
<h3>🎨 选择模板</h3>
|
|
{templates.length === 0 ? (
|
|
<div className="xx-empty-state">
|
|
<p>暂无可用模板</p>
|
|
<p style={{ fontSize: 13, color: "var(--text-tertiary)" }}>
|
|
请先在「模板编辑器」中创建模板
|
|
</p>
|
|
</div>
|
|
) : (
|
|
<div className="xx-choice-list">
|
|
{templates.map((tpl) => (
|
|
<div
|
|
key={tpl.id}
|
|
className={`xx-choice-item ${selectedTemplate === tpl.id ? "selected" : ""}`}
|
|
onClick={() => handleSelect(tpl.id)}
|
|
role="button"
|
|
tabIndex={0}
|
|
aria-pressed={selectedTemplate === tpl.id}
|
|
onKeyDown={(e) => handleKeySelect(e, tpl.id)}
|
|
>
|
|
<span className="xx-choice-check">✓</span>
|
|
<div
|
|
className="xx-choice-thumb"
|
|
style={{
|
|
background: MODE_GRADIENTS[tpl.mode] || MODE_GRADIENTS.pip,
|
|
}}
|
|
>
|
|
🎬
|
|
</div>
|
|
<h4>{tpl.name}</h4>
|
|
<p>{tpl.segments.length}片段</p>
|
|
{tpl.tags.length > 0 && (
|
|
<div
|
|
style={{
|
|
display: "flex",
|
|
gap: 4,
|
|
flexWrap: "wrap",
|
|
marginTop: 4,
|
|
}}
|
|
>
|
|
{tpl.tags.map((tag) => (
|
|
<span
|
|
key={tag}
|
|
style={{
|
|
fontSize: 11,
|
|
padding: "1px 6px",
|
|
borderRadius: 6,
|
|
background: "var(--bg-secondary)",
|
|
color: "var(--text-secondary)",
|
|
}}
|
|
>
|
|
{tag}
|
|
</span>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default Step1TemplateSelect
|