diff --git a/public/demo-day/restore1.jpg b/public/demo-day/restore1.jpg new file mode 100644 index 00000000..bf885c38 Binary files /dev/null and b/public/demo-day/restore1.jpg differ diff --git a/public/demo-day/restore2.jpg b/public/demo-day/restore2.jpg new file mode 100644 index 00000000..24fcd9ad Binary files /dev/null and b/public/demo-day/restore2.jpg differ diff --git a/public/demo-day/restore3.jpg b/public/demo-day/restore3.jpg new file mode 100644 index 00000000..81dae959 Binary files /dev/null and b/public/demo-day/restore3.jpg differ diff --git a/public/demo-day/restore4.jpg b/public/demo-day/restore4.jpg new file mode 100644 index 00000000..cea1bc86 Binary files /dev/null and b/public/demo-day/restore4.jpg differ diff --git a/src/index.css b/src/index.css index 41193b4b..6fc0e199 100644 --- a/src/index.css +++ b/src/index.css @@ -146,6 +146,76 @@ animation: toast-out 0.1s ease-in forwards; } +/* DEMO-DAY 애니메이션 (제거 시 이 블록 전체 삭제) */ +@keyframes demoday-fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +@keyframes demoday-slide-up { + from { + opacity: 0; + transform: translateY(1rem); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes demoday-reveal { + from { + opacity: 1; + } + to { + opacity: 0; + } +} + +@keyframes demoday-tint { + 0% { + opacity: 0.75; + } + 60% { + opacity: 0.3; + } + 100% { + opacity: 0; + } +} + +.animate-demoday-fade-in { + animation: demoday-fade-in 0.6s ease-out both; +} + +.animate-demoday-slide-up { + animation: demoday-slide-up 0.5s ease-out both; +} + +.animate-demoday-reveal { + animation: demoday-reveal 1.8s ease-out both; + will-change: opacity; +} + +.animate-demoday-tint { + animation: demoday-tint 2.4s ease-out both; + will-change: opacity; +} + +.film-strip { + background: linear-gradient(180deg, #1c1810 0%, #1a1712 50%, #1c1810 100%); + border-left: 1px solid rgba(80, 70, 50, 0.3); + border-right: 1px solid rgba(80, 70, 50, 0.3); + box-shadow: + inset 0 0 20px rgba(0, 0, 0, 0.5), + 0 2px 12px rgba(0, 0, 0, 0.4); +} +/* DEMO-DAY 애니메이션 끝 */ + .bg-splash-gradient { background: radial-gradient( diff --git a/src/pages/auth/KakaoCallbackPage.tsx b/src/pages/auth/KakaoCallbackPage.tsx index baabca14..c27a24bb 100644 --- a/src/pages/auth/KakaoCallbackPage.tsx +++ b/src/pages/auth/KakaoCallbackPage.tsx @@ -1,6 +1,7 @@ import { useEffect } from "react"; import { useNavigate, useLocation } from "react-router"; import { useKakaoOauth } from "@/hooks/auth/login"; +import { consumeRedirectAfterLogin } from "@/pages/demoDay/redirectAfterLogin"; // DEMO-DAY export function KakaoCallbackPage() { const navigate = useNavigate(); @@ -32,7 +33,11 @@ export function KakaoCallbackPage() { //2. 신규 회원: 온보딩 화면으로 리다이렉 //3. 실패시 login 페이지로 리다이렉 const { isPending } = useKakaoOauth({ - onExistingMember: () => navigate("/mainpage", { replace: true }), + onExistingMember: () => { + // DEMO-DAY: 원래는 navigate("/mainpage", { replace: true }) + const redirect = consumeRedirectAfterLogin(); + navigate(redirect ?? "/mainpage", { replace: true }); + }, onNewMember: () => navigate("/auth/onboarding", { replace: true }), onFail: () => navigate("/auth/login", { replace: true }), }); diff --git a/src/pages/demoDay/DemoDayPage.tsx b/src/pages/demoDay/DemoDayPage.tsx new file mode 100644 index 00000000..af0c9901 --- /dev/null +++ b/src/pages/demoDay/DemoDayPage.tsx @@ -0,0 +1,235 @@ +import { useCallback, useEffect, useState } from "react"; +import { useNavigate } from "react-router"; + +import Header from "@/components/common/Header"; +import { RestoraionSparkleIcon } from "@/assets/icon"; +import { useAuthStore } from "@/store/useAuth.store"; +import { useLoginModalStore } from "@/store/useLoginModal.store"; + +import { setRedirectAfterLogin } from "./redirectAfterLogin"; + +// ─── 데모 이미지 설정 (파일 추가 후 여기만 수정) ─── +const DEMO_IMAGES = [ + { src: "/demo-day/restore1.jpg", label: "사진 1" }, + { src: "/demo-day/restore2.jpg", label: "사진 2" }, + { src: "/demo-day/restore3.jpg", label: "사진 3" }, + { src: "/demo-day/restore4.jpg", label: "사진 4" }, +] as const; + +const FRAME_CODES = ["15", "16", "17", "18"]; + +const PENDING_KEY = "finders:demoday-pending-image"; + +export default function DemoDayPage() { + const navigate = useNavigate(); + const user = useAuthStore((s) => s.user); + const openLoginModal = useLoginModalStore((s) => s.openLoginModal); + + // ─── 로그인 후 자동 복원 진행 ─── + useEffect(() => { + const pendingRaw = sessionStorage.getItem(PENDING_KEY); + if (!pendingRaw) return; + if (!user) return; + + sessionStorage.removeItem(PENDING_KEY); + const index = Number(pendingRaw); + const image = DEMO_IMAGES[index]; + if (!image) return; + + navigate("/restore/editor", { + state: { imageUrl: image.src }, + }); + }, [user, navigate]); + + const handleRestore = useCallback( + (index: number) => { + const image = DEMO_IMAGES[index]; + if (!image) return; + + const isAuthed = Boolean(user && user.memberId > 0); + + if (isAuthed) { + navigate("/restore/editor", { + state: { imageUrl: image.src }, + }); + } else { + sessionStorage.setItem(PENDING_KEY, String(index)); + setRedirectAfterLogin("/demo-day"); + openLoginModal(); + } + }, + [user, navigate, openLoginModal], + ); + + return ( +
+ 사진을 꾹 눌러 저장하고, 복원해 보세요 +
+