add frontend

This commit is contained in:
jaehwang committed 2026-09-08 13:48:20 +09:00
1 parent bc57b358f9
commit 5cd5ec5649
44 files changed
+10081

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
/** ADO2 공식 워드마크 — higgsfield POC/ADO2 Design System/assets/logo.svg (currentColor) */
export default function Ado2Logo({ height = 16 }: { height?: number }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={(149 / 22) * height}
height={height}
viewBox="0 0 149 22"
fill="none"
aria-label="ADO2"
>
<path
d="M 8.85 21.647 L 11.455 18.754 L 26.244 18.754 L 19.042 3.985 L 4.064 21.654 L 0 21.654 L 17.329 1.378 C 17.902 0.712 18.755 0.072 19.804 0.072 C 20.852 0.072 21.484 0.647 21.836 1.378 L 31.864 21.654 L 8.857 21.654 L 8.85 21.647 Z M 34.052 21.647 L 36.371 8.374 L 39.829 8.374 L 38.018 18.754 L 47.761 18.754 C 53.153 18.754 57.724 14.867 57.724 9.837 C 57.724 5.983 54.84 3.279 50.489 3.279 L 37.289 3.279 L 40.018 0.353 L 50.997 0.353 C 57.151 0.353 61.182 3.985 61.182 9.269 C 61.182 16.18 54.833 21.654 47.253 21.654 L 34.052 21.654 L 34.052 21.647 Z M 75.848 22 C 67.499 22 63.279 19.198 63.279 13.116 C 63.279 4.298 68.645 0 79.716 0 C 88.065 0 92.285 2.77 92.285 8.851 C 92.285 17.669 86.951 22 75.848 22 Z M 79.215 2.9 C 70.072 2.9 66.776 5.735 66.776 12.77 C 66.776 17.388 69.824 19.106 76.363 19.106 C 85.473 19.106 88.801 16.239 88.801 9.204 C 88.801 4.586 85.753 2.9 79.215 2.9 Z M 92.865 21.647 L 93.978 15.344 C 94.642 11.523 97.599 9.681 102.418 9.681 L 111.685 9.681 C 115.586 9.681 117.175 8.341 117.175 6.049 C 117.175 3.945 115.078 3.279 111.079 3.279 L 97.338 3.279 L 100.1 0.353 L 113.013 0.353 C 118.438 0.353 120.568 2.358 120.568 5.35 C 120.568 9.262 118.028 12.228 111.555 12.228 L 102.288 12.228 C 99.37 12.228 97.716 13.149 97.306 15.318 L 96.733 18.754 L 118.601 18.754 L 115.872 21.647 L 92.865 21.647 Z M 121.688 21.504 C 121.141 21.504 120.73 21.184 120.73 20.667 C 120.73 19.955 121.349 19.55 122.039 19.55 C 122.606 19.55 123.029 19.851 123.029 20.367 C 123.029 21.079 122.411 21.504 121.681 21.504 L 121.688 21.504 Z M 129.769 21.347 L 131.222 19.727 L 139.479 19.727 L 135.455 11.477 L 127.086 21.347 L 124.82 21.347 L 134.497 10.02 C 134.816 9.648 135.292 9.289 135.878 9.289 C 136.464 9.289 136.816 9.609 137.011 10.02 L 142.611 21.347 L 129.763 21.347 L 129.769 21.347 Z M 144.975 21.347 L 147.085 9.452 L 149 9.452 L 146.89 21.347 L 144.975 21.347 Z"
fill="currentColor"
fillRule="nonzero"
/>
</svg>
);
}
+62
View File
@@ -0,0 +1,62 @@
"use client";
/**
* 게이트 ①·③ 자동 승인 — (a) 시작 화면 옵션으로 확정(2026-08-28).
* <AutoApprovePanel /> /playreel 시작 화면: 스위치 2개 + 잠긴 2·4·5단계 안내. 되돌리는 자리도 여기.
* 아이콘은 SVG만(이모지 금지).
*/
import { GATE_META, type GateKey } from "@/lib/playreel";
import { AUTO_APPROVABLE, setAutoApprove, useAutoApprove, type AutoApprovable } from "@/lib/prefs";
export const isAutoApprovable = (g: GateKey | null | undefined): g is AutoApprovable =>
!!g && (AUTO_APPROVABLE as readonly string[]).includes(g);
const AUTO_COPY: Record<AutoApprovable, string> = {
fetch_confirm: "무료 · 상세페이지에서 읽은 정보와 기본 섹션을 그대로 사용",
narration_confirm: "무료 · 자동 생성 문장과 기본 목소리로 바로 진행",
};
const Lock = () => (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden style={{ flexShrink: 0 }}>
<rect x="4" y="11" width="16" height="10" rx="2" /><path d="M8 11V7a4 4 0 0 1 8 0v4" />
</svg>
);
function Switch({ on, onChange, label }: { on: boolean; onChange: (v: boolean) => void; label: string }) {
return (
<button type="button" role="switch" aria-checked={on} aria-label={label} className={`switch${on ? " on" : ""}`} onClick={() => onChange(!on)}>
<span className="switch-knob" />
</button>
);
}
export function AutoApprovePanel() {
const prefs = useAutoApprove();
return (
<div>
<p className="field-label" style={{ margin: "0 0 0.75rem" }}>자동화 승인 단계 설정</p>
<div className="card" style={{ padding: "0.5rem 1rem" }}>
{AUTO_APPROVABLE.map((g) => {
const m = GATE_META[g];
return (
<div key={g} className="pref-row">
<div style={{ minWidth: 0 }}>
<p style={{ margin: 0, fontSize: "var(--text-sm)", fontWeight: 600 }}>{m.step}단계 · {m.name}</p>
<p style={{ margin: "2px 0 0", fontSize: "var(--text-xs)", color: "var(--color-text-gray-500)" }}>{AUTO_COPY[g]}</p>
</div>
<Switch on={!!prefs[g]} onChange={(v) => setAutoApprove(g, v)} label={`${m.name} 자동 승인`} />
</div>
);
})}
<div className="pref-row" style={{ opacity: 0.55 }}>
<div style={{ minWidth: 0 }}>
<p style={{ margin: 0, fontSize: "var(--text-sm)", fontWeight: 600 }}>2 · 4 · 5단계</p>
<p style={{ margin: "2px 0 0", fontSize: "var(--text-xs)", color: "var(--color-text-gray-500)" }}>크레딧이 들거나 되돌릴 수 없어 항상 확인합니다</p>
</div>
<span style={{ color: "var(--color-text-gray-500)" }}><Lock /></span>
</div>
</div>
</div>
);
}
+268
View File
@@ -0,0 +1,268 @@
"use client";
/**
* 컨펌 게이트 카드 — PLAYREEL_JOURNEY.md §2 의 공통 구조.
* [eyebrow] n/5 · 이름 [title] [why] [body] [actions] [cost]
* 게이트별 본문은 아래 5개 컴포넌트. 편집값은 `edits` 로 부모에게 올려 approve 시 함께 보낸다.
*/
import { useState } from "react";
import {
GATE_META, type AnalysisReview, type ClipReview, type FetchReview, type FinalReview,
type GateKey, type GateReview, type NarrationReview,
} from "@/lib/playreel";
// ── 공통 셸 ──────────────────────────────────────────────────────────
export function GateShell({ gate, children, onApprove, onBack, busy, error, approveLabel }: {
gate: GateKey; children: React.ReactNode;
onApprove: () => void; onBack?: () => void; busy: boolean; error: string | null; approveLabel?: string;
}) {
const g = GATE_META[gate];
return (
<div>
<p className="eyebrow" style={{ margin: 0, color: "var(--color-mint)", fontSize: "var(--text-sm)" }}>
확인 {g.step} / 5 · {g.name}
</p>
<h2 style={{ margin: "0.4rem 0 0.5rem", fontSize: "var(--text-2xl)", fontWeight: 700, letterSpacing: "-0.02em" }}>{g.title}</h2>
<p style={{ margin: "0 0 1.5rem", fontSize: "var(--text-base)", color: "var(--color-text-gray-400)", lineHeight: 1.6 }}>{g.why}</p>
{children}
<div className="gate-actions">
<button className="btn-cta btn-lg" disabled={busy} onClick={onApprove}>
{busy ? "처리 중…" : (approveLabel ?? "승인하고 계속")}
</button>
{g.canBack && onBack && (
<button className="btn-outline btn-lg" disabled={busy} onClick={onBack}>‹ 이전 단계로</button>
)}
</div>
<p style={{ margin: "0.75rem 0 0", fontSize: "var(--text-sm)", color: "var(--color-text-gray-500)" }}>
다음 단계 · {g.next} · {g.eta}
{g.credits > 0 && <> · <strong style={{ color: "#ffd27a" }}>{g.credits}크레딧</strong></>}
</p>
{error && <p style={{ color: "#ff7a7a", fontSize: "var(--text-sm)", marginTop: "0.75rem" }}>{error}</p>}
</div>
);
}
// ── 작은 공용 조각 (아이콘은 SVG만 — 이모지 금지) ─────────────────────
const Ico = ({ d, size = 12 }: { d: string; size?: number }) => (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" aria-hidden style={{ flexShrink: 0 }}>
<path d={d} />
</svg>
);
const CHECK = "M20 6 9 17l-5-5";
const CROSS = "M18 6 6 18M6 6l12 12";
const PLUS = "M12 5v14M5 12h14";
const Lock = ({ size = 12 }: { size?: number }) => (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden style={{ flexShrink: 0 }}>
<rect x="4" y="11" width="16" height="10" rx="2" /><path d="M8 11V7a4 4 0 0 1 8 0v4" />
</svg>
);
function Chip({ on, onClick, children, locked }: { on: boolean; onClick?: () => void; children: React.ReactNode; locked?: boolean }) {
return (
<button type="button" onClick={locked ? undefined : onClick}
style={{
display: "inline-flex", alignItems: "center", gap: 6,
padding: "0.35rem 0.8rem", borderRadius: 999, cursor: locked ? "default" : "pointer", fontSize: "var(--text-sm)",
border: on ? "1px solid var(--color-mint)" : "1px solid var(--color-border-white-10)",
background: on ? "var(--color-mint-20)" : "transparent",
color: on ? "var(--color-mint)" : "var(--color-text-gray-400)", opacity: locked ? 0.85 : 1,
}}>
{locked ? <Lock /> : on ? <Ico d={CHECK} /> : <Ico d={PLUS} />}{children}
</button>
);
}
function Warn({ children }: { children: React.ReactNode }) {
return (
<p style={{ margin: "0.75rem 0 0", padding: "0.6rem 0.9rem", borderRadius: "var(--radius-md)", background: "rgba(255,210,122,0.1)", border: "1px solid rgba(255,210,122,0.35)", color: "#ffd27a", fontSize: "var(--text-sm)", lineHeight: 1.5 }}>
{children}
</p>
);
}
const two = { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))", gap: "var(--spacing-page-md)", alignItems: "start" } as const;
// ── ① 수집 확인 ───────────────────────────────────────────────────────
export function FetchGate({ data, onChange }: { data: FetchReview; onChange: (edits: { sections: string[]; meta: FetchReview["meta"] }) => void }) {
const [sections, setSections] = useState(data.sections);
const [meta, setMeta] = useState(data.meta);
const emit = (s = sections, m = meta) => onChange({ sections: s.filter((x) => x.selected).map((x) => x.id), meta: m });
return (
<div style={two}>
<div>
<p className="field-label" style={{ margin: "0 0 0.5rem" }}>공연 정보</p>
{([["title", "공연명"], ["date_text", "일시"], ["place", "장소"]] as const).map(([k, label]) => (
<div key={k} style={{ display: "flex", alignItems: "center", gap: "0.75rem", marginBottom: "0.5rem" }}>
<span style={{ width: 52, flexShrink: 0, fontSize: "var(--text-sm)", color: "var(--color-text-gray-400)" }}>{label}</span>
<input className="input" style={{ height: 44 }} value={meta[k]}
onChange={(e) => { const m = { ...meta, [k]: e.target.value }; setMeta(m); emit(sections, m); }} />
</div>
))}
<p style={{ margin: "0.5rem 0 0", fontSize: "var(--text-sm)", color: "var(--color-text-gray-400)" }}>
캐스트 · {meta.cast.join(", ")}
</p>
<p className="field-label" style={{ margin: "1.5rem 0 0.5rem" }}>영상에 넣을 상세페이지 부분</p>
<div style={{ display: "flex", flexWrap: "wrap", gap: "0.5rem" }}>
{sections.map((s) => (
<Chip key={s.id} on={s.selected} locked={s.required}
onClick={() => { const n = sections.map((x) => x.id === s.id ? { ...x, selected: !x.selected } : x); setSections(n); emit(n); }}>
{s.label}
</Chip>
))}
</div>
<p style={{ margin: "0.6rem 0 0", fontSize: "var(--text-xs)", color: "var(--color-text-gray-500)", display: "flex", alignItems: "center", gap: 6 }}>
<Lock size={11} /> 캐스팅 스케줄은 항상 포함됩니다.
</p>
{data.poster_width <= 800 && (
<Warn>포스터가 {data.poster_width}px로 작습니다. 다음 단계에서 화질을 2배 보정합니다(2크레딧). 원본 파일이 있으면 무빙포스터 경로에서 직접 올리는 편이 더 선명합니다.</Warn>
)}
</div>
<div>
<p className="field-label" style={{ margin: "0 0 0.5rem" }}>포스터</p>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={data.poster_url} alt="포스터" className="card-inner" style={{ width: "100%", maxWidth: 300, padding: 0, display: "block" }} />
</div>
</div>
);
}
// ── ② 연출 확인 ───────────────────────────────────────────────────────
export function AnalysisGate({ data, onChange }: { data: AnalysisReview; onChange: (edits: { movable: string[]; fixed: string[]; model: string }) => void }) {
const [movable, setMovable] = useState(data.movable);
const [fixed, setFixed] = useState(data.fixed);
const emit = (m = movable, f = fixed) => onChange({ movable: m.filter((x) => x.on).map((x) => x.key), fixed: f.filter((x) => x.on).map((x) => x.key), model: data.model });
return (
<div style={two}>
<div>
<p className="field-label" style={{ margin: "0 0 0.5rem" }}>움직일 요소</p>
<p style={{ margin: "0 0 0.6rem", fontSize: "var(--text-sm)", color: "var(--color-text-gray-400)" }}>카메라는 움직이지 않습니다. 빛·안개·천 같은 요소만 살아납니다.</p>
<div style={{ display: "flex", flexWrap: "wrap", gap: "0.5rem" }}>
{movable.map((m) => (
<Chip key={m.key} on={m.on} onClick={() => { const n = movable.map((x) => x.key === m.key ? { ...x, on: !x.on } : x); setMovable(n); emit(n); }}>{m.label}</Chip>
))}
</div>
<p className="field-label" style={{ margin: "1.5rem 0 0.5rem" }}>원본 그대로 고정</p>
<p style={{ margin: "0 0 0.6rem", fontSize: "var(--text-sm)", color: "var(--color-text-gray-400)" }}>생성된 화면 위에 원본 픽셀을 다시 덮습니다. 제목은 한 픽셀도 바뀌지 않습니다.</p>
<div style={{ display: "flex", flexWrap: "wrap", gap: "0.5rem" }}>
{fixed.map((f) => (
<Chip key={f.key} on={f.on} locked={f.key === "title"} onClick={() => { const n = fixed.map((x) => x.key === f.key ? { ...x, on: !x.on } : x); setFixed(n); emit(movable, n); }}>{f.label}</Chip>
))}
</div>
<p className="field-label" style={{ margin: "1.5rem 0 0.5rem" }}>생성 모델</p>
<p style={{ margin: 0, fontSize: "var(--text-sm)", color: "var(--color-text-gray-300)" }}>Kling 3.0 pro · 8초 · 14크레딧</p>
{data.ip_risk && <Warn>알려진 IP(디즈니 등) 작품입니다. 다른 모델은 저작권 필터로 거부된 이력이 있어 Kling으로만 진행합니다. 실패하면 아트워크 푸시인으로 대체됩니다.</Warn>}
{!data.has_qr && <p style={{ margin: "0.6rem 0 0", fontSize: "var(--text-xs)", color: "var(--color-text-gray-500)" }}>포스터에 QR이 없어 엔딩 밴드 QR은 상품 페이지 링크로 자동 생성합니다.</p>}
</div>
<div>
<p className="field-label" style={{ margin: "0 0 0.5rem" }}>요소 분석 (5% 격자)</p>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={data.grid_url} alt="격자 오버레이" className="card-inner" style={{ width: "100%", maxWidth: 300, padding: 0, display: "block" }} />
</div>
</div>
);
}
// ── ③ 나레이션·보이스 확인 ────────────────────────────────────────────
export function NarrationGate({ data, onChange }: { data: NarrationReview; onChange: (edits: { lines: string[]; voice_id: string }) => void }) {
const [lines, setLines] = useState(data.lines);
const lenOk = data.est_seconds >= 28 && data.est_seconds <= 31;
return (
<div style={two}>
<div>
<p className="field-label" style={{ margin: "0 0 0.5rem" }}>나레이션 8문장</p>
{lines.map((l, i) => (
<div key={i} className="narr-row">
<span className="narr-slot" style={{ color: l.slot === "캐스팅 스케줄" ? "var(--color-mint)" : "var(--color-text-gray-400)" }}>{l.slot}</span>
<input className="input" style={{ height: 42, fontSize: "var(--text-sm)" }} value={l.text}
onChange={(e) => { const n = lines.map((x, j) => j === i ? { ...x, text: e.target.value } : x); setLines(n); onChange({ lines: n.map((x) => x.text), voice_id: data.voice.id }); }} />
</div>
))}
</div>
<div>
<p className="field-label" style={{ margin: "0 0 0.5rem" }}>목소리</p>
<div className="card-inner">
<p style={{ margin: 0, fontWeight: 700 }}>{data.voice.name}</p>
{data.voice.sample_url
? <audio controls src={data.voice.sample_url} style={{ width: "100%", marginTop: "0.6rem" }} />
: <p style={{ margin: "0.5rem 0 0", fontSize: "var(--text-sm)", color: "var(--color-text-gray-500)" }}>샘플 준비 중</p>}
</div>
<p className="field-label" style={{ margin: "1.25rem 0 0.5rem" }}>예상 길이</p>
<p style={{ margin: 0, fontSize: "var(--text-2xl)", fontWeight: 700, color: lenOk ? "var(--color-mint)" : "#ffd27a" }}>
{data.est_seconds.toFixed(1)}초
</p>
<p style={{ margin: "0.25rem 0 0", fontSize: "var(--text-sm)", color: "var(--color-text-gray-500)" }}>목표 28~31초{!lenOk && " — 문장을 줄이거나 늘려주세요"}</p>
</div>
</div>
);
}
// ── ④ 클립 검수 ───────────────────────────────────────────────────────
export function ClipGate({ data }: { data: ClipReview }) {
return (
<div style={two}>
<div className="card-inner" style={{ display: "flex", alignItems: "center", justifyContent: "center", minHeight: 320 }}>
{data.clip_url
? <video src={data.clip_url} controls style={{ width: "100%", maxHeight: 520, borderRadius: "var(--radius-md)" }} />
: <p style={{ color: "var(--color-text-gray-500)", fontSize: "var(--text-sm)" }}>생성 클립 8초</p>}
</div>
<div>
<p className="field-label" style={{ margin: "0 0 0.5rem" }}>제목 훼손 검사</p>
<div className="card-inner" style={{ borderColor: data.gate_passed ? "var(--color-mint-30)" : "rgba(255,122,122,0.4)" }}>
<p style={{ margin: 0, fontSize: "var(--text-xl)", fontWeight: 700, color: data.gate_passed ? "var(--color-mint)" : "#ff8c8c" }}>
{data.gate_passed ? "통과" : "실패"} · 제목대 편차 {data.title_mae.toFixed(2)}
</p>
<p style={{ margin: "0.35rem 0 0", fontSize: "var(--text-sm)", color: "var(--color-text-gray-400)" }}>기준 4.0 이하. 원본 제목과 픽셀 단위로 비교한 값입니다.</p>
{data.gate_reason && <p style={{ margin: "0.5rem 0 0", fontSize: "var(--text-sm)", color: "#ffb37a" }}>{data.gate_reason}</p>}
</div>
<p className="field-label" style={{ margin: "1.25rem 0 0.5rem" }}>5시점 프레임</p>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={data.frames_url} alt="프레임 시트" className="card-inner" style={{ width: "100%", padding: 0, display: "block" }} />
<Warn>다시 만들기는 영상 생성을 처음부터 반복하며 {data.retry_credits}크레딧이 다시 듭니다. 이 클립 위에 원본 글자를 덮는 합성은 무료입니다.</Warn>
</div>
</div>
);
}
// ── ⑤ 최종 검수 ───────────────────────────────────────────────────────
export function FinalGate({ data }: { data: FinalReview }) {
return (
<div style={two}>
<div className="card-inner" style={{ display: "flex", alignItems: "center", justifyContent: "center", minHeight: 420 }}>
{data.video_url
? <video src={data.video_url} controls style={{ width: "100%", maxHeight: 560, borderRadius: "var(--radius-md)" }} />
: <p style={{ color: "var(--color-text-gray-500)", fontSize: "var(--text-sm)" }}>완성본 {data.duration.toFixed(1)}초</p>}
</div>
<div>
<p className="field-label" style={{ margin: "0 0 0.5rem" }}>자동 확인 항목</p>
{data.checks.map((c) => (
<p key={c.key} style={{ margin: "0.3rem 0", fontSize: "var(--text-base)", color: c.ok ? "var(--color-text-gray-300)" : "#ff8c8c", display: "flex", alignItems: "center", gap: 8 }}>
<span style={{ color: c.ok ? "var(--color-mint)" : "#ff8c8c", display: "inline-flex" }}><Ico d={c.ok ? CHECK : CROSS} size={14} /></span>{c.label}
</p>
))}
<p className="field-label" style={{ margin: "1.25rem 0 0.5rem" }}>proof 시트</p>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={data.proof_url} alt="proof" className="card-inner" style={{ width: "100%", padding: 0, display: "block" }} />
<p style={{ margin: "0.75rem 0 0", fontSize: "var(--text-sm)", color: "var(--color-text-gray-500)" }}>승인하면 v{data.version}으로 고정됩니다.</p>
</div>
</div>
);
}
/** review 페이로드 → 게이트 본문. edits 콜백은 승인 시 부모가 모아 보낸다. */
export function GateBody({ review, onEdits }: { review: GateReview; onEdits: (e: unknown) => void }) {
switch (review.gate) {
case "fetch_confirm": return <FetchGate data={review.data} onChange={onEdits} />;
case "analysis_confirm": return <AnalysisGate data={review.data} onChange={onEdits} />;
case "narration_confirm": return <NarrationGate data={review.data} onChange={onEdits} />;
case "clip_confirm": return <ClipGate data={review.data} />;
case "final_confirm": return <FinalGate data={review.data} />;
}
}
+88
View File
@@ -0,0 +1,88 @@
/** 템플릿 배포 등급 표시.
*
* 페이지 전체 배너를 쓰던 때는 전 템플릿이 내부 전용이라 그걸로 충분했다.
* 퍼블릭 도메인 명화가 섞이면 배너로는 어느 결과물이 공개 가능한지 구분이 안 되므로
* 등급을 **카드 단위로** 붙이고, 경고는 내부 전용을 실제로 고른 순간에만 띄운다.
*/
export type License = "public-domain" | "internal-only" | "user-uploaded";
const STYLES: Record<License, { label: string; fg: string; bg: string; bd: string }> = {
"public-domain": {
label: "공개 가능",
fg: "var(--color-mint)",
bg: "var(--color-mint-10)",
bd: "var(--color-mint-30)",
},
"internal-only": {
label: "내부 전용",
fg: "#ffc9a3",
bg: "rgba(255, 154, 90, 0.12)",
bd: "rgba(255, 154, 90, 0.35)",
},
// 내부 전용과 색을 나눈다 — 끄는 조건이 다르고, 책임 주체도 다르다
"user-uploaded": {
label: "권리 미확인",
fg: "#c9b6ff",
bg: "rgba(166, 130, 255, 0.14)",
bd: "rgba(166, 130, 255, 0.38)",
},
};
export function LicenseBadge({ license }: { license: License }) {
const s = STYLES[license] ?? STYLES["internal-only"];
return (
<span style={{
display: "inline-block",
padding: "0.1rem 0.45rem",
borderRadius: "var(--radius-full)",
border: `1px solid ${s.bd}`,
background: s.bg,
color: s.fg,
fontSize: "var(--text-xs)",
fontWeight: 700,
whiteSpace: "nowrap",
lineHeight: 1.5,
}}>
{s.label}
</span>
);
}
/** 내부 전용을 고른 순간에만 뜨는 경고. 항상 떠 있으면 아무도 안 읽는다. */
export function InternalOnlyWarning({ note }: { note?: string }) {
return (
<div style={{
background: STYLES["internal-only"].bg,
border: `1px solid ${STYLES["internal-only"].bd}`,
borderRadius: "var(--radius-xl)",
padding: "0.75rem 1.25rem",
fontSize: "var(--text-base)",
color: "var(--color-text-gray-300)",
lineHeight: 1.6,
}}>
<strong style={{ color: STYLES["internal-only"].fg }}>내부 전용 템플릿</strong>
{" — "}
{note || "이 레퍼런스로 만든 결과물은 외부 공개·상업 사용을 금합니다."}
</div>
);
}
/** 사용자가 올린 레퍼런스에 대한 고지. 남의 저작물일 수 있다. */
export function UserReferenceNotice() {
return (
<div style={{
background: STYLES["user-uploaded"].bg,
border: `1px solid ${STYLES["user-uploaded"].bd}`,
borderRadius: "var(--radius-xl)",
padding: "0.75rem 1.25rem",
fontSize: "var(--text-sm)",
color: "var(--color-text-gray-300)",
lineHeight: 1.6,
}}>
직접 올린 레퍼런스는 <strong style={{ color: STYLES["user-uploaded"].fg }}>권리를 가진 이미지만</strong> 사용하세요.
타인의 저작물을 올려 생긴 문제의 책임은 업로드한 사람에게 있습니다.
결과물은 권리 미확인으로 분류됩니다. 긴 변 600px 이상이면 결과가 좋습니다.
</div>
);
}
+27
View File
@@ -0,0 +1,27 @@
import type { PosterMeta } from "@/lib/api";
/** bare=true면 카드 래핑 없이 내용만 (완료 화면 우측 정보 컬럼용) */
export default function MetadataCard({ meta, bare = false }: { meta: PosterMeta; bare?: boolean }) {
const body = (
<>
<p className="field-label" style={{ margin: 0 }}>메타태그</p>
<h3 style={{ margin: "0.25rem 0 0", fontSize: "var(--text-lg)", fontWeight: 700 }}>{meta.event_name}</h3>
<dl style={{
margin: "0.75rem 0 0", display: "grid", gridTemplateColumns: "64px 1fr",
rowGap: "0.4rem", fontSize: "var(--text-base)",
}}>
<dt style={{ color: "var(--color-text-gray-400)" }}>일시</dt>
<dd style={{ margin: 0, whiteSpace: "pre-line" }}>{meta.date_text}</dd>
<dt style={{ color: "var(--color-text-gray-400)" }}>장소</dt>
<dd style={{ margin: 0 }}>{meta.place}</dd>
<dt style={{ color: "var(--color-text-gray-400)" }}>분류</dt>
<dd style={{ margin: 0 }}>{meta.category}{meta.region_guess ? ` · ${meta.region_guess}` : ""}</dd>
</dl>
<div style={{ marginTop: "0.75rem", display: "flex", flexWrap: "wrap", gap: "0.5rem" }}>
{meta.keywords.map((k) => <span key={k} className="tag">{k}</span>)}
</div>
</>
);
if (bare) return <div>{body}</div>;
return <div className="card">{body}</div>;
}
+38
View File
@@ -0,0 +1,38 @@
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
const ICONS: Record<string, React.ReactNode> = {
video: (
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<rect x="2" y="5" width="14" height="14" rx="2" />
<path d="M22 8.5 16 12l6 3.5v-7Z" />
</svg>
),
image: (
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<rect x="3" y="3" width="18" height="18" rx="2" />
<circle cx="9" cy="9" r="2" />
<path d="m21 15-4.5-4.5L7 20" />
</svg>
),
folder: (
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9L9.2 3.9A2 2 0 0 0 7.5 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
</svg>
),
};
export default function NavLink({ href, icon, children }: {
href: string; icon?: string; children: React.ReactNode;
}) {
const pathname = usePathname();
const active = href === "/" ? pathname === "/" || pathname.startsWith("/poster") || pathname.startsWith("/playreel") : pathname.startsWith(href);
return (
<Link href={href} className={active ? "sidebar-item active" : "sidebar-item"}>
{icon && ICONS[icon]}
<span>{children}</span>
</Link>
);
}
+106
View File
@@ -0,0 +1,106 @@
"use client";
import { useCallback, useRef, useState } from "react";
interface Props {
file: File | null;
onFile: (f: File | null) => void;
}
/* 고해상도 원본 수급이 어려운 현실을 반영해 해상도는 차단하지 않는다.
낮으면 알려만 주고 업로드는 그대로 진행시킨다. */
const SOFT_LONG_EDGE = 1000;
export default function PosterDropzone({ file, onFile }: Props) {
const inputRef = useRef<HTMLInputElement>(null);
const [preview, setPreview] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null);
const [notice, setNotice] = useState<string | null>(null);
const [dragging, setDragging] = useState(false);
const accept = useCallback((f: File) => {
if (!/^image\/(jpeg|png|webp|gif)$/.test(f.type)) {
setError("JPG / PNG / WEBP / GIF 파일만 올릴 수 있습니다.");
return;
}
setError(null);
const url = URL.createObjectURL(f);
const img = new Image();
img.onload = () => {
const edge = Math.max(img.width, img.height);
setNotice(edge < SOFT_LONG_EDGE
? `긴 변 ${edge}px입니다. 그대로 진행할 수 있고, 깊은 줌 구간만 다소 부드럽게 보일 수 있습니다.`
: null);
setPreview(url);
onFile(f);
};
img.src = url;
}, [onFile]);
return (
<div>
<div
className="card-inner"
onClick={() => inputRef.current?.click()}
onDragOver={(e) => { e.preventDefault(); setDragging(true); }}
onDragLeave={() => setDragging(false)}
onDrop={(e) => {
e.preventDefault();
setDragging(false);
const f = e.dataTransfer.files?.[0];
if (f) accept(f);
}}
style={{
// 포스터는 세로물 — 입력창도 4:5 세로 비율이어야 직관적
aspectRatio: "4 / 5",
maxWidth: 400,
margin: "0 auto",
display: "flex",
alignItems: "center",
justifyContent: "center",
overflow: "hidden",
padding: preview ? 0 : "var(--s-5)",
textAlign: "center",
cursor: "pointer",
borderStyle: preview ? "solid" : "dashed",
borderColor: dragging ? "var(--color-mint)" : "var(--color-border-gray-700)",
background: dragging ? "var(--color-mint-10)" : "rgba(18, 26, 29, 0.4)",
}}
>
{preview ? (
// eslint-disable-next-line @next/next/no-img-element
<img src={preview} alt="포스터 미리보기" style={{ width: "100%", height: "100%", objectFit: "contain" }} />
) : (
<div>
<p style={{ fontSize: 16, fontWeight: 700, margin: 0, lineHeight: 1.5 }}>
포스터를 끌어다 놓거나<br />클릭해서 선택
</p>
<p style={{ fontSize: "var(--text-sm)", color: "var(--color-text-gray-400)", marginTop: "0.75rem" }}>
JPG · PNG · WEBP · GIF<br />해상도 제한 없음
</p>
</div>
)}
<input
ref={inputRef}
type="file"
accept="image/jpeg,image/png,image/webp,image/gif"
hidden
onChange={(e) => { const f = e.target.files?.[0]; if (f) accept(f); }}
/>
</div>
{error && (
<p style={{ fontSize: "var(--text-sm)", color: "#ff7a7a", marginTop: "0.75rem" }}>{error}</p>
)}
{notice && (
<p style={{ fontSize: "var(--text-sm)", color: "var(--color-text-gray-400)", marginTop: "0.75rem", lineHeight: 1.5 }}>
{notice}
</p>
)}
{file && (
<p style={{ fontSize: "var(--text-sm)", color: "var(--color-text-gray-400)", marginTop: "0.5rem" }}>
{file.name} · {(file.size / 1024 / 1024).toFixed(1)}MB
</p>
)}
</div>
);
}
+63
View File
@@ -0,0 +1,63 @@
"use client";
import type { Job } from "@/lib/api";
/* 프로덕트 wizard-stepper 패턴: 완료=민트 체크, 현재=민트 링+글로우, 대기=회색 번호 */
const STAGE_LABELS: Record<string, string> = {
detect: "분석",
narration_text: "나레이션",
tts: "음성",
bgm: "음악",
motion: "모션 선정",
i2v: "애니메이션",
render: "렌더",
transfer: "변환",
};
const Check = () => (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3.5" strokeLinecap="round" strokeLinejoin="round">
<path d="M20 6 9 17l-5-5" />
</svg>
);
export default function StageStepper({ job, labels }: { job: Pick<Job, "stages" | "status">; labels?: Record<string, string> }) {
const L = labels ?? STAGE_LABELS;
const entries = Object.entries(job.stages);
// 검수 대기 중에는 "아직 끝나지 않은 첫 스테이지"가 현재다.
// 스테이지명을 박아두면 게이트가 늘 때마다 여기가 조용히 틀어진다.
const firstPending = entries.find(([, st]) => st.status !== "done")?.[0];
return (
<div className="wizard-stepper">
{entries.map(([key, st], i) => {
const cls =
st.status === "done" ? "done" :
st.status === "failed" ? "failed" :
st.status === "running" || (job.status === "awaiting_review" && key === firstPending) ? "current" :
"pending";
return (
<div key={key} style={{ display: "contents" }}>
{i > 0 && (
<div className={entries[i - 1][1].status === "done" ? "wizard-step-line done" : "wizard-step-line"} />
)}
<div className={`wizard-step ${cls}`}>
<div className="wizard-stepper-node">
{st.status === "done" ? <Check /> : i + 1}
</div>
<div className="wizard-stepper-label">{L[key] ?? key}</div>
</div>
</div>
);
})}
</div>
);
}
/** 스테이지 진행률 (%) — 선형 진행바용 */
export function stageProgress(job: Pick<Job, "stages">): number {
const sts = Object.values(job.stages);
const done = sts.filter((s) => s.status === "done").length;
const running = sts.some((s) => s.status === "running") ? 0.5 : 0;
return Math.round(((done + running) / sts.length) * 100);
}