add frontend
This commit is contained in:
1 parent
bc57b358f9
commit
5cd5ec5649
44 files changed
+10081
No files matched your search
@@ -0,0 +1,88 @@
|
||||
"use client";
|
||||
|
||||
import { use, useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import MetadataCard from "@/components/metadata-card";
|
||||
import { InternalOnlyWarning, LicenseBadge } from "@/components/license-badge";
|
||||
import { apiFetch, archiveKind, type ArchiveEntry } from "@/lib/api";
|
||||
|
||||
export default function ArchiveDetailPage({ params }: { params: Promise<{ slug: string }> }) {
|
||||
const { slug } = use(params);
|
||||
const [entry, setEntry] = useState<ArchiveEntry | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
apiFetch<ArchiveEntry>(`/api/archive/${slug}`).then(setEntry).catch((e) => setError(e.message));
|
||||
}, [slug]);
|
||||
|
||||
if (error) return <p style={{ color: "rgb(255,122,122)" }}>{error}</p>;
|
||||
if (!entry) return <p style={{ color: "var(--text-teal-1)" }}>불러오는 중…</p>;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={{ display: "flex", alignItems: "flex-start", marginBottom: "1rem" }}>
|
||||
<Link href="/archive" className="btn-back">‹ 아카이브</Link>
|
||||
</div>
|
||||
<span className="tag" style={{ height: 20, padding: "0 8px", fontSize: "var(--text-xs)" }}>{archiveKind(entry)}</span>
|
||||
<h1 className="page-title" style={{ textAlign: "left", margin: "0.5rem 0 1.5rem" }}>
|
||||
{entry.metadata?.event_name ?? entry.name}
|
||||
</h1>
|
||||
|
||||
<div className="archive-detail">
|
||||
<div className="card" style={{ padding: "var(--s-4)" }}>
|
||||
{entry.video_url ? (
|
||||
<video src={entry.video_url} controls style={{ width: "100%", borderRadius: "var(--r-sm)", display: "block" }} />
|
||||
) : (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img src={entry.poster_url} alt={entry.name} style={{ width: "100%", borderRadius: "var(--r-sm)" }} />
|
||||
)}
|
||||
{entry.video_url && (
|
||||
<div style={{ display: "flex", justifyContent: "center", marginTop: "var(--s-3)" }}>
|
||||
<a href={entry.video_url} download className="btn-tonal-mint">MP4 다운로드</a>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: "var(--s-5)" }}>
|
||||
{entry.metadata && <MetadataCard meta={entry.metadata} />}
|
||||
|
||||
{entry.narration && (
|
||||
<div className="card" style={{ padding: "var(--s-5)" }}>
|
||||
<p className="eyebrow" style={{ margin: "0 0 var(--s-3)" }}>
|
||||
나레이션
|
||||
</p>
|
||||
<ol style={{ margin: 0, paddingLeft: 18, fontSize: 15, lineHeight: 2 }}>
|
||||
{entry.narration.map((s, i) => <li key={i}>{s}</li>)}
|
||||
</ol>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{entry.f2_variants.length > 0 && (
|
||||
<div>
|
||||
<p className="eyebrow" style={{ margin: "0 0 var(--s-3)" }}>
|
||||
스타일 변형
|
||||
</p>
|
||||
{entry.f2_variants.some((v) => v.license === "internal-only") && (
|
||||
<InternalOnlyWarning />
|
||||
)}
|
||||
<div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(140px, 1fr))", gap: "var(--s-3)", marginTop: "var(--s-3)" }}>
|
||||
{entry.f2_variants.map((v) => (
|
||||
<div key={v.template_id} className="card" style={{ overflow: "hidden" }}>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={v.image_url} alt={v.name_ko ?? v.template_id} style={{ width: "100%", display: "block" }} />
|
||||
<div style={{ padding: "var(--s-2)", display: "flex", flexDirection: "column", alignItems: "center", gap: 4 }}>
|
||||
<p style={{ margin: 0, fontSize: 12, fontWeight: 600, color: "var(--text-teal-1)", textAlign: "center" }}>
|
||||
{v.name_ko ?? v.template_id}
|
||||
</p>
|
||||
<LicenseBadge license={v.license ?? "internal-only"} />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { apiFetch, archiveKind, type ArchiveEntry } from "@/lib/api";
|
||||
|
||||
export default function ArchivePage() {
|
||||
const [entries, setEntries] = useState<ArchiveEntry[] | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
apiFetch<ArchiveEntry[]>("/api/archive").then(setEntries).catch(() => setEntries([]));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1 className="page-title">포스터 숏폼 아카이브</h1>
|
||||
<p className="page-subtitle" style={{ marginBottom: "2rem" }}>
|
||||
만들어진 모든 포스터 숏폼이 메타태그와 함께 쌓입니다. 행사·지역·키워드로 축적되는 온라인 숏폼 광고판입니다.
|
||||
</p>
|
||||
|
||||
{entries === null && <p style={{ color: "var(--text-teal-1)" }}>불러오는 중…</p>}
|
||||
{entries?.length === 0 && <p style={{ color: "var(--text-teal-3)" }}>아직 아카이브된 영상이 없습니다.</p>}
|
||||
|
||||
<div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(220px, 1fr))", gap: "var(--s-5)" }}>
|
||||
{entries?.map((e) => (
|
||||
<Link key={e.slug} href={`/archive/${e.slug}`} style={{ textDecoration: "none", color: "inherit" }}>
|
||||
<div className="card" style={{ overflow: "hidden" }}>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={e.poster_url} alt={e.name}
|
||||
style={{ width: "100%", aspectRatio: "3/4", objectFit: "cover", display: "block" }} />
|
||||
<div style={{ padding: "var(--s-4)" }}>
|
||||
<span className="tag" style={{ height: 20, padding: "0 8px", fontSize: "var(--text-xs)", marginBottom: "var(--s-2)" }}>{archiveKind(e)}</span>
|
||||
<p style={{ margin: 0, fontSize: 15, fontWeight: 800 }}>{e.metadata?.event_name ?? e.name}</p>
|
||||
<p style={{ margin: "var(--s-1) 0 0", fontSize: 13, color: "var(--text-teal-1)" }}>
|
||||
{e.metadata?.place}{e.metadata?.category ? ` · ${e.metadata.category}` : ""}
|
||||
</p>
|
||||
<div style={{ marginTop: "var(--s-3)", display: "flex", flexWrap: "wrap", gap: "var(--s-1)" }}>
|
||||
{(e.metadata?.keywords ?? []).slice(0, 3).map((k) => (
|
||||
<span key={k} className="tag" style={{ fontSize: 12 }}>{k}</span>
|
||||
))}
|
||||
{(e.metadata?.keywords?.length ?? 0) > 3 && (
|
||||
<span className="tag" style={{ fontSize: 12 }}>+{(e.metadata!.keywords.length - 3)}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user