프론트엔드 변경

This commit is contained in:
jaehwang committed 2026-09-15 17:00:17 +09:00
1 parent c6c84a10ff
commit ffaa512aee
7 files changed
+103 -12

No files matched your search

+6 -2
View File
@@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import Link from "next/link";
import { apiFetch, type Job } from "@/lib/api";
import { useMe } from "@/lib/auth";
import { GATE_META, type PlayreelJob } from "@/lib/playreel";
/* 무빙포스터 진입 — 두 갈래 (MOVING_POSTER_ENTRY_PLAN.md §1·§5) */
@@ -35,10 +36,13 @@ function tone(status: string) {
}
export default function HomePage() {
const { me } = useMe();
const [recent, setRecent] = useState<Recent[]>([]);
useEffect(() => {
// 두 갈래의 최근 작업을 합쳐 최신순 6개. 한쪽 API가 없어도(playreel 미구현) 다른 쪽은 보인다.
// 잡 목록은 로그인해야 볼 수 있다. 로그인 전에는 부르지 않는다
if (!me) return;
// 두 갈래의 최근 작업을 합쳐 최신순 6개. 한쪽이 비어도 다른 쪽은 보인다.
Promise.all([
apiFetch<Job[]>("/api/f1/jobs").catch(() => [] as Job[]),
apiFetch<PlayreelJob[]>("/api/playreel/jobs").catch(() => [] as PlayreelJob[]),
@@ -50,7 +54,7 @@ export default function HomePage() {
];
setRecent(a.sort((x, y) => y.t - x.t).slice(0, 6));
});
}, []);
}, [me]);
return (
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", paddingTop: "1.5rem" }}>
+4
View File
@@ -4,10 +4,12 @@ import { useState } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import PosterDropzone from "@/components/poster-dropzone";
import { useRequireLogin } from "@/components/auth-gate";
import { apiFetch } from "@/lib/api";
export default function HomePage() {
const router = useRouter();
const requireLogin = useRequireLogin();
const [file, setFile] = useState<File | null>(null);
const [name, setName] = useState("");
const [busy, setBusy] = useState(false);
@@ -15,6 +17,8 @@ export default function HomePage() {
const submit = async () => {
if (!file) return;
// 여기서 처음으로 로그인이 필요해진다
if (!requireLogin()) return;
setBusy(true);
setError(null);
try {