@@ -304,7 +298,6 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
/** 이야기 탭: 쓰기 칸과 전국 최신 글 (아래로 더 받기) */
/** 피드 위 쓰는 칸. 늘 펼쳐 두고, 방금 올린 글은 바로 아래에 보인다 (피드 사이 글은 새로 받을 때 섞인다) */
export function FeedComposer({ onPosted }: { onPosted: (t: TalkData) => void }) {
- if (IS_TOSS) return null
return (
@@ -374,8 +367,7 @@ export function FirstTalkCard() {
/** '동네 사람들' 자리: 글이 GROUP_MIN 개 이상이면 묶음, 아니면 첫 글 쓰기 */
export function NearTalks({ talks, loaded }: { talks: TalkData[]; loaded: boolean }) {
if (!loaded) return null
- if (talks.length >= GROUP_MIN) return
- return IS_TOSS ? null :
+ return talks.length >= GROUP_MIN ? :
}
/** 내 정보 창의 내가 쓴 글 */
From 77cfb0480895b096989950a6bef09fea3ffcd3b1 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Tue, 27 Oct 2026 08:30:54 +0900
Subject: [PATCH 10/13] =?UTF-8?q?feat:=20=ED=86=A0=EC=8A=A4=ED=8C=90=20?=
=?UTF-8?q?=EC=B2=AB=20=EC=8B=A4=ED=96=89=20=EC=9D=B8=ED=8A=B8=EB=A1=9C=20?=
=?UTF-8?q?=EB=8B=A4=EC=8B=9C=20=EB=84=A3=EC=9D=8C=20(51e0c06=20=EB=90=98?=
=?UTF-8?q?=EB=8F=8C=EB=A6=BC)=20=E2=80=94=20=ED=86=A0=EC=8A=A4=20?=
=?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=EC=9D=84=20=EB=8B=A4=EC=8B=9C=20?=
=?UTF-8?q?=EC=BC=9C=EC=84=9C=20=EA=B2=80=EC=88=98=20=EC=9D=98=EA=B2=AC?=
=?UTF-8?q?=EB=8C=80=EB=A1=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=A0=84?=
=?UTF-8?q?=EC=97=90=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EC=86=8C=EA=B0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
TODO.md | 3 +-
frontend/src/b/BLayout.tsx | 2 ++
frontend/src/b/tossIntro.tsx | 57 ++++++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+), 1 deletion(-)
create mode 100644 frontend/src/b/tossIntro.tsx
diff --git a/TODO.md b/TODO.md
index 7fd7f8d..4b15cd3 100644
--- a/TODO.md
+++ b/TODO.md
@@ -234,7 +234,8 @@
| [ ] | 토스 로그인 운영 설정 — 서버 `secrets/toss/` 인증서·키, `.env` `TOSS_*` 세 줄은 넣음(10/14). 남은 것: 정산정보 등록(대표님), 배포, 콘솔 약관 링크·콜백, `4050 인증서버에 등록된 미니앱이 아닙니다` 재확인 | 토스 로그인 구현(10/14) | `compose.yaml`, `.env.example`, `backend/config/settings.py` |
| [ ] | 토스 번들 다시 만들기 — 로그인(4050) 풀린 뒤 `npm run build:toss`로 한 번에. 지금 콘솔 번들엔 로그인·GA `platform` 값이 없음. 로그인 실패 상태로 검수 올리면 반려 위험 | 로그인 미완성이라 미룸(10/14) | `frontend/` |
| [ ] | **[결정 필요]** 토스 연결 끊기 처리 — 지금은 UNLINK·탈퇴 모두 토큰만 무효로 함. 토스 탈퇴(`WITHDRAWAL_TOSS`·`WITHDRAWAL_TERMS`) 때 계정·댓글을 지울지 | 토스 로그인 구현(10/14) | `backend/services/auth_service.py` |
-| [ ] | 토스 로그인 문구 검토 — '토스로 로그인', '토스로 로그인했어요', '토스 로그인을 마치지 못했어요. 한 번 더 눌러 주세요.', 기본 닉네임 '토스1234'(userKey 끝 4자리), 로그인 창 '날씨각 로그인'·'로그인하면 동네 이야기를 쓰고 내 각을 저장할 수 있어요' | 토스 로그인 구현(10/14) | `frontend/src/b/Sheets.tsx`, `backend/services/auth_service.py` |
+| [ ] | 토스 로그인 문구 검토 — '토스로 로그인', '토스로 로그인했어요', '토스 로그인을 마치지 못했어요. 한 번 더 눌러 주세요.', 기본 닉네임 '토스1234'(userKey 끝 4자리), 로그인 창 '날씨각 로그인'·'로그인하면 동네 이야기를 쓰고 내 각을 저장할 수 있어요', 인트로 '오늘 날씨에 맞는 일을 점수로 알려 줘요'·'세차·빨래·러닝 각 점수'·'오늘 노을이 예쁜 시간'·'이번 주말 가까운 행사'·'시작하기'(10/24) | 토스 로그인 구현(10/14) | `frontend/src/b/Sheets.tsx`, `backend/services/auth_service.py` |
+| [ ] | 토스판 첫 실행에 인트로와 위치 권한 창이 같이 뜸 — 위치 권한은 앱이 뜨자마자 물어서 인트로 위에 겹칠 수 있음. '시작하기' 뒤로 미룰지 토스 앱에서 확인 | 인트로 추가 (10/24) | `frontend/src/b/region.tsx`, `frontend/src/b/tossIntro.tsx` |
| [ ] | 메뉴의 '로그인하면 좋아요·댓글을 쓸 수 있어요' — 좋아요·댓글은 로그인 없이 됨(10/21 결정)이라 문구가 틀림 | 인트로 추가 중 발견 (10/24) | `frontend/src/b/Sheets.tsx:1117` |
| [ ] | 토스 웹뷰에서 유튜브 플레이어가 보내는 재생 상태(postMessage)가 페이지에 오지 않음 — 원인 미확인(origin 불일치? 토스 브리지?). 그래서 토스판 쇼츠는 숨기기·명령 없이 유튜브 기본 플레이어 사용. 원인 찾으면 웹과 같은 UI로 합칠 수 있음 | 토스판 쇼츠 재생 안 됨 (10/26) | `frontend/src/b/Shorts.tsx` |
| [ ] | 댓글 신고·차단 — 앱인토스 필수 아님(신고·차단 필수는 채팅·만남·중고거래만, 서비스 오픈 정책·서비스별 주의사항). 만들지 않기로 함(10/14). 검수에서 요청이 오면 만든다 | 토스 로그인 구현(10/14) | |
diff --git a/frontend/src/b/BLayout.tsx b/frontend/src/b/BLayout.tsx
index 3f87a6b..f380724 100644
--- a/frontend/src/b/BLayout.tsx
+++ b/frontend/src/b/BLayout.tsx
@@ -12,6 +12,7 @@ import { useRegion } from './regionContext'
import { useSheet } from './sheetContext'
import { SheetProvider } from './Sheets'
import { SkyContext, useSky } from './skyContext'
+import { TossIntro } from './tossIntro'
import { PinIcon, TabIcon } from './svg'
import { Avatar, Ic, Skel } from './ui'
@@ -305,6 +306,7 @@ export function BLayout() {
+
diff --git a/frontend/src/b/tossIntro.tsx b/frontend/src/b/tossIntro.tsx
new file mode 100644
index 0000000..474b56c
--- /dev/null
+++ b/frontend/src/b/tossIntro.tsx
@@ -0,0 +1,57 @@
+import { useState } from 'react'
+import { IS_TOSS } from '../lib/platform'
+import { Ic } from './ui'
+
+const KEY = 'nalssigak.b.tossIntroSeen'
+
+const POINTS = [
+ ['sun', '세차·빨래·러닝 각 점수'],
+ ['sunset', '오늘 노을이 예쁜 시간'],
+ ['fireworks', '이번 주말 가까운 행사'],
+] as const
+
+function seen() {
+ try {
+ return localStorage.getItem(KEY) === '1'
+ } catch {
+ return false
+ }
+}
+
+/** 토스판을 처음 열면 서비스 소개를 먼저 보여 준다 (앱인토스 검수: 로그인 전에 서비스 설명) */
+export function TossIntro() {
+ const [open, setOpen] = useState(() => IS_TOSS && !seen())
+ if (!open) return null
+
+ const start = () => {
+ try {
+ localStorage.setItem(KEY, '1')
+ } catch (e) {
+ console.warn('[intro] 본 기록을 저장하지 못함', e)
+ }
+ setOpen(false)
+ }
+
+ return (
+
+
+
+
+ 날씨각
+
+
오늘 날씨에 맞는 일을 점수로 알려 줘요
+
+
+ {POINTS.map(([icon, label]) => (
+
+
+ {label}
+
+ ))}
+
+
+
+ )
+}
From 7ffeecbb4fdbb19e282a4fe3fe964739523bf719 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Tue, 27 Oct 2026 19:22:26 +0900
Subject: [PATCH 11/13] =?UTF-8?q?fix:=20=ED=86=A0=EC=8A=A4=ED=8C=90=20?=
=?UTF-8?q?=EC=87=BC=EC=B8=A0=EB=8F=84=20=EB=A6=B4=EC=8A=A4=EC=B2=98?=
=?UTF-8?q?=EB=9F=BC=20=EB=8B=A4=EC=9D=8C=20=EC=98=81=EC=83=81=EC=9D=84=20?=
=?UTF-8?q?=EB=AF=B8=EB=A6=AC=20=EB=B0=9B=EC=95=84=20=EB=91=A0=20=E2=80=94?=
=?UTF-8?q?=20=EB=8B=A4=EC=9D=8C=20=EC=98=81=EC=83=81=EC=9D=80=20=EB=A9=88?=
=?UTF-8?q?=EC=B6=98=20=EC=B1=84=20=EB=9D=84=EC=9B=8C=20=EB=91=90=EA=B3=A0?=
=?UTF-8?q?=20=EB=84=98=EC=96=B4=EC=98=A4=EB=A9=B4=20=EC=9E=AC=EC=83=9D,?=
=?UTF-8?q?=20=EC=A7=80=EB=82=9C=20=EC=98=81=EC=83=81=EC=9D=80=20=EB=82=B4?=
=?UTF-8?q?=EB=A0=A4=20=EC=86=8C=EB=A6=AC=EA=B0=80=20=EA=B2=B9=EC=B9=98?=
=?UTF-8?q?=EC=A7=80=20=EC=95=8A=EA=B2=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/b/Shorts.tsx | 55 ++++++++++++++++++++++++++++-----------
1 file changed, 40 insertions(+), 15 deletions(-)
diff --git a/frontend/src/b/Shorts.tsx b/frontend/src/b/Shorts.tsx
index 1026368..0661107 100644
--- a/frontend/src/b/Shorts.tsx
+++ b/frontend/src/b/Shorts.tsx
@@ -43,9 +43,9 @@ const PLAIN = IS_TOSS
// 토스는 재생 상태가 안 오므로, 플레이어 문서가 뜨고 이만큼 지나면 첫 장면이 나왔다고 보고 표지를 걷는다 (그 전엔 플레이어의 검은 화면 대신 표지)
const PLAIN_SHOW_MS = 1000
-function embed(id: string, plain = false) {
+function embed(id: string, plain = false, autoplay = true) {
const q = new URLSearchParams({
- autoplay: '1', mute: plain ? '0' : '1', playsinline: '1', loop: '1', playlist: id, controls: plain ? '1' : '0', rel: '0', modestbranding: '1',
+ autoplay: autoplay ? '1' : '0', mute: plain ? '0' : '1', playsinline: '1', loop: '1', playlist: id, controls: plain ? '1' : '0', rel: '0', modestbranding: '1',
enablejsapi: '1', origin: window.location.origin,
})
return `${YT_ORIGIN}/embed/${id}?${q}`
@@ -153,10 +153,24 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
const tabH = useTabBarHeight()
// 첫 장면을 받은 플레이어. 그 전엔 플레이어의 검은 화면 대신 표지를 보인다
const [ready, setReady] = useState>(new Set())
- // 토스: 표지를 걷은 플레이어 번호 (하나만 띄우므로 하나)
- const [plainShownAt, setPlainShownAt] = useState(-1)
- const plainTimer = useRef(0)
- useEffect(() => () => window.clearTimeout(plainTimer.current), [])
+ // 토스: 표지를 걷은 플레이어들. 다음 영상도 미리 띄워 두므로 여럿
+ const [plainShown, setPlainShown] = useState>(new Set())
+ const plainTimers = useRef(new Set())
+ useEffect(() => {
+ const timers = plainTimers.current
+ return () => timers.forEach((t) => window.clearTimeout(t))
+ }, [])
+ // 토스: 플레이어마다 처음 띄울 때 지금 영상이면 자동재생, 미리 받아 두는 다음 영상은 멈춘 채로. 한 번 정하면 주소가 바뀌어 다시 받지 않게 기억한다
+ const [plainAutoplay, setPlainAutoplay] = useState>(() => new Map([[start, true], [start + 1, false]]))
+ /** 지금 영상이 n 으로 바뀔 때: 새로 띄울 지금 영상은 자동재생, 다음 영상은 멈춘 채로 (이미 띄운 것은 그대로) */
+ const keepAutoplay = (n: number) =>
+ setPlainAutoplay((m) => {
+ const next = new Map([...m].filter(([i]) => i === n || i === n + 1))
+ if (!next.has(n)) next.set(n, true)
+ if (!next.has(n + 1)) next.set(n + 1, false)
+ return next
+ })
+ const autoplayOnMount = (i: number) => plainAutoplay.get(i) ?? i === at
const frames = useRef(new Map())
const atRef = useRef(start)
const soundRef = useRef(false)
@@ -188,7 +202,12 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
if (!box) return
const io = new IntersectionObserver(
(entries) => {
- for (const e of entries) if (e.isIntersecting) setAt(Number((e.target as HTMLElement).dataset.i))
+ for (const e of entries) {
+ if (!e.isIntersecting) continue
+ const n = Number((e.target as HTMLElement).dataset.i)
+ setAt(n)
+ if (PLAIN) keepAutoplay(n)
+ }
},
{ root: box, threshold: 0.6 },
)
@@ -224,14 +243,14 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
if (atRef.current !== at) moved(items[at])
atRef.current = at
paused.current = false
- if (PLAIN) return
for (const [i, f] of frames.current) {
+ // 토스는 소리를 켠 채 유튜브 기본 플레이어로 두므로 재생·멈춤만 (소리 명령 없음)
if (i === at) {
- command(f, soundRef.current ? 'unMute' : 'mute')
+ if (!PLAIN) command(f, soundRef.current ? 'unMute' : 'mute')
command(f, 'playVideo')
} else {
command(f, 'pauseVideo')
- command(f, 'mute')
+ if (!PLAIN) command(f, 'mute')
}
}
}, [at, items])
@@ -330,20 +349,26 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
- {(PLAIN ? i === at : Math.abs(i - at) <= 1) && (
+ {/* 릴스처럼 다음 영상을 미리 받아 둔다. 토스는 재생 상태가 안 와 멈추게 할 수 없을 수 있어, 지난 영상은 내려 소리가 겹치지 않게 지금·다음만 */}
+ {(PLAIN ? i === at || i === at + 1 : Math.abs(i - at) <= 1) && (
{
if (f) frames.current.set(i, f)
else frames.current.delete(i)
}}
- src={embed(s.id, PLAIN)}
+ src={embed(s.id, PLAIN, !PLAIN || autoplayOnMount(i))}
title={s.title}
allow="autoplay; encrypted-media; picture-in-picture"
// 재생 상태를 받으려면 플레이어에 먼저 '듣고 있다'고 알린다
onLoad={(e) => {
if (PLAIN) {
- window.clearTimeout(plainTimer.current)
- plainTimer.current = window.setTimeout(() => setPlainShownAt(i), PLAIN_SHOW_MS)
+ const t = window.setTimeout(() => {
+ plainTimers.current.delete(t)
+ setPlainShown((r) => (r.has(i) ? r : new Set(r).add(i)))
+ }, PLAIN_SHOW_MS)
+ plainTimers.current.add(t)
+ // 미리 받아 둔 영상으로 넘어온 뒤 뜬 경우엔 바로 재생
+ if (i === atRef.current) command(e.currentTarget, 'playVideo')
}
e.currentTarget.contentWindow?.postMessage(JSON.stringify({ event: 'listening', id: s.id }), YT_ORIGIN)
// 앞뒤 밖으로 밀려나 내려갔다 다시 뜬 플레이어는 첫 장면을 새로 받을 때까지 다시 숨긴다
@@ -354,7 +379,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', (PLAIN ? plainShownAt !== i : !ready.has(i)) && 'opacity-0')}
+ className={cx('absolute inset-0 size-full border-0 transition-opacity duration-200', (PLAIN ? !plainShown.has(i) : !ready.has(i)) && 'opacity-0')}
/>
)}
{!PLAIN && (
From 8191881f6a78515d571c1fe9a9b68b38ccc599b0 Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Tue, 27 Oct 2026 19:27:00 +0900
Subject: [PATCH 12/13] =?UTF-8?q?fix:=20=ED=86=A0=EC=8A=A4=ED=8C=90=20?=
=?UTF-8?q?=EC=87=BC=EC=B8=A0=EB=A5=BC=20=EC=9B=B9=EA=B3=BC=20=EA=B0=99?=
=?UTF-8?q?=EC=9D=B4=20=E2=80=94=20=EC=86=8C=EB=A6=AC=20=EC=97=86=EC=9D=B4?=
=?UTF-8?q?=20=EC=9E=90=EB=8F=99=EC=9E=AC=EC=83=9D=C2=B7=EC=9E=AC=EC=83=9D?=
=?UTF-8?q?=20=EB=B2=84=ED=8A=BC=20=EC=97=86=EC=9D=8C=C2=B7=EC=95=9E?=
=?UTF-8?q?=EB=92=A4=20=EB=AF=B8=EB=A6=AC=20=EB=B0=9B=EA=B8=B0=C2=B7?=
=?UTF-8?q?=EC=86=90=EA=B0=80=EB=9D=BD=EC=9C=BC=EB=A1=9C=20=EB=84=98?=
=?UTF-8?q?=EA=B8=B0=EA=B8=B0=C2=B7=EC=86=8C=EB=A6=AC=20=EC=BC=9C=EA=B8=B0?=
=?UTF-8?q?=20=EB=B2=84=ED=8A=BC,=20=EC=9E=AC=EC=83=9D=20=EC=8B=A0?=
=?UTF-8?q?=ED=98=B8=EA=B0=80=20=EC=95=88=20=EC=98=A4=EB=8A=94=20=ED=86=A0?=
=?UTF-8?q?=EC=8A=A4=EB=A7=8C=201=EC=B4=88=20=EB=92=A4=20=EC=98=81?=
=?UTF-8?q?=EC=83=81=EC=9D=84=20=EB=B3=B4=EC=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/b/Shorts.tsx | 85 +++++++++++----------------------------
1 file changed, 24 insertions(+), 61 deletions(-)
diff --git a/frontend/src/b/Shorts.tsx b/frontend/src/b/Shorts.tsx
index 0661107..eb12f3d 100644
--- a/frontend/src/b/Shorts.tsx
+++ b/frontend/src/b/Shorts.tsx
@@ -37,15 +37,14 @@ function useTabBarHeight() {
const YT_ORIGIN = 'https://www.youtube-nocookie.com'
-// 토스 웹뷰에는 플레이어가 보내는 재생 상태가 오지 않아, 쇼츠 페이지는 플레이어를 숨기거나 명령하지 않고 유튜브 기본 조작(재생 버튼)과 소리를 켠 채 그대로 보인다.
-// 영상 위 터치는 유튜브가 가져가므로 넘기기는 버튼으로
+// 토스 웹뷰에는 플레이어가 보내는 재생 상태가 오지 않는다. 그래서 토스는 첫 장면이 나왔는지를 시간으로 보고 표지를 걷는다 (나머지는 웹과 같다)
const PLAIN = IS_TOSS
// 토스는 재생 상태가 안 오므로, 플레이어 문서가 뜨고 이만큼 지나면 첫 장면이 나왔다고 보고 표지를 걷는다 (그 전엔 플레이어의 검은 화면 대신 표지)
const PLAIN_SHOW_MS = 1000
-function embed(id: string, plain = false, autoplay = true) {
+function embed(id: string) {
const q = new URLSearchParams({
- autoplay: autoplay ? '1' : '0', mute: plain ? '0' : '1', playsinline: '1', loop: '1', playlist: id, controls: plain ? '1' : '0', rel: '0', modestbranding: '1',
+ autoplay: '1', mute: '1', playsinline: '1', loop: '1', playlist: id, controls: '0', rel: '0', modestbranding: '1',
enablejsapi: '1', origin: window.location.origin,
})
return `${YT_ORIGIN}/embed/${id}?${q}`
@@ -160,17 +159,6 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
const timers = plainTimers.current
return () => timers.forEach((t) => window.clearTimeout(t))
}, [])
- // 토스: 플레이어마다 처음 띄울 때 지금 영상이면 자동재생, 미리 받아 두는 다음 영상은 멈춘 채로. 한 번 정하면 주소가 바뀌어 다시 받지 않게 기억한다
- const [plainAutoplay, setPlainAutoplay] = useState>(() => new Map([[start, true], [start + 1, false]]))
- /** 지금 영상이 n 으로 바뀔 때: 새로 띄울 지금 영상은 자동재생, 다음 영상은 멈춘 채로 (이미 띄운 것은 그대로) */
- const keepAutoplay = (n: number) =>
- setPlainAutoplay((m) => {
- const next = new Map([...m].filter(([i]) => i === n || i === n + 1))
- if (!next.has(n)) next.set(n, true)
- if (!next.has(n + 1)) next.set(n + 1, false)
- return next
- })
- const autoplayOnMount = (i: number) => plainAutoplay.get(i) ?? i === at
const frames = useRef(new Map())
const atRef = useRef(start)
const soundRef = useRef(false)
@@ -202,12 +190,7 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
if (!box) return
const io = new IntersectionObserver(
(entries) => {
- for (const e of entries) {
- if (!e.isIntersecting) continue
- const n = Number((e.target as HTMLElement).dataset.i)
- setAt(n)
- if (PLAIN) keepAutoplay(n)
- }
+ for (const e of entries) if (e.isIntersecting) setAt(Number((e.target as HTMLElement).dataset.i))
},
{ root: box, threshold: 0.6 },
)
@@ -244,13 +227,12 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
atRef.current = at
paused.current = false
for (const [i, f] of frames.current) {
- // 토스는 소리를 켠 채 유튜브 기본 플레이어로 두므로 재생·멈춤만 (소리 명령 없음)
if (i === at) {
- if (!PLAIN) command(f, soundRef.current ? 'unMute' : 'mute')
+ command(f, soundRef.current ? 'unMute' : 'mute')
command(f, 'playVideo')
} else {
command(f, 'pauseVideo')
- if (!PLAIN) command(f, 'mute')
+ command(f, 'mute')
}
}
}, [at, items])
@@ -295,10 +277,6 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
box.scrollTo({ top: target * h, behavior: 'smooth' })
}
- const go = (step: number) => {
- const box = list.current
- if (box) box.scrollTo({ top: (at + step) * box.clientHeight, behavior: 'smooth' })
- }
const toggleSound = () => {
const on = !sound
@@ -329,34 +307,23 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
- {PLAIN ? (
-
-
-
-
- ) : (
-
- )}
+
{items.map((s, i) => (
- {/* 릴스처럼 다음 영상을 미리 받아 둔다. 토스는 재생 상태가 안 와 멈추게 할 수 없을 수 있어, 지난 영상은 내려 소리가 겹치지 않게 지금·다음만 */}
- {(PLAIN ? i === at || i === at + 1 : Math.abs(i - at) <= 1) && (
+ {/* 릴스처럼 앞뒤 영상을 소리 없이 미리 받아 둔다 */}
+ {Math.abs(i - at) <= 1 && (
{
if (f) frames.current.set(i, f)
else frames.current.delete(i)
}}
- src={embed(s.id, PLAIN, !PLAIN || autoplayOnMount(i))}
+ src={embed(s.id)}
title={s.title}
allow="autoplay; encrypted-media; picture-in-picture"
// 재생 상태를 받으려면 플레이어에 먼저 '듣고 있다'고 알린다
@@ -367,8 +334,6 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
setPlainShown((r) => (r.has(i) ? r : new Set(r).add(i)))
}, PLAIN_SHOW_MS)
plainTimers.current.add(t)
- // 미리 받아 둔 영상으로 넘어온 뒤 뜬 경우엔 바로 재생
- if (i === atRef.current) command(e.currentTarget, 'playVideo')
}
e.currentTarget.contentWindow?.postMessage(JSON.stringify({ event: 'listening', id: s.id }), YT_ORIGIN)
// 앞뒤 밖으로 밀려나 내려갔다 다시 뜬 플레이어는 첫 장면을 새로 받을 때까지 다시 숨긴다
@@ -382,20 +347,18 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
className={cx('absolute inset-0 size-full border-0 transition-opacity duration-200', (PLAIN ? !plainShown.has(i) : !ready.has(i)) && 'opacity-0')}
/>
)}
- {!PLAIN && (
-