From c45940c358224756779fdc7dafff619e4c1ef0c3 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Tue, 27 Oct 2026 14:29:34 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=ED=94=BC=EB=93=9C=20=EB=8B=A8?= =?UTF-8?q?=ED=92=8D=20=EC=A7=80=EB=8F=84=20=EC=B9=B4=EB=93=9C=202?= =?UTF-8?q?=EB=B2=88=EC=A7=B8=20=EC=9E=A5(=EC=A7=80=EA=B8=88=20=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=EC=A2=8B=EC=9D=80=20=EA=B3=B3)=20=EC=99=BC?= =?UTF-8?q?=EC=AA=BD=EC=9D=B4=20=EA=B0=80=EB=A0=A4=EC=A7=80=EB=8D=98=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=E2=80=94=20=EA=B0=80=EC=9A=B4=EB=8D=B0=20?= =?UTF-8?q?=EB=A7=9E=EC=B6=94=EB=A0=A4=20=EB=AF=BC=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=EA=B0=80=20=EC=98=86=20=EC=9E=A5=EC=9D=84=20=EB=8D=AE=EC=97=88?= =?UTF-8?q?=EC=9D=8C,=201=EB=B2=88=EC=A7=B8=20=EC=9E=A5=20=EB=B0=96?= =?UTF-8?q?=EC=9D=80=20=EC=9E=90=EB=A6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/b/foliageMap.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/b/foliageMap.tsx b/frontend/src/b/foliageMap.tsx index 162defc..f2cbdc5 100644 --- a/frontend/src/b/foliageMap.tsx +++ b/frontend/src/b/foliageMap.tsx @@ -66,7 +66,8 @@ export function FoliageCard({ post }: { post?: PostReaction | null }) {
-
+ {/* 밀어 낸 지도가 옆 장(가기 좋은 곳)을 덮지 않게 이 장 밖은 자른다 */} +
{/* 지도 그림은 땅이 왼쪽에 치우쳐 있어 오른쪽(빈 바다)으로 밀어 가운데에 맞춘다 */}
From 7d84226105f747075257067e0bacf834d35d17fd Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Tue, 27 Oct 2026 14:39:41 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=ED=9E=88=EC=96=B4=EB=A1=9C=20?= =?UTF-8?q?=ED=95=98=ED=8A=B8=C2=B7=EB=8C=93=EA=B8=80=C2=B7=EB=B3=B4?= =?UTF-8?q?=EB=82=B4=EA=B8=B0=20=EA=B0=84=EA=B2=A9=EC=9D=B4=20=EC=88=AB?= =?UTF-8?q?=EC=9E=90=EA=B0=80=20=EB=B6=99=EC=9C=BC=EB=A9=B4=20=EC=96=B4?= =?UTF-8?q?=EA=B8=8B=EB=82=98=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20=E2=80=94=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=EB=A7=88=EB=8B=A4=20=EC=A2=8C=EC=9A=B0=20?= =?UTF-8?q?=EC=97=AC=EB=B0=B1=EC=9D=84=20=EA=B0=99=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/b/TodayPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/b/TodayPage.tsx b/frontend/src/b/TodayPage.tsx index ee61ca2..62b025c 100644 --- a/frontend/src/b/TodayPage.tsx +++ b/frontend/src/b/TodayPage.tsx @@ -160,7 +160,8 @@ const WEATHER_ICON: Record = { } // 구름 수: 구름 많음 둘, 흐림·비·눈 셋 // 히어로 오른쪽 위 좋아요·댓글·보내기: 셋 다 같은 32px 칸에 아이콘 가운데, 수는 아이콘 옆 -const HERO_ACT = 'relative flex h-8 min-w-8 cursor-pointer items-center justify-center gap-1 text-[13px] font-extrabold' +// 아이콘마다 좌우 여백을 같게: 숫자가 붙어도 아이콘 사이 간격이 그대로 +const HERO_ACT = 'relative flex h-8 cursor-pointer items-center justify-center gap-1 px-[5px] text-[13px] leading-none font-extrabold tabular-nums' const CLOUDS = [ { cls: 'top-9 left-[5%] h-8 w-[84px]', d: '.1s', f: '6s' }, { cls: 'top-[96px] left-[63%] h-9 w-[96px]', d: '.25s', f: '6.4s' }, From 7dcd6c6a4c0c4a2c8c925c281f7abb610f433751 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Tue, 27 Oct 2026 14:39:41 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=B0=BD=EC=9D=84=20=EC=B2=98=EC=9D=8C=20=EC=97=B4=20=EB=95=8C?= =?UTF-8?q?=20=EB=B2=84=EB=B2=85=EC=9D=B4=EB=8D=98=20=EA=B2=83=20=EC=A4=84?= =?UTF-8?q?=EC=9E=84=20=E2=80=94=20=EA=B5=AC=EA=B8=80=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=8A=A4=ED=81=AC=EB=A6=BD=ED=8A=B8=EB=8A=94=20?= =?UTF-8?q?=ED=95=9C=EA=B0=80=ED=95=A0=20=EB=95=8C=20=EB=AF=B8=EB=A6=AC=20?= =?UTF-8?q?=EB=B0=9B=EA=B3=A0,=20=EA=B5=AC=EA=B8=80=20=EB=B2=84=ED=8A=BC?= =?UTF-8?q?=EA=B3=BC=20=EB=92=A4=20=ED=99=94=EB=A9=B4=20=EB=A9=88=EC=B6=94?= =?UTF-8?q?=EA=B8=B0=EB=8A=94=20=EC=B0=BD=EC=9D=B4=20=EB=8B=A4=20=EC=98=AC?= =?UTF-8?q?=EB=9D=BC=EC=98=A8=20=EB=92=A4=EC=97=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/b/BLayout.tsx | 14 ++++++++++-- frontend/src/b/Sheets.tsx | 6 +++-- frontend/src/b/googleLogin.tsx | 38 +++++--------------------------- frontend/src/b/googleScript.ts | 40 ++++++++++++++++++++++++++++++++++ frontend/src/b/lib.ts | 3 +++ 5 files changed, 65 insertions(+), 36 deletions(-) create mode 100644 frontend/src/b/googleScript.ts diff --git a/frontend/src/b/BLayout.tsx b/frontend/src/b/BLayout.tsx index 02a8514..4c3e7f6 100644 --- a/frontend/src/b/BLayout.tsx +++ b/frontend/src/b/BLayout.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react' import { NavLink, Outlet, useLocation, useNavigationType } from 'react-router' -import { useIsFetching, useQuery } from '@tanstack/react-query' -import { getSeasonWeekOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen' +import { useIsFetching, useQuery, useQueryClient } from '@tanstack/react-query' +import { authConfigOptions, getSeasonWeekOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen' import { IS_TOSS } from '../lib/platform' import { cx } from '../lib/utils' import { kindOfHour, kst, seasonOf, type TimeKind } from '@nalssigak/shared/lib' @@ -9,6 +9,7 @@ import './b.css' import { AuthProvider } from './auth' import { RegionProvider } from './region' import { useAuth } from './authContext' +import { preloadGoogle } from './googleScript' import { useRegion } from './regionContext' import { useSheet } from './sheetContext' import { SheetProvider } from './Sheets' @@ -47,7 +48,16 @@ function TopBar() { const { region, locateStatus } = useRegion() const { open } = useSheet() const { me, mePending } = useAuth() + const queryClient = useQueryClient() const tab = TABS.find((t) => t.to !== '/' && pathname.startsWith(t.to)) + const loggedOut = !IS_TOSS && !mePending && !me + + // 로그인 창을 처음 열 때 버벅이지 않게 구글 로그인 준비물을 미리 받아 둔다 + useEffect(() => { + if (!loggedOut) return + void queryClient.prefetchQuery({ ...authConfigOptions(), staleTime: Infinity }) + return preloadGoogle() + }, [loggedOut, queryClient]) return (
diff --git a/frontend/src/b/Sheets.tsx b/frontend/src/b/Sheets.tsx index ba32d8c..6fa9131 100644 --- a/frontend/src/b/Sheets.tsx +++ b/frontend/src/b/Sheets.tsx @@ -34,7 +34,7 @@ import { ago, articleMeta, AVATAR_COLORS, cardBg, CHARACTERS, dateRange, loadOf, import { GoogleButton } from './googleLogin' import { useInstall, useInstallable } from './install' import { InstallSheet } from './installBanner' -import { ARTICLE_CAT } from './lib' +import { ARTICLE_CAT, SHEET_OPEN_MS } from './lib' import { MixSheet } from './myGak' import { ownPage, useRegion } from './regionContext' import { WeatherWhySheet } from './weatherWhy' @@ -109,8 +109,10 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void const root = document.documentElement const before = root.style.overflow root.style.overflow = 'hidden' - root.classList.add('b-sheet-open') + // 뒤 화면 움직임 멈추기는 페이지 전체 스타일을 다시 계산하게 해서, 창이 다 올라온 뒤에 한다 + const pause = setTimeout(() => root.classList.add('b-sheet-open'), SHEET_OPEN_MS) return () => { + clearTimeout(pause) root.style.overflow = before root.classList.remove('b-sheet-open') } diff --git a/frontend/src/b/googleLogin.tsx b/frontend/src/b/googleLogin.tsx index b317552..6d8ba9d 100644 --- a/frontend/src/b/googleLogin.tsx +++ b/frontend/src/b/googleLogin.tsx @@ -2,36 +2,8 @@ import { useMutation, useQuery } from '@tanstack/react-query' import { useEffect, useRef, useState } from 'react' import { authConfigOptions, googleLoginMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen' import type { ResAuth } from '@nalssigak/shared/api/client/types.gen' - -type GoogleId = { - initialize: (o: { client_id: string; callback: (r: { credential?: string }) => void; ux_mode?: 'popup' }) => void - renderButton: (el: HTMLElement, o: Record) => void -} -declare global { - interface Window { - google?: { accounts: { id: GoogleId } } - } -} - -const SCRIPT = 'https://accounts.google.com/gsi/client' -let loading: Promise | null = null - -/** 구글 로그인 스크립트는 로그인 창을 처음 열 때 한 번만 받는다 */ -function loadGoogle(): Promise { - if (window.google?.accounts.id) return Promise.resolve(window.google.accounts.id) - loading ??= new Promise((resolve, reject) => { - const s = document.createElement('script') - s.src = SCRIPT - s.async = true - s.onload = () => (window.google?.accounts.id ? resolve(window.google.accounts.id) : reject(new Error('gsi missing'))) - s.onerror = () => { - loading = null - reject(new Error('gsi load failed')) - } - document.head.appendChild(s) - }) - return loading -} +import { loadGoogle } from './googleScript' +import { SHEET_OPEN_MS } from './lib' /** 구글로 계속하기 버튼. 서버에 클라이언트 ID가 없으면 아무것도 그리지 않는다 */ export function GoogleButton({ onResult, onFail }: { onResult: (res: ResAuth) => void; onFail: () => void }) { @@ -49,8 +21,10 @@ export function GoogleButton({ onResult, onFail }: { onResult: (res: ResAuth) => useEffect(() => { if (!clientId || !box.current) return let alive = true - loadGoogle().then( - (g) => { + // 버튼(iframe)을 만드는 일이 무거워, 로그인 창이 다 올라온 뒤에 만든다. 자리는 min-h 로 잡아 둬서 밀리지 않는다 + const wait = new Promise((r) => setTimeout(r, SHEET_OPEN_MS)) + Promise.all([loadGoogle(), wait]).then( + ([g]) => { if (!alive || !box.current) return g.initialize({ client_id: clientId, diff --git a/frontend/src/b/googleScript.ts b/frontend/src/b/googleScript.ts new file mode 100644 index 0000000..00ef692 --- /dev/null +++ b/frontend/src/b/googleScript.ts @@ -0,0 +1,40 @@ +export type GoogleId = { + initialize: (o: { client_id: string; callback: (r: { credential?: string }) => void; ux_mode?: 'popup' }) => void + renderButton: (el: HTMLElement, o: Record) => void +} +declare global { + interface Window { + google?: { accounts: { id: GoogleId } } + } +} + +const SCRIPT = 'https://accounts.google.com/gsi/client' +let loading: Promise | null = null + +/** 구글 로그인 스크립트는 한 번만 받는다. 실패하면 다음에 다시 받는다 */ +export function loadGoogle(): Promise { + if (window.google?.accounts.id) return Promise.resolve(window.google.accounts.id) + loading ??= new Promise((resolve, reject) => { + const s = document.createElement('script') + s.src = SCRIPT + s.async = true + s.onload = () => (window.google?.accounts.id ? resolve(window.google.accounts.id) : reject(new Error('gsi missing'))) + s.onerror = () => { + loading = null + reject(new Error('gsi load failed')) + } + document.head.appendChild(s) + }) + return loading +} + +/** 로그인 안 한 사람은 화면이 한가할 때 스크립트를 미리 받아 둔다. 로그인 창이 올라오는 도중에 스크립트를 실행하느라 화면이 멈추지 않게. 돌려준 함수로 취소 */ +export function preloadGoogle(): () => void { + const run = () => void loadGoogle().catch((e: unknown) => console.error('[google] preload', e)) + if ('requestIdleCallback' in window) { + const id = requestIdleCallback(run, { timeout: 4000 }) + return () => cancelIdleCallback(id) + } + const id = setTimeout(run, 2500) + return () => clearTimeout(id) +} diff --git a/frontend/src/b/lib.ts b/frontend/src/b/lib.ts index 1ba617b..628574e 100644 --- a/frontend/src/b/lib.ts +++ b/frontend/src/b/lib.ts @@ -14,3 +14,6 @@ export function iconSrc(name: string) { export const fall = (d: string, f = '4.8s') => ({ '--d': d, '--f': f }) as CSSProperties export const ARTICLE_CAT: Record = { 1: [ARTICLE_LABEL[1], 'text-[#1f9d62]'], 2: [ARTICLE_LABEL[2], 'text-[#7a5cd6]'], 3: [ARTICLE_LABEL[3], 'text-(--orange)'] } + +/** 아래 창이 다 올라오는 시간(.b-sheet 0.26s). 무거운 일은 이 뒤로 미뤄 올라오는 동안 버벅이지 않게 */ +export const SHEET_OPEN_MS = 280 From 1908433e4611b685a88b86347c57be1848c60151 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Tue, 27 Oct 2026 14:40:33 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=ED=86=A0=EC=8A=A4=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=EA=B0=80=EB=A6=AC=EB=8D=98=20=EA=B8=80=20=EC=A2=85=EB=A5=98?= =?UTF-8?q?(=EC=B9=B4=EB=93=9C=EB=89=B4=EC=8A=A4=20=EB=93=B1)=20=EB=8B=A4?= =?UTF-8?q?=EC=8B=9C=20=EB=B3=B4=EC=9D=B4=EA=B2=8C=20=E2=80=94=20=ED=86=A0?= =?UTF-8?q?=EC=8A=A4=20=EB=B2=88=EB=93=A4=EC=9D=B4=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=EB=8F=BC=20d3d872b=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=A5=BC=20=EB=90=98=EB=8F=8C=EB=A6=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/router/v1/feed/feed.py | 15 ++------------- backend/tests/test_feed_toss.py | 18 ------------------ 2 files changed, 2 insertions(+), 31 deletions(-) delete mode 100644 backend/tests/test_feed_toss.py diff --git a/backend/router/v1/feed/feed.py b/backend/router/v1/feed/feed.py index 6ecc807..05059bd 100644 --- a/backend/router/v1/feed/feed.py +++ b/backend/router/v1/feed/feed.py @@ -1,10 +1,10 @@ from typing import Optional -from fastapi import APIRouter, Depends, Path, Query, Request +from fastapi import APIRouter, Depends, Path, Query from common.auth import optional_user from common.database.model.models import User -from common.enums import ErrorType, PostType +from common.enums import ErrorType from common.liker import Liker, liker from common.models.errors import error_info from router.v1.feed.protocol import Res_Feed, Res_Post @@ -13,26 +13,15 @@ from services.reaction_service import ReactionService router = APIRouter(prefix="/v1/feed", tags=["feed"]) -# 토스에 올라간 10/13 번들은 UV 까지만 알아서, 그 뒤에 생긴 글 종류(카드뉴스 등)가 오면 흰 화면이 된다 -TOSS_KNOWN_MAX = PostType.UV.value - - -def _from_toss(request: Request) -> bool: - ref = request.headers.get("origin") or request.headers.get("referer") or "" - return "AppsInToss" in request.headers.get("user-agent", "") or ".tossmini.com" in ref - @router.get("", response_model=Res_Feed, response_model_exclude_none=True, summary="메인 피드: 하늘 영역, 오늘의 각, 오늘 포스트 전부, 띠") async def get_feed( - request: Request, region: str = Query(..., description="구 행정코드"), user: Optional[User] = Depends(optional_user), who: Liker = Depends(liker), service: FeedService = Depends(), reactions: ReactionService = Depends(), ) -> Res_Feed: err, feed = await service.feed(region) if err is not ErrorType.SUCCESS: return Res_Feed(result=error_info(err)) - if _from_toss(request): - feed = feed.model_copy(update={"posts": [p for p in feed.posts if p.post_type.value <= TOSS_KNOWN_MAX]}) pinned = [x for x in (feed.hero_post, feed.gak_post, feed.foliage_post, feed.events_post, feed.season_post) if x is not None] ids = [p.post_id for p in feed.posts] + [x.post_id for x in pinned] counts = await reactions.counts(ids) diff --git a/backend/tests/test_feed_toss.py b/backend/tests/test_feed_toss.py deleted file mode 100644 index 23a8b24..0000000 --- a/backend/tests/test_feed_toss.py +++ /dev/null @@ -1,18 +0,0 @@ -from starlette.requests import Request - -from common.enums import PostType -from router.v1.feed.feed import TOSS_KNOWN_MAX, _from_toss - - -def _req(headers: dict) -> Request: - return Request({"type": "http", "headers": [(k.lower().encode(), v.encode()) for k, v in headers.items()]}) - - -def test_from_toss_by_referer_or_user_agent(): - assert _from_toss(_req({"referer": "https://nalssigak.apps.tossmini.com/"})) - assert _from_toss(_req({"user-agent": "Mozilla/5.0 ... AppsInToss TossApp/5.282.1"})) - assert not _from_toss(_req({"referer": "https://weather.o2o.kr/", "user-agent": "Mozilla/5.0 Safari"})) - - -def test_card_is_hidden_from_old_toss_bundle(): - assert PostType.CARD.value > TOSS_KNOWN_MAX >= PostType.UV.value