feat: 내 각 아이콘·상세, 이야기 내 글·무한 스크롤, 공유 이미지 얇은 띠, 행사 주소 수집
- 내 각: 아이콘 고르기(my_gak.icon), 카드는 아이콘·점수·아쉬운 조건만, 눌러서 상세(시간대·조건별 점수), 공유는 공통 공유 창 - 이야기: 오늘 쓴 내 글 묶음, '내 글' 칩·탭, 무한 스크롤, 사진 카메라 버튼, 지우기 확인, ⋯ 메뉴 하트 옆, 글 시간 서버 계산(1일 전) - 공유 이미지: 1:1·4:5 는 아래 얇은 띠 한 줄로 카드를 크게 - 행사: 수집 때 주소 저장(event.address), 행사 포스트에 장소·주소·기간 - 히어로 말풍선 '오늘 낮은 / 내일 낮은', 내일을 볼 때 배경도 따라감, 달 보름 순간이 낮이면 뜨는 시각으로 - 단풍 지도 피드 맨 위, 행사·계절 띠 포스트 틀 되돌림, 쇼츠 홈 버튼 가림·닫기 버튼, 하단 여백, 회색 글자 대비 - 토스 앱에선 쇼츠 플레이어를 하나만 띄움
This commit is contained in:
1 parent
3a249c509d
commit
ffe6153148
35 files changed
+566
-185
No files matched your search
@@ -3,7 +3,9 @@ import { type CSSProperties, type PointerEvent as ReactPointerEvent, useEffect,
|
||||
import { Link, useNavigate, useParams } from 'react-router'
|
||||
import { listShortsOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen'
|
||||
import type { ShortItem } from '@nalssigak/shared/api/client'
|
||||
import { IS_TOSS } from '../lib/platform'
|
||||
import { cx } from '../lib/utils'
|
||||
import { CloseIcon } from './svg'
|
||||
import { Rail, Skel, SkelRail, TAP44 } from './ui'
|
||||
|
||||
// 유튜브는 플레이어가 200×200 이상이어야 해서, 카드 안 미리보기는 200px 너비로 띄우고 줄여 보인다.
|
||||
@@ -15,13 +17,18 @@ const SCALE = (CARD_W / PLAYER_W) * 1.4
|
||||
// 쇼츠 페이지의 영상 칸: 위 헤더(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<HTMLElement>('nav.b-tabbar')
|
||||
if (!nav) return
|
||||
const ro = new ResizeObserver(() => setH(nav.offsetHeight))
|
||||
const measure = () => {
|
||||
const bar = nav.getBoundingClientRect()
|
||||
const bump = nav.querySelector('.b-tab-main > *')?.getBoundingClientRect().top ?? bar.top
|
||||
setH(Math.round(bar.bottom - Math.min(bar.top, bump)))
|
||||
}
|
||||
const ro = new ResizeObserver(measure)
|
||||
ro.observe(nav)
|
||||
return () => ro.disconnect()
|
||||
}, [])
|
||||
@@ -85,7 +92,8 @@ export function ShortsRail() {
|
||||
<section ref={ref} aria-label="날씨각 쇼츠">
|
||||
<Rail label="쇼츠 목록">
|
||||
{items.map((s, i) => (
|
||||
<ShortCard key={s.id} s={s} playing={i === 0 && visible} />
|
||||
// 토스 앱 웹뷰는 유튜브 플레이어가 무거워, 줄에선 표지만 보이고 누르면 재생
|
||||
<ShortCard key={s.id} s={s} playing={!IS_TOSS && i === 0 && visible} />
|
||||
))}
|
||||
</Rail>
|
||||
</section>
|
||||
@@ -282,8 +290,9 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
/>
|
||||
<div className="absolute inset-0 bg-black/35" aria-hidden="true" />
|
||||
<div className="relative mx-auto flex h-12 w-full max-w-[440px] shrink-0 items-center justify-between px-3">
|
||||
<button type="button" onClick={onClose} aria-label="닫기" className={cx('relative grid size-9 cursor-pointer place-items-center rounded-full bg-white/15 text-xl text-white', TAP44)}>
|
||||
×
|
||||
{/* 글자 '×'는 글꼴마다 아래로 처져 그림으로 */}
|
||||
<button type="button" onClick={onClose} aria-label="닫기" className={cx('relative grid size-9 cursor-pointer place-items-center rounded-full bg-white/15 text-white', TAP44)}>
|
||||
<CloseIcon className="size-[18px]" />
|
||||
</button>
|
||||
<button type="button" onClick={toggleSound} aria-pressed={sound} className="h-9 cursor-pointer rounded-full bg-white/15 px-3.5 text-[13px] font-bold text-white">
|
||||
{sound ? '소리 끄기' : '소리 켜기'}
|
||||
@@ -294,7 +303,8 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
<div key={s.id} data-i={i} className="relative grid h-full snap-start place-items-center">
|
||||
<div className="relative" style={FIT}>
|
||||
<img src={`https://i.ytimg.com/vi/${s.id}/hqdefault.jpg`} alt="" className="absolute inset-0 size-full object-cover" />
|
||||
{Math.abs(i - at) <= 1 && (
|
||||
{/* 웹은 앞뒤 영상까지 미리 띄워 넘길 때 깜빡이지 않게, 토스 앱은 무거워 지금 영상 하나만 */}
|
||||
{(IS_TOSS ? i === at : Math.abs(i - at) <= 1) && (
|
||||
<iframe
|
||||
ref={(f) => {
|
||||
if (f) frames.current.set(i, f)
|
||||
@@ -314,7 +324,7 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
return next
|
||||
})
|
||||
}}
|
||||
className={cx('absolute inset-0 size-full border-0 transition-opacity duration-200', !ready.has(i) && 'opacity-0')}
|
||||
className={cx('absolute inset-0 size-full border-0 transition-opacity duration-200', !IS_TOSS && !ready.has(i) && 'opacity-0')}
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
|
||||
Reference in new issue
Block a user