From fa99ea4f0864baf0832dc80c5c7b7b84d3a1fd10 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Mon, 26 Oct 2026 15:08:18 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=87=BC=EC=B8=A0=EB=A5=BC=20=EB=AA=A8?= =?UTF-8?q?=EB=8B=AC=20=EB=8C=80=EC=8B=A0=20=ED=8E=98=EC=9D=B4=EC=A7=80(/s?= =?UTF-8?q?horts/=EC=98=81=EC=83=81ID)=EB=A1=9C=20=E2=80=94=20=EB=84=98?= =?UTF-8?q?=EA=B8=B0=EB=A9=B4=20=EC=A3=BC=EC=86=8C=EB=8F=84=20=EB=B0=94?= =?UTF-8?q?=EB=80=8C=EC=96=B4=20=EA=B3=B5=EC=9C=A0=C2=B7=EB=92=A4=EB=A1=9C?= =?UTF-8?q?=20=EA=B0=80=EA=B8=B0=20=EA=B0=80=EB=8A=A5,=20=ED=97=A4?= =?UTF-8?q?=EB=8D=94=C2=B7=ED=83=AD=20=EB=B0=94=20=EC=82=AC=EC=9D=B4?= =?UTF-8?q?=EB=A5=BC=20=EC=B1=84=EC=9A=B0=EA=B3=A0=20=EB=B0=B0=EA=B2=BD?= =?UTF-8?q?=EC=9D=80=20=EC=A7=80=EA=B8=88=20=EC=98=81=EC=83=81=20=ED=91=9C?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=ED=9D=90=EB=A6=AC=EA=B2=8C=20=EA=B9=94?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.tsx | 2 + frontend/src/b/Shorts.tsx | 98 ++++++++++++++++++++++++++++++--------- 2 files changed, 77 insertions(+), 23 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index bc573d3..aad4c2a 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -3,6 +3,7 @@ import { BLayout } from './b/BLayout' import { FoliagePage } from './b/FoliagePage' import { GakPage } from './b/GakPage' import { SeasonPage } from './b/SeasonPage' +import { ShortsPage } from './b/Shorts' import { SkyPage } from './b/SkyPage' import { TalkPage } from './b/TalkPage' import { TodayPage } from './b/TodayPage' @@ -22,6 +23,7 @@ export default function App() { } /> } /> } /> + } /> } /> diff --git a/frontend/src/b/Shorts.tsx b/frontend/src/b/Shorts.tsx index 9e7e9f4..75a6d7a 100644 --- a/frontend/src/b/Shorts.tsx +++ b/frontend/src/b/Shorts.tsx @@ -1,5 +1,6 @@ import { useQuery } from '@tanstack/react-query' -import { useEffect, useRef, useState } from 'react' +import { type CSSProperties, useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from 'react' +import { Link, useNavigate, useParams } from 'react-router' import { listShortsOptions } from '../api/client/@tanstack/react-query.gen' import type { ShortItem } from '../api/client' import { cx } from '../lib/utils' @@ -11,8 +12,21 @@ const CARD_W = 120 const PLAYER_W = 200 const SCALE = (CARD_W / PLAYER_W) * 1.4 -// 전체 화면 창의 영상 칸: 닫기 줄 아래 남은 높이와 화면 너비 안에 9:16으로 맞춘다 -const FIT = { width: 'min(100vw, calc((100dvh - env(safe-area-inset-top, 0px) - 52px) * 9 / 16))', aspectRatio: '9 / 16' } +// 쇼츠 페이지의 영상 칸: 위 헤더(54px)·버튼 줄(48px)과 아래 탭 바(--shorts-tab) 사이 높이와 화면 너비 안에 9:16으로 맞춘다 +const FIT = { width: 'min(100vw, calc((100dvh - env(safe-area-inset-top, 0px) - 54px - 48px - var(--shorts-tab, 0px)) * 9 / 16))', aspectRatio: '9 / 16' } + +/** 아래 탭 바 높이 (기기마다 안전 영역이 달라 실제로 잰다) */ +function useTabBarHeight() { + const [h, setH] = useState(0) + useLayoutEffect(() => { + const nav = document.querySelector('nav.b-tabbar') + if (!nav) return + const ro = new ResizeObserver(() => setH(nav.offsetHeight)) + ro.observe(nav) + return () => ro.disconnect() + }, []) + return h +} const YT_ORIGIN = 'https://www.youtube-nocookie.com' @@ -46,12 +60,11 @@ function useVisible(threshold = 0.5) { return [ref, visible] as const } -/** 오늘 화면 히어로 아래 쇼츠 줄: 첫 카드만 소리 없이 재생, 누르면 전체 화면에서 위아래로 넘겨 본다 */ +/** 오늘 화면 히어로 아래 쇼츠 줄: 첫 카드만 소리 없이 재생, 누르면 쇼츠 페이지(/shorts/영상ID)에서 위아래로 넘겨 본다 */ export function ShortsRail() { const q = useQuery(listShortsOptions()) const items = q.data?.items ?? [] const [ref, visible] = useVisible() - const [openAt, setOpenAt] = useState(null) if (q.isPending) { return ( @@ -72,17 +85,16 @@ export function ShortsRail() { {items.map((s, i) => ( - setOpenAt(i)} /> + ))} - {openAt != null && setOpenAt(null)} />} ) } -function ShortCard({ s, playing, onOpen }: { s: ShortItem; playing: boolean; onOpen: () => void }) { +function ShortCard({ s, playing }: { s: ShortItem; playing: boolean }) { return ( -