diff --git a/docs/이벤트_추적.md b/docs/이벤트_추적.md
index 6eb4406..39cd614 100644
--- a/docs/이벤트_추적.md
+++ b/docs/이벤트_추적.md
@@ -86,12 +86,9 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화
## 앱 (안드로이드, `mobile/`)
-- **웹뷰 셸 전환(`feat/app-webview-shell`)**: 앱이 날씨각 웹을 웹뷰로 띄우는 껍데기가 되면 아래 앱 이벤트는 쓰지 않고, 웹이 같은 이벤트를 그대로 보내며 `platform: 'android_app'`으로 찍힌다. 앱 안에서 구글 로그인·공유·위치가 실패하면 `app_bridge_error`, 앱을 켜면 `app_launch`(`mode: 'android_app'`)가 나간다. 앱 사용자는 `platform`으로 가른다.
-
-- 앱도 같은 이벤트 이름·값으로 `track()`을 부른다 (`mobile/src/lib/analytics.ts`). 모든 이벤트에 `platform: 'app'`이 붙는다.
-- **아직 GA4로 보내지 않는다 (2026-11-04).** Firebase Analytics(`google-services.json`)를 붙이면 앱 시작 때 `setAnalyticsSender`로 보내는 함수를 단다. 그 전까지 `track()`은 아무것도 보내지 않는다. 개발 빌드(`__DEV__`)는 붙인 뒤에도 보내지 않는다.
-- 앱에서 부르는 곳: `sheet_open`(`components/sheets/index.tsx`), `view_gak`(`sheets/gak.tsx`), `select_content`(`sheets/article.tsx`), `login`·`sign_up`(`sheets/login.tsx`, 구글만), `region_change`(`sheets/region.tsx`·`lib/region.tsx`), `like`(`post/post-card.tsx` 글, `sheets/comments.tsx` 댓글), `comment`·`report`·`block`·`terms_agree`(`sheets/comments.tsx`), `share`(`lib/share-image.ts`), `hero_day_switch`(`today/hero.tsx`), `like`의 `hero_post`·`gak_post`(`lib/pinned-like.ts`). 레벨 창·레벨업 창은 `sheet_open`(`level`·`levelUp`)으로 잡힌다. 동네 이야기: `talk_post`(`components/talk/talk.tsx` `Composer`), `like`·`report`·`block`의 `talk`(`talk/talk.tsx`), `talk_comment`(`sheets/comments.tsx`), `feed_item_view`(`app/(tabs)/index.tsx` `useSeen`, 화면에 반쯤 보일 때). 내 각: `my_gak_save`(`lib/my-gak.ts`), 만들기·상세 창은 `sheet_open`(`mix`·`myGak`). 오늘 아이콘 줄: `today_icon`(`components/today/icons.tsx`). 사주: `saju_input`(`components/saju/birth-form.tsx`), `saju_view`(`saju/reading.tsx`). 단풍 지도: `foliage_open`(`app/foliage.tsx`), `foliage_spot`(`components/foliage/*`, 화면 `page`·피드 카드 `card`). 쇼츠: `shorts_open`·`shorts_view`·`shorts_sound`(`app/shorts/[id].tsx`). 구름 합치기 게임은 앱이 웹 `/game`을 웹뷰로 띄우므로 `game_start`·`game_round`·`game_over`는 웹 페이지가 보내고 `platform: 'web'`으로 찍힌다(앱 안 게임과 웹 게임을 GA에서 나눠 볼 수 없음).
-- 앱 `share`의 `ratio`는 `'card'` — 보이는 카드를 그대로 찍어 보내 비율을 고르지 않는다.
+- 앱은 날씨각 웹을 웹뷰로 띄우는 껍데기라(`mobile/src/components/web-shell.tsx`) 앱에서 따로 보내는 이벤트가 없다. 웹이 같은 이벤트를 그대로 보내고 `platform: 'android_app'`으로 찍힌다. 앱 사용자는 `platform`으로 가른다.
+- 앱에서만 나가는 것: 앱을 켜면 `app_launch`(`mode: 'android_app'`), 앱 안에서 구글 로그인·공유·위치가 실패하면 `app_bridge_error`. 둘 다 웹 코드가 보낸다.
+- 예전 네이티브 화면과 그 화면의 `track()`(`mobile/src/lib/analytics.ts`)은 지웠다. 새 화면·이벤트는 웹(`frontend/`)에만 더한다.
## GA4 설정
diff --git a/mobile/AGENTS.md b/mobile/AGENTS.md
index be05e77..3cb9ccf 100644
--- a/mobile/AGENTS.md
+++ b/mobile/AGENTS.md
@@ -25,9 +25,9 @@ Run lint and typecheck before declaring any task done.
## Navigation & Routing
-- Use **Expo Router** for all navigation. Routes live in `src/app/` — every file there is a screen, `_layout.tsx` files define navigators. Keep non-route code (components, hooks, utils) outside `src/app/`.
-- Import `Link`, `router`, and `useLocalSearchParams` from `expo-router`.
-- Docs: https://docs.expo.dev/router/introduction.md
+- The app is a WebView shell: `src/app/_layout.tsx` renders only `WebShell` (`src/components/web-shell.tsx`), which loads the 날씨각 web site. All screens and navigation live in the web app (`frontend/`), not here. Do not add native screens under `src/app/`.
+- Expo Router is kept only as the app entry point. `src/app/+native-intent.tsx` redirects every incoming link to `/` so the shell can open it in the WebView.
+- Native features the web needs (Google sign-in, location, sharing) go through the bridge in `src/lib/web-bridge.ts`.
## Building with EAS
diff --git a/mobile/app.json b/mobile/app.json
index 430eb3d..d482a67 100644
--- a/mobile/app.json
+++ b/mobile/app.json
@@ -55,7 +55,6 @@
"imageWidth": 200
}
],
- "expo-secure-store",
"expo-sharing",
[
"expo-location",
@@ -63,15 +62,7 @@
"locationWhenInUsePermission": "가장 가까운 동네 날씨를 보여 드리려고 위치를 써요."
}
],
- "@react-native-google-signin/google-signin",
- [
- "expo-image-picker",
- {
- "photosPermission": "동네 이야기에 사진을 붙이려고 사진 앨범을 써요.",
- "cameraPermission": false,
- "microphonePermission": false
- }
- ]
+ "@react-native-google-signin/google-signin"
],
"experiments": {
"typedRoutes": true,
diff --git a/mobile/package.json b/mobile/package.json
index 07db5b2..2cf634e 100644
--- a/mobile/package.json
+++ b/mobile/package.json
@@ -3,44 +3,29 @@
"main": "expo-router/entry",
"version": "1.0.0",
"dependencies": {
- "@expo-google-fonts/bagel-fat-one": "^0.4.0",
- "@expo-google-fonts/gowun-batang": "^0.4.1",
- "@expo-google-fonts/jua": "^0.4.1",
"@expo/ui": "~57.0.23",
- "@nalssigak/shared": "*",
"@react-native-google-signin/google-signin": "^16.1.5",
- "@tanstack/react-query": "^5.104.2",
"expo": "~57.0.28",
"expo-constants": "~57.0.21",
- "expo-device": "~57.0.2",
"expo-file-system": "~57.0.7",
"expo-font": "~57.0.4",
"expo-glass-effect": "~57.0.4",
- "expo-image": "~57.0.5",
- "expo-image-picker": "~57.0.20",
- "expo-linear-gradient": "~57.0.2",
"expo-linking": "~57.0.12",
"expo-location": "~57.0.21",
"expo-router": "~57.0.26",
- "expo-secure-store": "~57.0.4",
"expo-sharing": "~57.0.23",
"expo-splash-screen": "~57.0.10",
"expo-status-bar": "~57.0.1",
"expo-symbols": "~57.0.3",
"expo-system-ui": "~57.0.4",
- "expo-web-browser": "~57.0.3",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-native": "0.86.3",
"react-native-gesture-handler": "~2.32.0",
- "react-native-reanimated": "4.5.1",
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "~4.26.0",
- "react-native-svg": "15.15.4",
- "react-native-view-shot": "5.1.0",
"react-native-web": "~0.21.0",
"react-native-webview": "13.16.1",
- "react-native-worklets": "0.10.1",
"tailwindcss": "^4.3.3",
"uniwind": "^1.12.2"
},
diff --git a/mobile/src/app/(tabs)/_layout.tsx b/mobile/src/app/(tabs)/_layout.tsx
deleted file mode 100644
index 803877b..0000000
--- a/mobile/src/app/(tabs)/_layout.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Tabs } from 'expo-router/tabs';
-
-import { TabBar } from '@/components/tab-bar';
-import { TopBar } from '@/components/top-bar';
-
-/** 아래 탭 다섯 개. 사주·게임 같은 화면은 탭 밖(루트 스택)에서 연다 */
-export default function TabsLayout() {
- return (
- } screenOptions={{ header: () => , sceneStyle: { backgroundColor: 'transparent' } }}>
- {/* 메인인 오늘 탭을 가운데에 */}
-
-
-
-
-
-
- );
-}
diff --git a/mobile/src/app/(tabs)/gak.tsx b/mobile/src/app/(tabs)/gak.tsx
deleted file mode 100644
index 0e044b8..0000000
--- a/mobile/src/app/(tabs)/gak.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-import { listArticlesOptions, listIndicesOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { ArticleCategory, IndexCategory } from '@nalssigak/shared/api/client/types.gen';
-import { kst, loadOf, seasonOf } from '@nalssigak/shared/lib';
-import { useQuery } from '@tanstack/react-query';
-import { useState } from 'react';
-import { Pressable, RefreshControl, ScrollView, View } from 'react-native';
-import { Text } from '@/components/text';
-
-import { GakGrid, GridSkel } from '@/components/gak/grid';
-import { Podium, PodiumSkel } from '@/components/gak/podium';
-import { Chips, Ic, Sec, StateBox } from '@/components/ui';
-import { useRegion } from '@/lib/region';
-import { useSheet } from '@/lib/sheet';
-
-type Cat = 'all' | 'out' | 'food' | 'home' | 'life' | 'core';
-
-// 마지막 칩은 지금 계절의 제철 각 (예: 가을 각)
-const CATS: readonly (readonly [Cat, string])[] = [
- ['all', '전체'],
- ['out', '밖에서 놀기'],
- ['food', '먹고 마시기'],
- ['home', '집안일'],
- ['life', '생활 고민'],
- ['core', `${seasonOf(kst(new Date()).mo)[0]} 각`],
-];
-
-const CAT_PARAM: Partial> = { out: IndexCategory.OUTSIDE, food: IndexCategory.FOOD, home: IndexCategory.HOME, life: IndexCategory.LIFE };
-
-export default function GakScreen() {
- const { region } = useRegion();
- const { open } = useSheet();
- const [cat, setCat] = useState('all');
- const q = useQuery(listIndicesOptions({ query: { region: region.code, category: CAT_PARAM[cat], core: cat === 'core' ? true : undefined } }));
- const articles = useQuery(listArticlesOptions({ query: { category: ArticleCategory.GAK } }));
- const top = q.data?.top3 ?? [];
- const items = q.data?.items ?? [];
- const day = q.data?.day?.split('-').map(Number);
- const load = loadOf(q);
- const howto = articles.data?.articles?.find((a) => a.code === 'howgak');
-
- return (
- q.refetch()} />}>
-
- {top.length === 3 ? : load === 'loading' ? : q.refetch()} empty="오늘 1~3위를 아직 못 정했어요." hold={} />}
-
- {load === 'loading' ? (
-
- ) : !items.length ? (
- // 실패 안내·다시 시도는 위 받침대 자리에 한 번만
- } boxClassName="inset-3" />
- ) : (
-
- )}
- {howto && load !== 'loading' && (
- open({ type: 'article', articleId: howto.article_id })} className="mx-3 mt-1.5 flex-row items-center gap-3 rounded-[22px] bg-[#ece7ff] p-3.5">
-
-
- 각 점수는 어떻게 매길까?
- 기온·비·바람·습도·공기·시간대 6가지로 계산해요
-
-
- )}
-
- );
-}
diff --git a/mobile/src/app/(tabs)/index.tsx b/mobile/src/app/(tabs)/index.tsx
deleted file mode 100644
index d03b294..0000000
--- a/mobile/src/app/(tabs)/index.tsx
+++ /dev/null
@@ -1,178 +0,0 @@
-import { getFeedOptions, getWeatherTodayOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { PostType } from '@nalssigak/shared/api/client/types.gen';
-import { kst, loadOf } from '@nalssigak/shared/lib';
-import { atSlot, PREVIEW } from '@nalssigak/shared/lib/today';
-import { useQuery } from '@tanstack/react-query';
-import { router, useLocalSearchParams } from 'expo-router';
-import { Fragment, useEffect, useRef, type ReactNode } from 'react';
-import { RefreshControl, ScrollView, View, type LayoutRectangle } from 'react-native';
-
-import { FoliageCard } from '@/components/foliage/foliage-card';
-import { MyGakRow } from '@/components/my-gak/my-gak';
-import { isAppPost, PostCard, PostCardSkel } from '@/components/post/post-card';
-import { ShortsRail } from '@/components/shorts/rail';
-import { Composer, TalkPost } from '@/components/talk/talk';
-import { GakCard } from '@/components/today/gak-card';
-import { Hero } from '@/components/today/hero';
-import { TodayIcons } from '@/components/today/icons';
-import { SeasonBand } from '@/components/today/rails';
-import { StateBox } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useFoliage } from '@/lib/foliage';
-import { fromShare } from '@/lib/my-gak';
-import { useRegion } from '@/lib/region';
-import { useSheet } from '@/lib/sheet';
-import { useSky } from '@/lib/sky';
-import { useTopicTalks } from '@/lib/talk';
-
-// 사람 글은 포스트 두 장마다 한 장씩 최신순으로 끼운다
-const TALK_EVERY = 2;
-
-type Spot = { item: 'talk' | 'event'; position: number; y: number; h: number };
-
-/** 피드에 섞인 사람 글·행사 포스트가 처음 반쯤 보일 때 한 번 GA 로 보낸다 (웹 Seen) */
-function useSeen() {
- const spots = useRef(new Map());
- const sent = useRef(new Set());
- const view = useRef({ y: 0, h: 0 });
- const check = () => {
- const { y, h } = view.current;
- if (!h) return;
- for (const [key, s] of spots.current) {
- if (sent.current.has(key) || !s.h) continue;
- const shown = Math.min(y + h, s.y + s.h) - Math.max(y, s.y);
- if (shown < s.h / 2) continue;
- sent.current.add(key);
- track('feed_item_view', { item_type: s.item, position: s.position });
- }
- };
- const at = (item: Spot['item'], position: number) => (l: LayoutRectangle) => {
- spots.current.set(`${item}:${position}`, { item, position, y: l.y, h: l.height });
- check();
- };
- const onScroll = (y: number, h: number) => {
- view.current = { y, h };
- check();
- };
- return { at, onScroll };
-}
-
-export default function TodayScreen() {
- const { region } = useRegion();
- const feed = useQuery(getFeedOptions({ query: { region: region.code } }));
- const today = useQuery(getWeatherTodayOptions({ query: { region: region.code } }));
- const { preview } = useSky();
- const f = feed.data;
- const posts = (f?.posts ?? []).filter(isAppPost);
- const stories = atSlot(f?.stories ?? [], preview);
- const sloted = preview != null && stories !== f?.stories;
- const bands = f?.bands;
- const nowAt = f?.hero?.now_at;
- const load = loadOf(feed);
- const talkList = useTopicTalks();
- const talks = talkList.talks;
- const talkAt = (i: number) => ((i + 1) % TALK_EVERY === 0 ? talks[(i + 1) / TALK_EVERY - 1] : undefined);
- const talkFrom = Math.floor(posts.length / TALK_EVERY);
- const eventNo = new Map(posts.filter((p) => p.post_type === PostType.EVENT).map((p, n) => [p.post_id, n + 1]));
- const seen = useSeen();
- const { inSeason } = useFoliage();
- const scroll = useRef(null);
- const myGakY = useRef(0);
- const { open } = useSheet();
- const { my } = useLocalSearchParams<{ my?: string }>();
-
- // 친구가 보낸 내 각 링크(?my=...)로 들어오면 내 동네 기준으로 보여 준다
- useEffect(() => {
- if (!my) return;
- router.setParams({ my: undefined });
- const g = fromShare(my);
- if (g) open({ type: 'mix', shared: g });
- }, [my, open]);
- const refresh = () => Promise.all([feed.refetch(), today.refetch(), talkList.refetch()]);
-
- // 웹처럼 9번째 글 뒤에 계절 이야기 띠를 넣고, 글이 모자라면 맨 뒤에 붙인다
- const bandAt: [number, ReactNode][] = [[9, bands?.season?.length ? : null]];
-
- return (
- // 지역마다 새로 그려 넘긴 슬라이드 위치가 남지 않게 한다
- }
- style={{ opacity: feed.isPlaceholderData ? 0.6 : 1 }}
- keyboardShouldPersistTaps="handled"
- scrollEventThrottle={200}
- onLayout={(e) => seen.onScroll(0, e.nativeEvent.layout.height)}
- onScroll={(e) => seen.onScroll(e.nativeEvent.contentOffset.y, e.nativeEvent.layoutMeasurement.height)}
- >
-
- scroll.current?.scrollTo({ y: myGakY.current, animated: true })} />
-
-
- {/* 아이콘 줄 '내 각'이 여기로 내려온다 */}
- (myGakY.current = e.nativeEvent.layout.y)}>
-
-
- {/* 실패 안내는 여기 한 번만, 각 카드 스켈레톤과 같은 크기로 */}
- {stories.some((g) => g.active) ? (
-
- ) : load === 'loading' ? (
-
- ) : (
- feed.refetch()} empty="오늘 계산된 각이 없어요." hold={} boxClassName="inset-x-3 top-3 bottom-1" />
- )}
- {load === 'loading' && (
- <>
-
-
- >
- )}
- {/* 글이 없거나 못 받아도 스켈레톤 두 장 자리는 그대로 둔다 */}
- {load !== 'loading' && !posts.length && (
-
-
-
- >
- }
- boxClassName="inset-x-3 top-3.5"
- />
- )}
- {/* 단풍철엔 단풍 지도를 포스트 맨 앞에 */}
- {load !== 'loading' && posts.length > 0 && }
- {posts.map((p, i) => {
- const t = talkAt(i);
- const ev = eventNo.get(p.post_id);
- return (
-
- {ev ? (
- seen.at('event', ev)(e.nativeEvent.layout)}>
-
-
- ) : (
-
- )}
- {bandAt.find(([at]) => at === i + 1)?.[1]}
- {t && (
- seen.at('talk', (i + 1) / TALK_EVERY)(e.nativeEvent.layout)}>
-
-
- )}
-
- );
- })}
- {/* 포스트가 모자라 끼울 자리가 없던 사람 글은 맨 뒤에 */}
- {feed.isSuccess &&
- talks.slice(talkFrom).map((t, n) => (
- seen.at('talk', talkFrom + n + 1)(e.nativeEvent.layout)}>
-
-
- ))}
- {feed.isSuccess && bandAt.filter(([at]) => at > posts.length).map(([at, node]) => {node})}
-
- );
-}
diff --git a/mobile/src/app/(tabs)/season.tsx b/mobile/src/app/(tabs)/season.tsx
deleted file mode 100644
index e57743a..0000000
--- a/mobile/src/app/(tabs)/season.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { getSeasonWeekOptions, listArticlesOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { ArticleCategory } from '@nalssigak/shared/api/client/types.gen';
-import { loadOf } from '@nalssigak/shared/lib';
-import { useQuery } from '@tanstack/react-query';
-import { useState } from 'react';
-import { RefreshControl, ScrollView, View } from 'react-native';
-
-import { ArticleRow, HeadSkel, RowsSkel, SeasonHead } from '@/components/season/parts';
-import { Chips, StateBox } from '@/components/ui';
-import { useSheet } from '@/lib/sheet';
-
-const CATS = [
- ['all', '전체'],
- ['season', '계절 소식'],
- ['tip', '날씨 상식'],
- ['gak', '각 원리'],
-] as const;
-
-const CAT_PARAM = { season: ArticleCategory.SEASON, tip: ArticleCategory.TIP, gak: ArticleCategory.GAK } as const;
-
-export default function SeasonScreen() {
- const { open } = useSheet();
- const [cat, setCat] = useState<(typeof CATS)[number][0]>('all');
- const week = useQuery(getSeasonWeekOptions());
- const arts = useQuery(listArticlesOptions(cat === 'all' ? undefined : { query: { category: CAT_PARAM[cat] } }));
- const w = week.data;
- const list = arts.data?.articles ?? [];
- const weekLoad = loadOf(week);
- const artLoad = loadOf(arts);
- const refresh = () => Promise.all([week.refetch(), arts.refetch()]);
-
- return (
- }>
- {w?.headline ? open({ type: 'seasonWeek' })} /> : weekLoad === 'loading' ? : week.refetch()} empty="이번 주 특집이 아직 없어요." hold={} />}
-
-
- {artLoad === 'loading' && }
- {artLoad !== 'loading' && !list.length && arts.refetch()} empty="읽을거리가 아직 없어요." hold={} boxClassName="inset-3" />}
- {list.map((a) => (
- open({ type: 'article', articleId: a.article_id })} />
- ))}
-
-
- );
-}
diff --git a/mobile/src/app/(tabs)/sky.tsx b/mobile/src/app/(tabs)/sky.tsx
deleted file mode 100644
index 8b18c60..0000000
--- a/mobile/src/app/(tabs)/sky.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-import { getSkyOptions, getSkyRankingOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { loadOf } from '@nalssigak/shared/lib';
-import { useQuery } from '@tanstack/react-query';
-import { useState } from 'react';
-import { RefreshControl, ScrollView, View } from 'react-native';
-
-import { DayTiles, Li, LiSkel, ScoreHelp, SkyHero, Timeline } from '@/components/sky/parts';
-import { Sec, Skel, StateBox } from '@/components/ui';
-import { useRegion } from '@/lib/region';
-
-const THREE = [0, 1, 2];
-const RANK_SKELS = Array.from({ length: 8 }, (_, i) => i);
-
-/** 히어로 글자 자리 (실패·빈 안내를 같은 높이로 띄우려고) */
-function HeroHold() {
- return (
-
-
-
-
- );
-}
-
-function LiSkels({ n }: { n: number[] }) {
- return (
-
- {n.map((i) => (
-
- ))}
-
- );
-}
-
-export default function SkyScreen() {
- const { region } = useRegion();
- const sky = useQuery(getSkyOptions({ query: { region: region.code } }));
- const ranking = useQuery(getSkyRankingOptions());
- const load = loadOf(sky);
- const rankLoad = loadOf(ranking);
- const plans = sky.data?.plans ?? [];
- const [picked, setPicked] = useState();
- // 타일을 누르면 그날, 아니면 다음에 오는 날
- const plan = plans.find((p) => p.day === picked) ?? sky.data?.plan ?? undefined;
- const spots = (sky.data?.spots ?? []).slice(0, 3);
- const items = (ranking.data?.items ?? []).slice(0, 8);
- const rise = plan?.kind === 'sunrise';
- const refresh = () => Promise.all([sky.refetch(), ranking.refetch()]);
-
- return (
- } style={{ opacity: sky.isPlaceholderData ? 0.6 : 1 }}>
- {plan || load === 'loading' ? (
-
- ) : (
-
- sky.refetch()} empty="오늘 노을 정보가 없어요." hold={} boxClassName="inset-x-0 top-1.5 bottom-0" />
-
- )}
- {plans.length > 1 && }
- {plan && }
-
- {plan?.timeline?.length || load === 'loading' ? : } />}
- {!rise && }
- {rise ? null : spots.length ? (
-
- {spots.map((p, i) => (
-
- ))}
- {/* 3곳이 안 되면 빈 줄로 높이를 지켜 아래 순위가 밀리지 않게 */}
- {THREE.slice(spots.length).map((i) => (
-
- ))}
-
- ) : load === 'loading' ? (
-
- {THREE.map((i) => (
-
- ))}
-
- ) : (
- // 실패 안내·다시 시도는 위 히어로에 한 번만
- } />
- )}
-
- {items.length ? (
-
- {items.map((r, i) => (
-
- ))}
-
- ) : rankLoad === 'loading' ? (
-
- {RANK_SKELS.map((i) => (
-
- ))}
-
- ) : (
- ranking.refetch()} empty="순위가 아직 없어요." hold={} boxClassName="inset-x-3 top-1.5 bottom-0" />
- )}
-
- );
-}
diff --git a/mobile/src/app/(tabs)/week.tsx b/mobile/src/app/(tabs)/week.tsx
deleted file mode 100644
index b05057b..0000000
--- a/mobile/src/app/(tabs)/week.tsx
+++ /dev/null
@@ -1,153 +0,0 @@
-import { getWeekOptions, getWeekRankingOptions, listEventsOptions, listPlacesOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { loadOf, shortDay } from '@nalssigak/shared/lib';
-import { useQuery } from '@tanstack/react-query';
-import { useRef, useState } from 'react';
-import { Pressable, RefreshControl, ScrollView, View } from 'react-native';
-import { Text } from '@/components/text';
-
-import { DayStrip, EventRow, PickCard, PlaceCard, RankRow } from '@/components/week/sections';
-import { DaysSkel, EventsSkel, PickSkel, PlacesSkel, RankSkel } from '@/components/week/skels';
-import { Chips, Rail, Sec, Skel, StateBox } from '@/components/ui';
-import { useRegion } from '@/lib/region';
-import { useShare } from '@/lib/share-image';
-import { SITE_URL } from '@/lib/site';
-
-// 불러오는 동안에도 탭 줄 높이를 지키려고 같은 칩을 미리 그린다
-const RANK_TABS_HOLD = [
- ['토', '토요일'],
- ['일', '일요일'],
-] as const;
-
-export default function WeekScreen() {
- const { region } = useRegion();
- const week = useQuery(getWeekOptions({ query: { region: region.code } }));
- const days = week.data?.days ?? [];
- const [picked, setPicked] = useState(null);
- // 지역을 바꾸면 동네 고르기는 전체로 돌아간다
- const [areaPick, setAreaPick] = useState({ region: region.code, area: '전체' });
- const area = areaPick.region === region.code ? areaPick.area : '전체';
- // 처음에는 이번 토요일을 고른다
- const sel = days.find((d) => d.day === picked) ?? days.find((d) => d.weekday === '토') ?? days[0];
- const places = useQuery({ ...listPlacesOptions({ query: { region: region.code, day: sel?.day, area: area === '전체' ? undefined : area } }), enabled: !!sel });
- const events = useQuery(listEventsOptions({ query: { region: region.code } }));
- const ranking = useQuery(getWeekRankingOptions());
- const rankDays = ranking.data?.days ?? [];
- const [rankPick, setRankPick] = useState(null);
- const rankDay = rankDays.find((d) => d.day === rankPick) ?? rankDays[0];
- const rankItems = (rankDay?.items ?? []).slice(0, 10);
- const rankLoad = loadOf(ranking);
- const areas = places.data?.areas ?? [];
- const rainy = places.data?.rainy ?? sel?.is_rainy;
- const placeList = places.data?.places ?? [];
- const eventList = events.data?.events ?? [];
- const weekLoad = loadOf(week);
- const eventLoad = loadOf(events);
- // 날씨(고른 날)가 와야 명소를 부를 수 있다
- const placeLoad = sel ? loadOf(places) : weekLoad === 'loading' ? 'loading' : 'ready';
- const refresh = () => Promise.all([week.refetch(), events.refetch(), ranking.refetch(), sel ? places.refetch() : null]);
-
- const shareView = useShare();
- const pickShot = useRef(null);
- // 고른 날 추천 카드를 이미지로
- const sendPlan = () => {
- if (!sel) return;
- const message = [`${sel.weekday}요일 일정 · ${region.name}`, sel.headline, sel.summary, sel.pick, `날씨각 ${SITE_URL}`].filter(Boolean).join('\n');
- void shareView(pickShot, { title: `${sel.weekday}요일 일정`, message });
- };
-
- const placeSub = sel ? `${sel.weekday}요일은 ${rainy ? '비가 와서 실내 명소를 먼저' : sel.icon === 'sun' ? '맑아서 야외 명소를 먼저' : '비 소식이 없어 야외 명소를 먼저'} 보여 줘요` : weekLoad === 'loading' ? undefined : '날씨에 맞춰 골라 보여 줘요';
-
- return (
- }>
-
- {days.length ? (
-
- ) : weekLoad === 'loading' ? (
- <>
-
-
- >
- ) : (
- week.refetch()}
- empty="날씨가 아직 없어요."
- hold={
- <>
-
-
- >
- }
- />
- )}
- {sel && (
-
-
-
- )}
- {(sel || weekLoad !== 'ready') && (
- <>
- 30km 안 · 데이트 명소
- [a, a] as const)} value={area} onChange={(a) => setAreaPick({ region: region.code, area: a })} disabled={!areas.length} />
- >
- )}
- {/* 명소 데이터가 없으면 칸 전체를 숨긴다 */}
- {!(placeLoad === 'ready' && !placeList.length) && (
- <>
-
-
-
- {!placeSub && }
- {placeList.length ? (
-
-
- {placeList.map((p, i) => (
-
- ))}
-
-
- ) : placeLoad === 'loading' ? (
-
- ) : (
- places.refetch()} empty={sel ? '30km 안에 데이트 명소가 아직 없어요.' : '날씨를 불러오면 명소를 골라 드려요.'} hold={} />
- )}
- >
- )}
-
- {rankDays.length ? (
- [d.day, `${d.weekday}요일 ${shortDay(d.day)}`] as const)} value={rankDay?.day ?? ''} onChange={setRankPick} />
- ) : (
- undefined} disabled />
- )}
- {rankItems.length ? (
-
- {rankItems.map((r) => (
-
- ))}
-
- ) : rankLoad === 'loading' ? (
-
- ) : (
- ranking.refetch()} empty="주말 예보가 아직 없어요." hold={} boxClassName="inset-x-3 top-1.5 bottom-0" />
- )}
-
- {eventList.length ? (
-
- {eventList.map((e, i) => (
-
- ))}
-
- ) : eventLoad === 'loading' ? (
-
- ) : (
- events.refetch()} empty="30km 안에 열리는 행사가 아직 없어요. 다른 지역을 골라 보세요." hold={} boxClassName="inset-x-3 top-2.5 bottom-0" />
- )}
- {/* 행사 수가 정해진 뒤에 붙여 목록이 늘어날 때 밀리지 않게 */}
- {eventLoad !== 'loading' && (
-
- 이번 주말 일정 보내기
-
- )}
-
- );
-}
diff --git a/mobile/src/app/foliage.tsx b/mobile/src/app/foliage.tsx
deleted file mode 100644
index 9747e98..0000000
--- a/mobile/src/app/foliage.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import { headline, md, type Kind, type Spot } from '@nalssigak/shared/lib/foliage';
-import { useLocalSearchParams } from 'expo-router';
-import { useEffect, useMemo, useRef, useState } from 'react';
-import { Pressable, ScrollView, useWindowDimensions, View } from 'react-native';
-import { useCSSVariable } from 'uniwind';
-
-import { FoliageMap, type FoliageMapHandle } from '@/components/foliage/foliage-map';
-import { ChosenBar, SpotList } from '@/components/foliage/spot-list';
-import { SendIcon } from '@/components/post/icons';
-import { ScreenHeader } from '@/components/screen-header';
-import { Text } from '@/components/text';
-import { Chips, Ic } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useFoliage } from '@/lib/foliage';
-import { useShare } from '@/lib/share-image';
-import { SITE_URL } from '@/lib/site';
-
-type Filter = 'all' | Kind;
-const FILTERS: [Filter, string][] = [
- ['all', '전체'],
- ['maple', '단풍'],
- ['ginkgo', '은행'],
-];
-
-/** 단풍 지도: 명소 67곳을 지도에서 확대해 보고 아래 목록으로 고른다. ?spot= 으로 열면 그 명소로 (웹 FoliagePage) */
-export default function FoliageScreen() {
- const params = useLocalSearchParams<{ spot?: string }>();
- const { today, spots } = useFoliage();
- const [filter, setFilter] = useState('all');
- const [sel, setSel] = useState(params.spot ?? null);
- const mapRef = useRef(null);
- const shotRef = useRef(null);
- const shareView = useShare();
- const ink = String(useCSSVariable('--color-ink'));
- const { width, height: winH } = useWindowDimensions();
- // 지도는 스크롤 밖에 고정: 가로만큼 정사각형, 화면이 낮으면 화면 높이의 45%까지
- const mapH = Math.max(280, Math.min(width * 1.05, winH * 0.45, 560));
- const shown = useMemo(() => spots.filter((m) => filter === 'all' || m.kind === filter), [spots, filter]);
-
- useEffect(() => track('foliage_open', {}), []);
- useEffect(() => {
- if (sel) track('foliage_spot', { spot_name: sel, from: 'page' });
- }, [sel]);
-
- const chosen = spots.find((m) => m.name === sel);
- const peakCount = spots.filter((m) => m.stage === 'peak').length;
- const title = headline(spots);
- const pick = (m: Spot) => {
- setSel(m.name);
- mapRef.current?.focus(m);
- };
- const share = () => void shareView(shotRef, { title: chosen ? `${chosen.name} 단풍` : '단풍 지도', message: `${title} · 날씨각 단풍 지도 ${SITE_URL}/foliage` });
-
- return (
-
-
-
-
- }
- />
-
-
-
- {`단풍 지도 · ${md(today)}`}
-
- {title}
-
- {/* 보내기는 지금 보이는 지도 그대로 찍어 보낸다 (웹은 따로 만든 공유 그림) */}
-
-
-
-
-
-
-
-
- {`출처: 산림청 2026 단풍절정 예측 · 잎 절반이 물든 때를 절정으로, 그 2주 전부터 첫 단풍으로 봐요${peakCount ? ` · 지금 절정 ${peakCount}곳` : ''}`}
-
-
-
- );
-}
diff --git a/mobile/src/app/game.tsx b/mobile/src/app/game.tsx
deleted file mode 100644
index ba0f464..0000000
--- a/mobile/src/app/game.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import { getAccessToken } from '@nalssigak/shared/api/auth';
-import { router } from 'expo-router';
-import { useRef, useState } from 'react';
-import { ActivityIndicator, Linking, View } from 'react-native';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { WebView, type WebViewMessageEvent } from 'react-native-webview';
-
-import { ScreenHeader } from '@/components/screen-header';
-import { Text } from '@/components/text';
-import { useAuth } from '@/lib/auth';
-import { useRegion } from '@/lib/region';
-import { useSheet } from '@/lib/sheet';
-import { SITE_URL } from '@/lib/site';
-
-const SITE_ORIGIN = new URL(SITE_URL).origin;
-
-/** 게임 웹뷰는 날씨각 사이트 안에서만 움직인다. 다른 주소(외부 링크)는 휴대폰 브라우저로 연다 */
-function stayOnSite(url: string) {
- if (url.startsWith(`${SITE_ORIGIN}/`) || url === SITE_ORIGIN || url === 'about:blank') return true;
- if (/^https?:/.test(url)) Linking.openURL(url).catch((e: unknown) => console.warn('[game] 외부 주소를 열지 못함', url, e));
- return false;
-}
-
-/**
- * 웹 페이지가 뜨기 전에 넣는 스크립트: 앱의 지역·로그인을 웹 저장소에 옮기고,
- * 게임 화면을 떠나는 이동(뒤로 버튼)과 '로그인하면 …' 버튼은 앱으로 알린다 (웹 구글 로그인은 앱 안 웹뷰에서 막힌다).
- * 갱신 토큰은 넘기지 않는다: 웹이 갱신하면 앱이 가진 갱신 토큰이 쓸모없어질 수 있다.
- * 날씨각 사이트에서 열렸을 때만 토큰을 넣는다 (다른 곳으로 넘어가면 아무것도 하지 않는다).
- */
-function bridge(region: unknown, token: string | null) {
- return `(function () {
- if (location.origin !== ${JSON.stringify(SITE_ORIGIN)}) return;
- try {
- localStorage.setItem('nalssigak.b.region', ${JSON.stringify(JSON.stringify(region))});
- ${token ? `localStorage.setItem('nalssigak.accessToken', ${JSON.stringify(token)});` : `localStorage.removeItem('nalssigak.accessToken');`}
- localStorage.removeItem('nalssigak.refreshToken');
- } catch (e) {}
- var post = function (t) { window.ReactNativeWebView.postMessage(t); };
- var check = function () { if (location.pathname !== '/game') post('leave'); };
- var push = history.pushState, replace = history.replaceState;
- history.pushState = function () { push.apply(this, arguments); check(); };
- history.replaceState = function () { replace.apply(this, arguments); check(); };
- window.addEventListener('popstate', check);
- document.addEventListener('click', function (e) {
- var b = e.target && e.target.closest && e.target.closest('button');
- if (b && b.textContent && b.textContent.trim().indexOf('로그인') === 0) { e.preventDefault(); e.stopPropagation(); post('login'); }
- }, true);
-})();
-true;`;
-}
-
-/** 구름 합치기 게임: 웹 /game 을 그대로 띄운다 (물리 엔진·캔버스라 웹과 같은 화면, 사용자 결정 11/04) */
-export default function GameScreen() {
- const { region } = useRegion();
- const { loggedIn } = useAuth();
- const { open } = useSheet();
- const { top, bottom } = useSafeAreaInsets();
- const [failed, setFailed] = useState(false);
- const left = useRef(false);
-
- const onMessage = (e: WebViewMessageEvent) => {
- if (e.nativeEvent.data === 'leave' && !left.current) {
- left.current = true;
- if (router.canGoBack()) router.back();
- else router.replace('/');
- }
- if (e.nativeEvent.data === 'login') open({ type: 'login' });
- };
-
- if (failed)
- return (
-
-
- 게임을 불러오지 못했어요. 인터넷 연결을 확인하고 다시 들어와 주세요.
-
- );
-
- return (
-
- {/* 로그인하면 토큰을 다시 넣어야 해서 로그인 여부로 새로 띄운다 */}
- stayOnSite(req.url)}
- injectedJavaScriptBeforeContentLoaded={bridge(region, getAccessToken())}
- onMessage={onMessage}
- onError={() => setFailed(true)}
- startInLoadingState
- renderLoading={() => }
- overScrollMode="never"
- bounces={false}
- setSupportMultipleWindows={false}
- style={{ backgroundColor: 'transparent' }}
- />
-
- );
-}
diff --git a/mobile/src/app/index.tsx b/mobile/src/app/index.tsx
new file mode 100644
index 0000000..f02642d
--- /dev/null
+++ b/mobile/src/app/index.tsx
@@ -0,0 +1,7 @@
+/**
+ * 화면은 _layout.tsx 의 웹 셸이 다 그린다. 이 파일은 Expo Router 가 '/' 경로를 알게 하려고 둔다.
+ * 경로 파일이 하나도 없으면 Expo Router 가 우리 _layout 대신 자기 안내 화면(_sitemap)을 띄우다 앱이 죽는다.
+ */
+export default function Index() {
+ return null;
+}
diff --git a/mobile/src/app/saju.tsx b/mobile/src/app/saju.tsx
deleted file mode 100644
index c5453d5..0000000
--- a/mobile/src/app/saju.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-import { useLocalSearchParams } from 'expo-router';
-import { useMemo, useRef, useState } from 'react';
-import { ScrollView, View } from 'react-native';
-
-import { BirthForm } from '@/components/saju/birth-form';
-import { OpenTarget } from '@/components/saju/parts';
-import { Reading } from '@/components/saju/reading';
-import { ScreenHeader } from '@/components/screen-header';
-import { Text } from '@/components/text';
-import { useAccountBirth, useBirth } from '@/lib/saju-birth';
-
-type Pos = { base: number | null; panel: number | null; done: boolean };
-
-function tryScroll(p: Pos, view: ScrollView | null) {
- if (p.done || p.base == null || p.panel == null || !view) return;
- p.done = true;
- view.scrollTo({ y: Math.max(0, p.base + p.panel - 12), animated: true });
-}
-
-/** 날씨 사주(/saju): 오늘 점수와 할 일, 내 기운, 레벨로 열리는 칸. ?open=saju_love 처럼 열면 그 칸으로 내려간다 (웹 SajuPage, #hash) */
-export default function SajuScreen() {
- const params = useLocalSearchParams<{ open?: string }>();
- const birth = useBirth();
- const loading = useAccountBirth();
- const [editing, setEditing] = useState(false);
- const scroll = useRef(null);
- // 결과 묶음의 위치와 그 안에서 연 칸의 위치를 둘 다 알아야 내려갈 수 있다 (어느 쪽이 먼저 잡힐지 모른다)
- const pos = useRef({ base: null, panel: null, done: false });
- const target = useMemo(
- () => ({
- id: params.open,
- onLayout: (y: number) => {
- pos.current.panel = y;
- tryScroll(pos.current, scroll.current);
- },
- }),
- [params.open],
- );
-
- return (
-
-
-
- {loading && !birth ? (
- 내 생년월일을 불러오는 중이에요…
- ) : !birth || editing ? (
- setEditing(false)} onCancel={birth ? () => setEditing(false) : undefined} />
- ) : (
- {
- pos.current.base = e.nativeEvent.layout.y;
- tryScroll(pos.current, scroll.current);
- }}
- >
-
- setEditing(true)} />
-
-
- )}
-
-
- );
-}
diff --git a/mobile/src/app/shorts/[id].tsx b/mobile/src/app/shorts/[id].tsx
deleted file mode 100644
index 780a6e0..0000000
--- a/mobile/src/app/shorts/[id].tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import { listShortsOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import type { ShortItem } from '@nalssigak/shared/api/client/types.gen';
-import { useQuery } from '@tanstack/react-query';
-import { Image } from 'expo-image';
-import { router, useLocalSearchParams } from 'expo-router';
-import { useEffect, useRef, useState } from 'react';
-import { FlatList, Pressable, View, type ViewToken } from 'react-native';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import Svg, { Path } from 'react-native-svg';
-
-import { ShortPlayer, type PlayerHandle } from '@/components/shorts/player';
-import { thumb } from '@/components/shorts/rail';
-import { Text } from '@/components/text';
-import { track } from '@/lib/analytics';
-
-const BAR = 48;
-
-/** 쇼츠 화면: 그 영상부터 위아래로 넘겨 본다. 보이는 영상과 앞뒤만 소리 없이 미리 띄우고, 누르면 소리 켜기·끄기 (웹 ShortsPage) */
-export default function ShortsScreen() {
- const { id } = useLocalSearchParams<{ id?: string }>();
- const q = useQuery(listShortsOptions());
- const { top, bottom } = useSafeAreaInsets();
- // 처음 들어온 영상만 시작점으로 쓴다
- const [firstId] = useState(id);
- const listed = q.data?.items ?? [];
- const items: ShortItem[] = firstId && listed.length && !listed.some((s) => s.id === firstId) ? [{ id: firstId, title: '' }, ...listed] : listed;
- const start = Math.max(0, items.findIndex((s) => s.id === firstId));
- const [at, setAt] = useState(start);
- const [sound, setSound] = useState(false);
- const [ready, setReady] = useState>(new Set());
- const [box, setBox] = useState({ w: 0, h: 0 });
- const players = useRef(new Map());
- const soundRef = useRef(false);
- const atRef = useRef(start);
-
- useEffect(() => {
- if (firstId) track('shorts_open', { video_id: firstId });
- }, [firstId]);
-
- // 넘어온 영상만 처음부터 다시 틀고 소리를 맞춘다. 앞뒤는 소리만 끈다 (멈추면 유튜브 버튼이 떠서 멈추지 않는다)
- useEffect(() => {
- for (const [i, p] of players.current) {
- if (i === at) {
- p.command('seekTo', [0, true]);
- p.command(soundRef.current ? 'unMute' : 'mute');
- p.command('playVideo');
- } else p.command('mute');
- }
- }, [at]);
-
- // FlatList 는 이 함수가 바뀌면 안 되어 처음 한 번만 만든다
- const [onViewable] = useState(() => ({ viewableItems }: { viewableItems: ViewToken[] }) => {
- const i = viewableItems[0]?.index;
- if (i == null || i === atRef.current) return;
- atRef.current = i;
- setAt(i);
- const s = viewableItems[0].item;
- track('shorts_view', { video_id: s.id, index: i });
- });
-
- const toggleSound = () => {
- const on = !soundRef.current;
- soundRef.current = on;
- setSound(on);
- track('shorts_sound', { on });
- players.current.get(at)?.command(on ? 'unMute' : 'mute');
- };
-
- const close = () => (router.canGoBack() ? router.back() : router.replace('/'));
- // 9:16 을 칸 안에 맞춘다
- const w = Math.min(box.w, (box.h * 9) / 16);
- const h = (w * 16) / 9;
-
- return (
-
- {!!items[at] && }
-
-
-
-
-
-
- {sound ? '소리 끄기' : '소리 켜기'}
-
-
- setBox({ w: e.nativeEvent.layout.width, h: e.nativeEvent.layout.height })}>
- {box.h > 0 && items.length > 0 && (
- s.id}
- pagingEnabled
- showsVerticalScrollIndicator={false}
- initialScrollIndex={start}
- getItemLayout={(_, i) => ({ length: box.h, offset: box.h * i, index: i })}
- onViewableItemsChanged={onViewable}
- viewabilityConfig={{ itemVisiblePercentThreshold: 60 }}
- windowSize={3}
- renderItem={({ item: s, index: i }) => (
-
-
-
- {/* 릴스처럼 앞뒤 영상을 소리 없이 미리 받아 둔다. 첫 장면 전엔 표지가 보이게 숨긴다 */}
- {Math.abs(i - at) <= 1 && (
-
- {
- if (p) players.current.set(i, p);
- else players.current.delete(i);
- }}
- onPlaying={() => setReady((r) => (r.has(i) ? r : new Set(r).add(i)))}
- />
-
- )}
- {/* 누르면 소리 켜기·끄기, 위아래로 밀면 목록이 넘어간다 */}
-
-
-
- )}
- />
- )}
-
-
- );
-}
diff --git a/mobile/src/app/shorts/index.tsx b/mobile/src/app/shorts/index.tsx
deleted file mode 100644
index 66ce3ae..0000000
--- a/mobile/src/app/shorts/index.tsx
+++ /dev/null
@@ -1,2 +0,0 @@
-// 아이콘 줄 '쇼츠'(/shorts)는 첫 영상부터
-export { default } from './[id]';
diff --git a/mobile/src/app/talk.tsx b/mobile/src/app/talk.tsx
deleted file mode 100644
index a53a2dd..0000000
--- a/mobile/src/app/talk.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import type { TalkTopic } from '@nalssigak/shared/api/client/types.gen';
-import { router, useLocalSearchParams } from 'expo-router';
-import { FlatList, Pressable, RefreshControl, ScrollView, View } from 'react-native';
-
-import { ScreenHeader } from '@/components/screen-header';
-import { Composer, TalkCard } from '@/components/talk/talk';
-import { Text } from '@/components/text';
-import { Sec } from '@/components/ui';
-import { useAuth } from '@/lib/auth';
-import { useSheet } from '@/lib/sheet';
-import { openTopics, TOPICS, useMyTalks, useTopicTalks } from '@/lib/talk';
-
-type Tab = TalkTopic | 'all' | 'mine';
-
-/** 주제별 사람 글: 위 주제 탭(한 줄 가로로 밀기, 끝에 '내 글'), 아래 글 목록. ?topic= · ?mine=1 로 연다 (웹 TalkPage) */
-export default function TalkScreen() {
- const params = useLocalSearchParams<{ topic?: string; mine?: string }>();
- const { loggedIn } = useAuth();
- const { open } = useSheet();
- const raw = Number(params.topic);
- const tab: Tab = params.mine ? 'mine' : TOPICS.some(([k]) => k === raw) ? (raw as TalkTopic) : 'all';
- const topicList = useTopicTalks(tab === 'all' || tab === 'mine' ? undefined : tab);
- const mineList = useMyTalks(tab === 'mine' && loggedIn);
- const { talks, loaded, more, loadMore } = tab === 'mine' ? mineList : topicList;
- const tabs: (readonly [Tab, string])[] = [['all', '전체'], ...openTopics(), ['mine', '내 글']];
- const go = (k: Tab) => router.setParams(k === 'mine' ? { mine: '1', topic: undefined } : k === 'all' ? { mine: undefined, topic: undefined } : { mine: undefined, topic: String(k) });
-
- const head = (
-
-
-
-
- {tabs.map(([k, label]) => (
- go(k)} accessibilityRole="tab" accessibilityState={{ selected: tab === k }} className={`rounded-full px-3 py-1.5 ${tab === k ? 'bg-ink-btn' : 'bg-card'}`}>
- {label}
-
- ))}
-
-
-
- {tab === 'mine' && !loggedIn ? (
-
- 로그인하면 내가 쓴 글을 모아 볼 수 있어요.{' '}
- open({ type: 'login' })} className="font-extrabold text-orange">
- 로그인
-
-
- ) : (
- loaded && !talks.length && {tab === 'mine' ? '아직 쓴 글이 없어요. 위 칸에서 첫 글을 써 주세요.' : '아직 이 주제 글이 없어요. 위 칸에서 첫 글을 써 주세요.'}
- )}
-
- );
-
- return (
-
-
- `${t.talk_id}:${t.liked}:${t.like_count}`}
- renderItem={({ item }) => }
- ListHeaderComponent={head}
- contentContainerClassName="pb-8"
- keyboardShouldPersistTaps="handled"
- // 목록 끝이 가까워지면 다음 쪽을 받는다 (글이 많아도 버튼 없이 이어서)
- onEndReached={() => more && loadMore()}
- onEndReachedThreshold={1}
- refreshControl={tab !== 'mine' ? topicList.refetch()} /> : undefined}
- />
-
- );
-}
diff --git a/mobile/src/components/fall.tsx b/mobile/src/components/fall.tsx
deleted file mode 100644
index eb31beb..0000000
--- a/mobile/src/components/fall.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import { useEffect, type ReactNode } from 'react';
-import type { ViewStyle } from 'react-native';
-import Animated, { cancelAnimation, Easing, interpolate, useAnimatedStyle, useReducedMotion, useSharedValue, withDelay, withRepeat, withTiming } from 'react-native-reanimated';
-
-/** 하늘에서 떨어진 뒤 둥둥 (웹 b-fall: b-drop 1.05초 뒤 b-float 무한). d·f 는 밀리초 */
-export function Fall({ d, f, amp = 9, style, children }: { d: number; f: number; amp?: number; style?: ViewStyle; children: ReactNode }) {
- const reduce = useReducedMotion();
- const drop = useSharedValue(reduce ? 1 : 0);
- const float = useSharedValue(0);
- useEffect(() => {
- if (reduce) return;
- drop.value = withDelay(d, withTiming(1, { duration: 1050, easing: Easing.bezier(0.22, 0.9, 0.3, 1) }));
- float.value = withDelay(d + 1050, withRepeat(withTiming(1, { duration: f / 2, easing: Easing.inOut(Easing.ease) }), -1, true));
- return () => {
- cancelAnimation(drop);
- cancelAnimation(float);
- };
- }, [reduce, d, f, drop, float]);
- const anim = useAnimatedStyle(() => {
- const p = drop.value;
- const y = interpolate(p, [0, 0.72, 0.86, 1], [-400, 0, -10, 0]) - amp * float.value;
- const rot = interpolate(p, [0, 0.72, 1], [-10, 2, 0]) + 1.2 * float.value;
- return {
- opacity: interpolate(p, [0, 0.55, 1], [0, 1, 1]),
- transform: [{ translateY: y }, { rotate: `${rot}deg` }, { scaleX: interpolate(p, [0, 0.72, 0.86, 1], [1, 1.04, 1, 1]) }, { scaleY: interpolate(p, [0, 0.72, 0.86, 1], [1, 0.96, 1, 1]) }],
- };
- });
- return {children};
-}
diff --git a/mobile/src/components/first-load.tsx b/mobile/src/components/first-load.tsx
deleted file mode 100644
index 10743c5..0000000
--- a/mobile/src/components/first-load.tsx
+++ /dev/null
@@ -1,76 +0,0 @@
-import type { TimeKind } from '@nalssigak/shared/lib';
-import { useQueryClient } from '@tanstack/react-query';
-import { useEffect, useState } from 'react';
-import { StyleSheet, View } from 'react-native';
-import { Text } from '@/components/text';
-import Animated, { cancelAnimation, Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withRepeat, withSequence, withTiming } from 'react-native-reanimated';
-
-import { Ic } from '@/components/ui';
-import { useSky } from '@/lib/sky';
-
-// 덮개 색: 시간대별 하늘 맨 위 색을 반쯤 비치게
-const COVER: Record = {
- morning: 'rgb(255 230 207 / 0.72)',
- day: 'rgb(214 235 255 / 0.72)',
- sunset: 'rgb(255 216 194 / 0.72)',
- night: 'rgb(14 20 51 / 0.72)',
-};
-
-/** 캐릭터가 통통 뛴다 (웹 b-hop) */
-function Hop({ name }: { name: string }) {
- const reduce = useReducedMotion();
- const t = useSharedValue(0);
- useEffect(() => {
- if (reduce) return;
- const ease = Easing.bezier(0.3, 0, 0.4, 1);
- t.value = withRepeat(withSequence(withTiming(1, { duration: 405, easing: ease }), withTiming(0, { duration: 495, easing: ease })), -1);
- return () => cancelAnimation(t);
- }, [reduce, t]);
- const style = useAnimatedStyle(() => ({
- transform: [{ translateY: -22 * t.value }, { scaleX: 1.06 - 0.09 * t.value }, { scaleY: 0.94 + 0.09 * t.value }],
- transformOrigin: 'bottom',
- }));
- return (
-
-
-
- );
-}
-
-/** 처음 들어올 때만: 첫 데이터를 다 받을 때까지 하늘 위에 캐릭터와 '날씨 불러오는 중…'. 한 번 사라지면 다시 안 뜬다 */
-export function FirstLoad() {
- const queryClient = useQueryClient();
- const { kind } = useSky();
- const [done, setDone] = useState(false);
- const [gone, setGone] = useState(false);
- // 받기 시작했다가 받는 게 없어지면 끝. 느린 망에서도 10초 넘게 막지 않는다 (그 뒤는 화면 안 스켈레톤이 맡는다)
- useEffect(() => {
- let seen = false;
- const unsubscribe = queryClient.getQueryCache().subscribe(() => {
- if (queryClient.isFetching() > 0) seen = true;
- else if (seen) setDone(true);
- });
- const id = setTimeout(() => setDone(true), 10000);
- return () => {
- unsubscribe();
- clearTimeout(id);
- };
- }, [queryClient]);
- const shown = useSharedValue(1);
- useEffect(() => {
- if (!done) return;
- shown.value = withTiming(0, { duration: 400 });
- const id = setTimeout(() => setGone(true), 400);
- return () => clearTimeout(id);
- }, [done, shown]);
- const fade = useAnimatedStyle(() => ({ opacity: shown.value }));
- if (gone) return null;
- return (
-
-
-
- 날씨 불러오는 중…
-
-
- );
-}
diff --git a/mobile/src/components/foliage/foliage-card.tsx b/mobile/src/components/foliage/foliage-card.tsx
deleted file mode 100644
index 78f7aa9..0000000
--- a/mobile/src/components/foliage/foliage-card.tsx
+++ /dev/null
@@ -1,153 +0,0 @@
-import type { PostReaction } from '@nalssigak/shared/api/client/types.gen';
-import { headline, ICON_R, labelBoxes, md, nearest, placeLabels, placeProvinces, PROVINCES, rankNow, spread } from '@nalssigak/shared/lib/foliage';
-import { router } from 'expo-router';
-import { useEffect, useMemo, useState } from 'react';
-import { Pressable, View, type GestureResponderEvent, type LayoutChangeEvent } from 'react-native';
-
-import { Label, Legend, MapImage, MAP_INK, MAP_INK3, Marker, PAPER, Province, useLabelSizes } from '@/components/foliage/parts';
-import { Pager } from '@/components/post/pager';
-import { PostFrame } from '@/components/post/post-frame';
-import { Text } from '@/components/text';
-import { Ic } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useFoliage } from '@/lib/foliage';
-
-const RANK_N = 7;
-// 지도 아래 고른 명소 줄(범례 자리) 높이
-const BAR_H = 60;
-// 지도 그림은 땅이 왼쪽에 치우쳐 있어 오른쪽(빈 바다)으로 밀어 가운데에 맞춘다
-const SHIFT = 0.07;
-
-const goMap = (spot?: string) => router.push(spot ? { pathname: '/foliage', params: { spot } } : '/foliage');
-
-/**
- * 피드의 단풍 지도 카드 (웹 FoliageCard): 1장은 지금 절정인 곳만 잎으로(누르면 카드 안에 정보), 2장은 지금 가기 좋은 순위.
- * '지도 크게 보기'로 단풍 지도 화면. 단풍철이 아니면 그리지 않는다
- */
-export function FoliageCard({ post }: { post?: PostReaction | null }) {
- const { today, spots, inSeason } = useFoliage();
- const peak = useMemo(() => spots.filter((m) => m.stage === 'peak').sort((a, b) => Number(a.kind === 'ginkgo') - Number(b.kind === 'ginkgo') || a.y - b.y), [spots]);
- const [size, measure] = useLabelSizes();
- const [W, setW] = useState(0);
- const [picked, setPicked] = useState(null);
- const [index, setIndex] = useState(0);
-
- const pts = useMemo(() => spread(peak.map((m) => ({ m, x: m.x * W, y: m.y * W, r: ICON_R }))), [peak, W]);
- const labelAt = useMemo(() => placeLabels(pts, pts, size, { l: 0, t: 0, r: W, b: W }, [], () => true), [pts, size, W]);
- const provs = useMemo(() => placeProvinces(PROVINCES.map((v) => ({ name: v.name, x: v.x * W, y: v.y * W })), pts, labelBoxes(labelAt, size)), [pts, W, labelAt, size]);
-
- useEffect(() => {
- if (picked) track('foliage_spot', { spot_name: picked, from: 'card' });
- }, [picked]);
-
- if (!inSeason) return null;
- const toggle = (name: string) => setPicked(name === picked ? null : name);
- // 잎이 작아 손가락으로 겨냥하기 어려우니 누른 자리에서 가까운 명소를 고른다
- const tapMap = (e: GestureResponderEvent) => {
- const best = nearest(pts, e.nativeEvent.locationX, e.nativeEvent.locationY);
- setPicked(best && best !== picked ? best : null);
- };
- const onLayout = (e: LayoutChangeEvent) => setW(e.nativeEvent.layout.width);
- const sel = peak.find((m) => m.name === picked);
- // 2번째 장: 지금 절정인 곳을 절정 예상일이 오늘과 가까운 순서로
- const ranked = rankNow(spots).slice(0, RANK_N);
- const caption = peak.length ? `지금 절정 ${peak.length}곳: ${peak.slice(0, 5).map((m) => m.name).join(' · ')}${peak.length > 5 ? ' 외' : ''}` : undefined;
- const pageH = W + 8 + BAR_H;
-
- const mapPage = (
-
-
-
- {provs.map((v) => (
-
- ))}
- {pts.map((p) => (
-
- ))}
- {peak.map((m) => (
-
- {/* 고른 명소 정보는 지도 밖, 범례 자리에: 지도 위 잎을 가리지 않게 */}
- {sel ? (
-
-
-
-
- {sel.name}
-
-
- {`${sel.region.split(' ')[0]} · 절정 예상 ${md(sel.peak)}`}
-
-
- goMap(sel.name)} accessibilityRole="link" className="rounded-full px-3 py-1.5" style={{ backgroundColor: MAP_INK }}>
- 지도에서 보기 ›
-
-
- ) : (
-
-
-
- )}
-
- );
-
- const rankPage = (
-
-
- 지금 가기 좋은 곳
-
-
- 절정 예상일이 오늘과 가까운 순서예요
-
-
- {ranked.map((m, i) => (
- goMap(m.name)} accessibilityRole="link" accessibilityLabel={`${i + 1}위 ${m.name}, 절정 예상 ${md(m.peak)}`} className="flex-row items-center gap-2.5 py-1.5">
-
- {String(i + 1)}
-
-
-
-
- {m.name}
-
-
- {m.region}
-
-
-
- {md(m.peak)}
-
-
- ))}
-
-
- );
-
- return (
-
- {/* 밤에도 지도 카드는 밝은 종이 그대로 (웹 b-keep-bg) */}
-
- {`단풍 지도 · ${md(today)}`}
-
- {headline(spots)}
-
-
- {W > 0 ? (
-
- {[mapPage, rankPage]}
-
- ) : null}
-
- {`${index + 1}/2`}
-
-
- goMap()} accessibilityRole="link" className="mt-2 w-full items-center rounded-full bg-white py-2" style={{ boxShadow: 'inset 0 -3px 0 rgba(40,48,74,0.08)' }}>
-
- 지도 크게 보기 ›
-
-
-
-
- );
-}
diff --git a/mobile/src/components/foliage/foliage-map.tsx b/mobile/src/components/foliage/foliage-map.tsx
deleted file mode 100644
index fe6a254..0000000
--- a/mobile/src/components/foliage/foliage-map.tsx
+++ /dev/null
@@ -1,272 +0,0 @@
-import { ICON_R, LAND_CX, labelBoxes, nearest, placeLabels, placeProvinces, PROVINCES, spread, type Box, type Spot, type Stage } from '@nalssigak/shared/lib/foliage';
-import { useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, type Ref } from 'react';
-import { Pressable, View, type GestureResponderEvent, type LayoutChangeEvent } from 'react-native';
-
-import { Label, MapImage, Marker, MAP_INK, PAPER, Province, useLabelSizes } from '@/components/foliage/parts';
-import { Text } from '@/components/text';
-
-type Cam = { s: number; tx: number; ty: number };
-
-const DOT_R: Record = { peak: ICON_R, first: 4, before: 3, gone: 3 };
-const MAX_ZOOM = 5;
-const FIT_TOP = 30;
-const FIT_BOTTOM = 14;
-// 이름 우선순위(절정 단풍 > 절정 은행 > 첫 단풍 > 나머지)와 그 이름이 나오기 시작하는 배율(처음 화면 대비)
-const pri = (m: Spot) => (m.stage === 'peak' ? (m.kind === 'maple' ? 0 : 1) : m.stage === 'first' ? 2 : 3);
-const LABEL_FROM = [1, 1.6, 2.5, 3.5];
-// 점이 나오기 시작하는 배율: 처음엔 절정 잎만 보여 차분하게
-const DOT_FROM: Record = { peak: 1, first: 1.6, before: 2.5, gone: 2.5 };
-const ZOOM_BTNS = [
- ['+', '확대', 1.6],
- ['−', '축소', 1 / 1.6],
-] as const;
-
-export type FoliageMapHandle = { focus: (m: Spot) => void };
-
-type Props = { spots: Spot[]; sel: string | null; onSelect: (name: string | null) => void; height: number; ref?: Ref };
-
-/**
- * 단풍 지도 페이지의 지도: 두 손가락으로 확대·이동, 한 손가락으로 이동, 누르면 가까운 명소 고르기, 두 번 누르면 확대 (웹 FoliagePage 지도).
- * 앱은 지도를 스크롤 밖에 고정해 손짓이 페이지 스크롤과 다투지 않는다
- */
-export function FoliageMap({ spots, sel, onSelect, height, ref }: Props) {
- const vpRef = useRef(null);
- const origin = useRef({ x: 0, y: 0 });
- const [box, setBox] = useState({ W: 0, H: 0 });
- const [view, setView] = useState({ s: 1, tx: 0, ty: 0 });
- const viewRef = useRef(view);
- useLayoutEffect(() => {
- viewRef.current = view;
- }, [view]);
- const [size, measure] = useLabelSizes();
-
- // 처음 화면: 명소가 다 들어오는 만큼 확대해 가운데
- const fit = useMemo(() => {
- const { W, H } = box;
- if (!W || !spots.length) return { s: 1, tx: 0, ty: 0 };
- const xs = spots.map((m) => m.x);
- const ys = spots.map((m) => m.y);
- const [x0, x1, y0, y1] = [Math.min(...xs), Math.max(...xs), Math.min(...ys), Math.max(...ys)];
- // 위쪽은 맨 북쪽 이름표가 잘리지 않게 FIT_TOP 만큼 띄우고, 아래는 제주까지만
- const h = H - FIT_TOP - FIT_BOTTOM;
- // 가로는 땅 가운데(LAND_CX)에 맞추되 동·서 끝 명소가 다 들어오게
- const half = Math.max(LAND_CX - x0, x1 - LAND_CX) + 0.07;
- const s = Math.min(W / (2 * half * W), h / ((y1 - y0) * W));
- return { s, tx: W / 2 - LAND_CX * W * s, ty: FIT_TOP + h / 2 - ((y0 + y1) / 2) * W * s };
- }, [box, spots]);
-
- const clamp = useCallback(
- (v: Cam): Cam => {
- const { W, H } = box;
- const s = Math.min(fit.s * MAX_ZOOM, Math.max(fit.s, v.s));
- const w = W * s;
- // 지도 그림 가장자리가 화면 안쪽으로 너무 들어오지 않게
- const tx = Math.min(W * 0.25, Math.max(W * 0.75 - w, v.tx));
- const ty = Math.min(H * 0.25, Math.max(H * 0.75 - w, v.ty));
- return { s, tx, ty };
- },
- [box, fit],
- );
-
- const anim = useRef(0);
- const set = useCallback((v: Cam) => {
- cancelAnimationFrame(anim.current);
- setView(v);
- }, []);
- const animateTo = useCallback(
- (to: Cam) => {
- cancelAnimationFrame(anim.current);
- const from = viewRef.current;
- const target = clamp(to);
- const start = performance.now();
- const step = (now: number) => {
- const k = Math.min(1, (now - start) / 280);
- const e = 1 - (1 - k) ** 3;
- setView({ s: from.s + (target.s - from.s) * e, tx: from.tx + (target.tx - from.tx) * e, ty: from.ty + (target.ty - from.ty) * e });
- if (k < 1) anim.current = requestAnimationFrame(step);
- };
- anim.current = requestAnimationFrame(step);
- },
- [clamp],
- );
- const zoomAt = useCallback(
- (f: number, cx: number, cy: number, smooth = false) => {
- const v = viewRef.current;
- const s = Math.min(fit.s * MAX_ZOOM, Math.max(fit.s, v.s * f));
- const k = s / v.s;
- const next = clamp({ s, tx: cx - (cx - v.tx) * k, ty: cy - (cy - v.ty) * k });
- if (smooth) animateTo(next);
- else set(next);
- },
- [fit, clamp, animateTo, set],
- );
- const focus = useCallback(
- (m: Spot) => {
- const { W, H } = box;
- const s = Math.max(viewRef.current.s, fit.s * 2.5);
- animateTo({ s, tx: W / 2 - m.x * W * s, ty: H * 0.42 - m.y * W * s });
- },
- [box, fit, animateTo],
- );
- useImperativeHandle(ref, () => ({ focus }), [focus]);
-
- // 크기가 정해지면 처음 화면으로, 링크로 고른 명소가 있으면 그곳으로. 그 뒤 크기가 바뀌면 지금 화면을 범위 안으로
- const started = useRef(false);
- const linked = useRef(sel);
- useEffect(() => {
- if (!box.W) return;
- if (started.current) {
- set(clamp(viewRef.current));
- return;
- }
- started.current = true;
- set(fit);
- const m = spots.find((s) => s.name === linked.current);
- if (m) focus(m);
- }, [box, fit, spots, set, clamp, focus]);
- useEffect(() => () => cancelAnimationFrame(anim.current), []);
-
- const pts = useMemo(() => {
- const ratio = view.s / fit.s;
- const visible = spots.filter((m) => m.name === sel || ratio >= DOT_FROM[m.stage] - 0.01);
- return spread(visible.map((m) => ({ m, x: view.tx + m.x * box.W * view.s, y: view.ty + m.y * box.W * view.s, r: DOT_R[m.stage] })));
- }, [spots, view, box.W, fit.s, sel]);
- const ptsRef = useRef(pts);
- useLayoutEffect(() => {
- ptsRef.current = pts;
- }, [pts]);
-
- const labelAt = useMemo(() => {
- const ratio = view.s / fit.s;
- const order = pts.filter((p) => p.m.name === sel || ratio >= LABEL_FROM[pri(p.m)]).sort((a, b) => Number(b.m.name === sel) - Number(a.m.name === sel) || pri(a.m) - pri(b.m));
- // 오른쪽 위 +/− 단추 자리는 비운다
- const blocked: Box[] = [{ l: box.W - 52, t: 0, r: box.W, b: 100 }];
- return placeLabels(order, pts, size, { l: 4, t: 4, r: box.W - 4, b: box.H - 4 }, blocked, (p) => p.m.stage === 'peak' || p.m.name === sel);
- }, [pts, size, sel, view.s, fit.s, box]);
- const provs = useMemo(
- () => placeProvinces(PROVINCES.map((v) => ({ name: v.name, x: view.tx + v.x * box.W * view.s, y: view.ty + v.y * box.W * view.s })), pts, labelBoxes(labelAt, size)),
- [view, box.W, pts, labelAt, size],
- );
-
- // 손짓 상태: 두 손가락 거리·가운데, 한 손가락 시작점과 움직였는지, 마지막으로 누른 때(두 번 누르기)
- const gesture = useRef<{ pinch: { d: number; x: number; y: number } | null; one: { x: number; y: number; moved: boolean } | null; lastTap: number }>({ pinch: null, one: null, lastTap: 0 });
- const local = (t: { pageX: number; pageY: number }) => ({ x: t.pageX - origin.current.x, y: t.pageY - origin.current.y });
- const pickAt = (x: number, y: number) => {
- const best = nearest(ptsRef.current, x, y);
- onSelect(best && best !== sel ? best : null);
- };
- const begin = (e: GestureResponderEvent) => {
- const g = gesture.current;
- const ts = e.nativeEvent.touches;
- if (ts.length >= 2) {
- const [a, b] = [local(ts[0]), local(ts[1])];
- g.pinch = { d: Math.hypot(a.x - b.x, a.y - b.y), x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };
- g.one = null;
- } else if (ts.length === 1) {
- g.pinch = null;
- g.one = { ...local(ts[0]), moved: false };
- }
- };
- const onGrant = (e: GestureResponderEvent) => {
- cancelAnimationFrame(anim.current);
- // 지도 칸의 화면 위치: 손가락 좌표(pageX)를 지도 안 좌표로 바꾸는 데 쓴다
- vpRef.current?.measure((_x, _y, _w, _h, px, py) => {
- origin.current = { x: px, y: py };
- });
- begin(e);
- };
- const onMove = (e: GestureResponderEvent) => {
- const g = gesture.current;
- const ts = e.nativeEvent.touches;
- if (ts.length >= 2) {
- if (!g.pinch) return begin(e);
- const [a, b] = [local(ts[0]), local(ts[1])];
- const d = Math.hypot(a.x - b.x, a.y - b.y);
- const x = (a.x + b.x) / 2;
- const y = (a.y + b.y) / 2;
- const v = viewRef.current;
- const s = Math.min(fit.s * MAX_ZOOM, Math.max(fit.s, (v.s * d) / g.pinch.d));
- const k = s / v.s;
- set(clamp({ s, tx: x - (g.pinch.x - v.tx) * k, ty: y - (g.pinch.y - v.ty) * k }));
- g.pinch = { d, x, y };
- return;
- }
- // 두 손가락에서 한 손가락이 떨어지면 남은 손가락으로 이어서 이동 (누르기로는 안 친다)
- if (!g.one || g.pinch) {
- if (ts.length === 1) g.one = { ...local(ts[0]), moved: true };
- g.pinch = null;
- return;
- }
- const p = local(ts[0]);
- if (Math.hypot(p.x - g.one.x, p.y - g.one.y) > 6) g.one.moved = true;
- if (!g.one.moved) return;
- const v = viewRef.current;
- set(clamp({ s: v.s, tx: v.tx + p.x - g.one.x, ty: v.ty + p.y - g.one.y }));
- g.one = { ...p, moved: true };
- };
- const onRelease = (e: GestureResponderEvent) => {
- const g = gesture.current;
- const tap = g.one && !g.one.moved ? g.one : null;
- g.one = null;
- g.pinch = null;
- if (!tap) return;
- // 두 번 누르기: 300ms 안에 또 누르면 확대
- if (e.nativeEvent.timestamp - g.lastTap < 300) {
- g.lastTap = 0;
- zoomAt(2, tap.x, tap.y, true);
- } else {
- g.lastTap = e.nativeEvent.timestamp;
- pickAt(tap.x, tap.y);
- }
- };
- const onEnd = () => {
- gesture.current.one = null;
- gesture.current.pinch = null;
- };
-
- const onLayout = (e: LayoutChangeEvent) => {
- const { width, height: h } = e.nativeEvent.layout;
- setBox({ W: width, H: h });
- vpRef.current?.measure((_x, _y, _w, _h, px, py) => {
- origin.current = { x: px, y: py };
- });
- };
- const markers = [...pts].sort((a, b) => Number(a.m.stage === 'peak') - Number(b.m.stage === 'peak'));
-
- return (
- true}
- onMoveShouldSetResponder={() => true}
- onResponderTerminationRequest={() => false}
- onResponderGrant={onGrant}
- onResponderMove={onMove}
- onResponderRelease={onRelease}
- onResponderTerminate={onEnd}
- className="overflow-hidden"
- style={{ height, backgroundColor: PAPER }}
- accessibilityLabel="단풍 지도"
- >
- {box.W > 0 ? : null}
- {provs.map((v) => (
-
- ))}
- {markers.map((p) => (
-
- ))}
- {spots.map((m) => (
-
- );
-}
diff --git a/mobile/src/components/foliage/parts.tsx b/mobile/src/components/foliage/parts.tsx
deleted file mode 100644
index 8aade0d..0000000
--- a/mobile/src/components/foliage/parts.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import type { Kind, LabelSize, Pt, Spot, Stage } from '@nalssigak/shared/lib/foliage';
-import { Image } from 'expo-image';
-import { useCallback, useRef, useState, type ReactNode } from 'react';
-import { Platform, Pressable, View, type LayoutChangeEvent, type StyleProp, type ViewStyle } from 'react-native';
-
-import { Text } from '@/components/text';
-import { Ic } from '@/components/ui';
-import { MAP_IMAGE } from '@/lib/foliage';
-
-// 지도는 밤에도 밝은 종이 그대로 (웹 b-keep-bg)
-export const PAPER = '#fff6ea';
-export const MAP_INK = '#28304a';
-export const MAP_INK3 = '#6b7189';
-const LABEL_INK: Record = { maple: '#b5321f', ginkgo: '#8a6508' };
-
-/**
- * 지도 그림. 웹은 채도를 빼서(saturate .3) 잎 아이콘이 묻히지 않게 한다.
- * 안드로이드는 같은 filter, iOS 는 filter 의 채도를 못 써서 종이색을 반쯤 덮어 옅게 한다
- */
-export function MapImage({ style }: { style: StyleProp }) {
- const android = Platform.OS === 'android';
- return (
-
-
- {!android && }
-
- );
-}
-
-const DOT: Record, { size: number; color: string }> = {
- first: { size: 7, color: 'rgba(217,119,46,0.85)' },
- before: { size: 5, color: 'rgba(143,138,128,0.6)' },
- gone: { size: 5, color: 'rgba(143,138,128,0.6)' },
-};
-
-/** 단계 표시: 절정은 잎, 첫 단풍은 주황 점, 단풍 전·지남은 회색 점(big 이면 점을 크게) */
-export function StageMark({ m, big }: { m: Spot; big?: boolean }) {
- if (m.stage === 'peak') return ;
- const dot = DOT[m.stage];
- const size = big ? 14 : dot.size;
- return ;
-}
-
-/** 지도 위 점·잎. 고른 명소는 속이 빈 고리만 둘러 옆 명소를 가리지 않게 */
-export function Marker({ p, sel }: { p: Pt; sel: boolean }) {
- return (
-
- {sel ? : null}
-
-
- );
-}
-
-/** 시·도 이름: 지도에 옅게 깔리는 글자. 산 무늬 위에서도 읽히게 종이색 번짐을 두른다 */
-export function Province({ name, x, y }: { name: string; x: number; y: number }) {
- return (
-
-
- {name}
-
-
- );
-}
-
-/**
- * 명소 이름표. 자리를 못 받았으면(at 없음) 숨긴 채 왼쪽 위에 두고 크기만 잰다 (웹 useLabelSize 대신 onLayout).
- * tone: 고름(진한 바탕) · 절정(잎 색 글자) · 그 밖(회색 글자)
- */
-export function Label({ m, at, sel, onPress, onLayout, accessibilityLabel }: { m: Spot; at?: { left: number; top: number }; sel?: boolean; onPress: () => void; onLayout: (e: LayoutChangeEvent) => void; accessibilityLabel: string }) {
- const color = sel ? '#ffffff' : m.stage === 'peak' ? LABEL_INK[m.kind] : '#5b6075';
- return (
-
-
- {m.name}
-
-
- );
-}
-
-/** 이름표 크기 모으기: Label 의 onLayout 을 받아 이름별 폭·높이. 한 프레임에 한 번만 다시 그린다 */
-export function useLabelSizes() {
- const [size, setSize] = useState({});
- const acc = useRef({});
- const frame = useRef(0);
- const measure = useCallback(
- (name: string) => (e: LayoutChangeEvent) => {
- const { width: w, height: h } = e.nativeEvent.layout;
- const old = acc.current[name];
- if (old && Math.abs(old.w - w) < 0.5 && Math.abs(old.h - h) < 0.5) return;
- acc.current = { ...acc.current, [name]: { w, h } };
- cancelAnimationFrame(frame.current);
- frame.current = requestAnimationFrame(() => setSize(acc.current));
- },
- [],
- );
- return [size, measure] as const;
-}
-
-/** 범례: 절정 잎 둘, full 이면 첫 단풍·단풍 전 점까지 */
-export function Legend({ full, color }: { full?: boolean; color: string }) {
- const item = (mark: ReactNode, label: string) => (
-
- {mark}
-
- {label}
-
-
- );
- return (
-
- {item(, '단풍 절정')}
- {item(, '은행 절정')}
- {full ? item(, '첫 단풍') : null}
- {full ? item(, '단풍 전') : null}
-
- );
-}
diff --git a/mobile/src/components/foliage/spot-list.tsx b/mobile/src/components/foliage/spot-list.tsx
deleted file mode 100644
index 908eb08..0000000
--- a/mobile/src/components/foliage/spot-list.tsx
+++ /dev/null
@@ -1,93 +0,0 @@
-import { md, STAGE, type Spot, type Stage } from '@nalssigak/shared/lib/foliage';
-import { Pressable, View } from 'react-native';
-
-import { Legend, StageMark } from '@/components/foliage/parts';
-import { Text } from '@/components/text';
-
-const GROUPS: [Stage, string][] = [
- ['peak', '지금 절정'],
- ['first', '곧 절정'],
- ['before', '아직'],
- ['gone', '절정 지남'],
-];
-
-const CHIP: Partial> = {
- peak: { bg: '#ffe3db', ink: '#b5321f' },
- first: { bg: '#ffe8d2', ink: '#a34f12' },
-};
-
-/** 지도 아래 한 줄: 고른 명소가 있으면 그 명소 정보, 없으면 범례 (지도 위를 가리지 않게 범례 자리에) */
-export function ChosenBar({ chosen, legendColor }: { chosen?: Spot; legendColor: string }) {
- if (!chosen)
- return (
-
-
-
- );
- const chip = CHIP[chosen.stage];
- return (
-
-
-
-
-
-
-
- {chosen.name}
-
-
- {STAGE[chosen.stage]}
-
-
-
- {`${chosen.region} · 절정 예상 ${md(chosen.peak)}`}
-
-
-
- );
-}
-
-/** 단계별 명소 목록 (지금 절정 · 곧 절정 · 아직 · 절정 지남). 누르면 지도에서 그 명소로 */
-export function SpotList({ spots, sel, onPick }: { spots: Spot[]; sel: string | null; onPick: (m: Spot) => void }) {
- return (
-
- {GROUPS.map(([g, title]) => {
- const rows = spots.filter((m) => m.stage === g).sort((a, b) => a.peak.localeCompare(b.peak));
- if (!rows.length) return null;
- return (
-
-
- {title}
- {`${rows.length}곳`}
-
-
- {rows.map((m) => (
- onPick(m)}
- accessibilityRole="button"
- accessibilityState={{ selected: m.name === sel }}
- className="flex-row items-center gap-3 border-b border-line py-2.5 pl-1"
- style={m.name === sel ? { backgroundColor: 'rgba(255,122,69,0.08)' } : undefined}
- >
-
-
-
-
-
- {m.name}
-
-
- {`${m.region} · ${m.own ? '절정 예상' : '가까운 지점 날짜'}`}
-
-
- {md(m.peak)}
-
- ))}
-
-
- );
- })}
-
- );
-}
diff --git a/mobile/src/components/gak/grid.tsx b/mobile/src/components/gak/grid.tsx
deleted file mode 100644
index 1b87829..0000000
--- a/mobile/src/components/gak/grid.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-import type { IndexSummary } from '@nalssigak/shared/api/client/types.gen';
-import { Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-
-import { Ic, Skel } from '@/components/ui';
-import { useSheet } from '@/lib/sheet';
-
-const CELL = 'w-[32%] items-center rounded-[22px] border-b-[5px] border-shade bg-card px-1.5 pt-3 pb-2.5';
-const SKELS = Array.from({ length: 9 }, (_, i) => i);
-
-export function GridSkel() {
- return (
-
- {SKELS.map((i) => (
-
-
-
-
-
- ))}
-
- );
-}
-
-/** 3칸 바둑판. 지금 시간대가 아니거나 제철이 아닌 각은 흐리게 */
-export function GakGrid({ items, dim }: { items: IndexSummary[]; dim: boolean }) {
- const { open } = useSheet();
- return (
-
- {items.map((g) => (
- open({ type: 'gak', indexId: g.index_id })}
- accessibilityLabel={g.active ? `${g.rank}위 ${g.name} ${g.score}점` : `${g.name}, ${g.in_season === false ? '제철 아님' : '지금 시간대 아님'}`}
- className={`${CELL} ${g.active ? '' : 'opacity-55'}`}
- >
- {g.active && {g.rank}}
- {!!g.season && {g.season}}
-
-
- {g.name}
-
- {g.active ? (
- {g.score}
- ) : (
- {g.in_season === false ? '제철 아님' : '지금 아님'}
- )}
-
- ))}
-
- );
-}
diff --git a/mobile/src/components/gak/podium.tsx b/mobile/src/components/gak/podium.tsx
deleted file mode 100644
index 82fbb45..0000000
--- a/mobile/src/components/gak/podium.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import type { IndexSummary } from '@nalssigak/shared/api/client/types.gen';
-import { MEDALS } from '@nalssigak/shared/lib';
-import { LinearGradient } from 'expo-linear-gradient';
-import { Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-
-import { Ic, Skel } from '@/components/ui';
-import { useSheet } from '@/lib/sheet';
-import { useSky } from '@/lib/sky';
-
-// 가운데가 높은 3칸: 2위 · 1위 · 3위
-const ORDER = [1, 0, 2] as const;
-const FLEX = [1.15, 1, 1];
-
-/** 1~3위 받침대와 같은 칸의 스켈레톤 */
-export function PodiumSkel() {
- return (
-
- {ORDER.map((k) => (
-
-
-
-
-
-
- ))}
-
- );
-}
-
-export function Podium({ top, dim }: { top: IndexSummary[]; dim: boolean }) {
- const { open } = useSheet();
- const { kind } = useSky();
- return (
-
- {ORDER.map((k) => {
- const g = top[k];
- return (
- open({ type: 'gak', indexId: g.index_id })} className={`items-center overflow-hidden rounded-3xl border-b-[6px] border-shade bg-card px-1.5 ${k === 0 ? 'py-4' : 'mt-6 py-3'}`}>
- {k === 0 && kind !== 'night' && }
-
-
-
-
-
-
- {k + 1}위 {g.name}
-
-
- {g.score}
- {!!g.summary && {g.summary}}
-
- );
- })}
-
- );
-}
diff --git a/mobile/src/components/moon.tsx b/mobile/src/components/moon.tsx
deleted file mode 100644
index 439e4b6..0000000
--- a/mobile/src/components/moon.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-import { moonPath } from '@nalssigak/shared/lib/today';
-import { useId } from 'react';
-import Svg, { Circle, ClipPath, Defs, Ellipse, FeGaussianBlur, Filter, G, Path, RadialGradient, Stop } from 'react-native-svg';
-
-// 앞면 바다(어두운 무늬) 자리: [x, y, 가로 반지름, 세로 반지름]. 실제 달 앞면 배치를 대강 따른다 (웹 frontend/src/b/moon.tsx 와 같다)
-const MARIA: [number, number, number, number][] = [
- [-0.32, -0.36, 0.3, 0.26],
- [0.12, -0.36, 0.17, 0.15],
- [0.3, -0.06, 0.2, 0.17],
- [-0.56, 0.06, 0.26, 0.42],
- [0.66, -0.26, 0.1, 0.12],
- [0.52, 0.22, 0.13, 0.15],
- [-0.14, 0.44, 0.18, 0.13],
- [-0.46, 0.5, 0.1, 0.09],
-];
-// 작은 크레이터: [x, y, 반지름]
-const CRATERS: [number, number, number][] = [
- [0.1, 0.72, 0.07],
- [0.42, 0.52, 0.05],
- [-0.66, -0.5, 0.05],
- [0.62, 0.52, 0.04],
- [-0.2, 0.08, 0.04],
-];
-// 저녁(노을)엔 노을빛이 도는 달, 밤엔 하얀 달
-const TONES = {
- night: { body: ['#fffcf2', '#f6ebcb', '#e0cc98'], shade: '#1a2050' },
- dusk: { body: ['#fff8ee', '#ffe2cc', '#f2b9a2'], shade: '#4a2a63' },
-};
-
-/** 오늘 밤 실제 모양대로 그린 달. pct 는 빛나는 면의 비율 0~100, 기우는 달은 왼쪽이 밝다. 빛 번짐까지 그려서 달 지름은 size 의 2/3 */
-export function MoonArt({ pct, waxing, tone = 'night', size }: { pct: number; waxing: boolean; tone?: keyof typeof TONES; size: number }) {
- const id = useId().replace(/[^a-zA-Z0-9]/g, '');
- const t = TONES[tone];
- const k = pct / 100;
- const full = pct >= 99;
- const hidden = pct <= 1;
- return (
-
- );
-}
diff --git a/mobile/src/components/my-gak/my-gak.tsx b/mobile/src/components/my-gak/my-gak.tsx
deleted file mode 100644
index 3ba4603..0000000
--- a/mobile/src/components/my-gak/my-gak.tsx
+++ /dev/null
@@ -1,362 +0,0 @@
-import type { MyGakPreset, MyGakRule, MyGakScore } from '@nalssigak/shared/api/client/types.gen';
-import { LinearGradient } from 'expo-linear-gradient';
-import { useRef, useState, type ReactNode } from 'react';
-import { Pressable, ScrollView, TextInput, View } from 'react-native';
-
-import { Body, useSoft } from '@/components/sheets/parts';
-import { Text } from '@/components/text';
-import { Ic, Rail, Sec } from '@/components/ui';
-import { gakName, MY_GAK_ICON, shareUrl, SLOT_WORD, SLOTS, type MyGak, type Slot, useMyGak, useMyGakScores, usePresets } from '@/lib/my-gak';
-import { useRegion } from '@/lib/region';
-import { useShare } from '@/lib/share-image';
-import { useSheet } from '@/lib/sheet';
-
-function Score({ s, big }: { s?: MyGakScore; big?: boolean }) {
- const v = s?.score;
- return {v ?? '–'};
-}
-
-function Reasons({ s }: { s?: MyGakScore }) {
- if (!s?.slot) return 예보를 불러오는 중이에요;
- return (
-
- {SLOT_WORD[s.slot as Slot]}
- {s.reasons?.join(' · ')}
-
- );
-}
-
-// 조건 이름. 점수 응답의 factors 와 reasons 는 같은 순서다
-const AXIS_NAME: Record = { temp: '기온', rain: '비', wind: '바람', air: '미세먼지', humidity: '습도' };
-// 조건 점수가 이보다 낮으면 '아쉬운 조건'으로 카드에 칩을 단다
-const SHORT = 70;
-
-/** 조건마다 이름·점수·실제 값 (실제 값은 근거 문구의 첫 마디: 체감 15°) */
-function conditions(s?: MyGakScore) {
- const notes = s?.reasons ?? [];
- return Object.entries(s?.factors ?? {}).map(([axis, value], i) => ({ axis, label: AXIS_NAME[axis] ?? axis, value, note: notes[i] ?? '', short: (notes[i] ?? '').split(', ')[0] }));
-}
-
-/** 오늘 탭의 내 각 줄: 카드엔 아이콘·이름·점수·아쉬운 조건만, 누르면 상세 창 */
-export function MyGakRow() {
- const { open } = useSheet();
- const { items } = useMyGak();
- const scores = useMyGakScores(items.map((g) => g.rule)).data?.scores ?? [];
- return (
- <>
-
-
- {items.map((g, i) => {
- const s = scores[i];
- const miss = conditions(s)
- .filter((c) => c.value < SHORT)
- .slice(0, 2);
- return (
- open({ type: 'myGak', gak: g })} accessibilityLabel={`${g.name} ${s?.score ?? ''}점 자세히`} className="w-[200px] gap-2 rounded-[22px] border-b-[5px] border-shade bg-card p-3">
-
-
-
-
-
- {g.name}
- {s?.slot ? `${SLOT_WORD[s.slot as Slot]} 기준` : '예보를 불러오는 중이에요'}
-
- {!!s?.slot && (
-
- {miss.length ? (
- miss.map((c) => (
-
- {c.short}
-
- ))
- ) : (
- 조건 다 맞아요
- )}
-
- )}
-
- );
- })}
- open({ type: 'mix' })} accessibilityRole="button" className="w-[120px] items-center justify-center gap-1 rounded-[22px] border-2 border-dashed border-line p-3">
- +
- 내 각 만들기
-
-
- >
- );
-}
-
-/** 내 각 상세: 시간대별 점수, 조건별 점수와 실제 값, 공유하기·지우기 */
-export function MyGakSheet({ gak, onDone }: { gak: MyGak; onDone: () => void }) {
- const { remove } = useMyGak();
- const s = useMyGakScores([gak.rule]).data?.scores?.[0];
- const soft = useSoft();
- const shareView = useShare();
- const shot = useRef(null);
- const [confirm, setConfirm] = useState(false);
- const rows = conditions(s);
- // 받은 사람이 자기 동네 점수로 볼 수 있게 링크를 같이 보낸다
- const share = () => void shareView(shot, { title: gak.name, message: `${gak.name} ${s?.score ?? ''}점 · 내 동네 점수 보기 ${shareUrl(gak)}` });
- return (
-
-
-
-
-
- {gak.name}
- {s?.slot ? `${SLOT_WORD[s.slot as Slot]} 기준 점수` : '예보를 불러오는 중이에요'}
-
-
-
-
- {SLOTS.map(([k, word]) => {
- const v = s?.slots?.[k];
- return (
-
- {word}
- {v ?? '–'}
-
- );
- })}
-
-
- {rows.map((c) => (
-
-
- {c.label}
-
-
-
- {c.value}
-
- {c.note}
-
- ))}
-
-
-
-
- 공유하기
-
- {confirm ? (
- <>
- {
- remove(gak);
- onDone();
- }}
- className="rounded-2xl bg-[#fdecec] px-4 py-3"
- >
- 지우기
-
- setConfirm(false)} className="rounded-2xl bg-[#eef4fc] px-4 py-3">
- 취소
-
- >
- ) : (
- setConfirm(true)} className="rounded-2xl bg-[#eef4fc] px-4 py-3">
- 지우기
-
- )}
-
- {confirm && 지울까요?}
-
- );
-}
-
-function Row({ label, on, onToggle, disabled, children }: { label: string; on: boolean; onToggle: () => void; disabled?: boolean; children: ReactNode }) {
- return (
-
-
- {on && ✓}
- {label}
-
- {on ? {children} : 상관없음}
-
- );
-}
-
-/** 숫자: 휴대폰 숫자 자판엔 '-'가 없을 때가 있어 −/+ 버튼으로 바꾼다 */
-function Num({ value, onChange, min, max, step = 1, label, disabled }: { value: number; onChange: (v: number) => void; min: number; max: number; step?: number; label: string; disabled?: boolean }) {
- const soft = useSoft();
- const set = (v: number) => onChange(Math.min(max, Math.max(min, v)));
- return (
-
- set(value - step)} disabled={disabled || value <= min} hitSlop={4} accessibilityLabel={`${label} 내리기`} className="px-2 py-1.5 disabled:opacity-30">
- −
-
- {value}
- set(value + step)} disabled={disabled || value >= max} hitSlop={4} accessibilityLabel={`${label} 올리기`} className="px-2 py-1.5 disabled:opacity-30">
- +
-
-
- );
-}
-
-function Choice({ value, options, onChange, label, disabled }: { value: T; options: [T, string][]; onChange: (v: T) => void; label: string; disabled?: boolean }) {
- return (
-
- {options.map(([k, word]) => (
- onChange(k)} disabled={disabled} accessibilityRole="radio" accessibilityState={{ checked: value === k }} className={`rounded-full px-3 py-1.5 ${value === k ? 'bg-orange' : 'bg-[#eef4fc]'}`}>
- {word}
-
- ))}
-
- );
-}
-
-type Filled = { [K in keyof T]-?: NonNullable };
-const DEFAULT_RULE: Filled = { temp: [15, 25], rain: 'dry', wind_max: 4, air: 'normal', humidity: [30, 60], slots: ['morning', 'day', 'evening', 'night'] };
-type Cond = 'temp' | 'rain' | 'wind_max' | 'air' | 'humidity';
-
-const condsOf = (r: MyGakRule): Record => ({ temp: !!r.temp, rain: !!r.rain, wind_max: r.wind_max != null, air: !!r.air, humidity: !!r.humidity });
-
-/** 내 각 아이콘 고르기: 있는 각 아이콘 그대로 */
-function IconPicker({ value, onPick }: { value: string; onPick: (icon: string) => void }) {
- const soft = useSoft();
- const icons = [...new Set([MY_GAK_ICON, ...(usePresets().data ?? []).map((p) => p.icon)])];
- return (
-
- 아이콘
-
- {icons.map((icon) => (
- onPick(icon)} accessibilityRole="button" accessibilityState={{ selected: value === icon }} accessibilityLabel={`아이콘 ${icon}`} className={`size-12 items-center justify-center rounded-2xl ${value === icon ? 'bg-orange' : ''}`} style={value === icon ? undefined : { backgroundColor: soft.soft }}>
-
-
- ))}
-
-
- );
-}
-
-/** 있는 각을 골라 그 각 조건으로 채운다 */
-function PresetPicker({ picked, onPick }: { picked: string | null; onPick: (p: MyGakPreset) => void }) {
- const soft = useSoft();
- const items = usePresets().data ?? [];
- if (!items.length) return null;
- return (
-
- 있는 각에서 불러오기
-
- {items.map((p) => (
- onPick(p)} accessibilityRole="button" accessibilityState={{ selected: picked === p.code }} className={`w-[68px] items-center gap-1 rounded-2xl px-1 py-2 ${picked === p.code ? 'bg-orange' : ''}`} style={picked === p.code ? undefined : { backgroundColor: soft.soft }}>
-
-
- {p.name}
-
-
- ))}
-
-
- );
-}
-
-/** 내 각 만들기(이름과 조건)와 미리보기. shared 면 받은 각을 내 동네 점수로 보여 주고 가져오기만 */
-export function MixSheet({ shared, onDone }: { shared?: MyGak; onDone: () => void }) {
- const { region } = useRegion();
- const soft = useSoft();
- const { create, pending, failed } = useMyGak();
- const [name, setName] = useState(shared?.name ?? '');
- const [vals, setVals] = useState({ ...DEFAULT_RULE, ...(shared?.rule ?? {}) } as typeof DEFAULT_RULE);
- const [on, setOn] = useState>(shared ? condsOf(shared.rule) : { temp: true, rain: true, wind_max: false, air: false, humidity: false });
- const [picked, setPicked] = useState(null);
- const [icon, setIcon] = useState(shared?.icon ?? MY_GAK_ICON);
- const lock = !!shared;
- const pick = (p: MyGakPreset) => {
- setPicked(p.code);
- setName(p.name);
- setIcon(p.icon);
- setVals({ ...DEFAULT_RULE, ...p.rule } as typeof DEFAULT_RULE);
- setOn(condsOf(p.rule));
- };
- const set = (k: K, v: (typeof vals)[K]) => setVals((x) => ({ ...x, [k]: v }));
- const toggle = (k: Cond) => setOn((x) => ({ ...x, [k]: !x[k] }));
- const rule: MyGakRule = { slots: vals.slots, ...(Object.fromEntries((Object.keys(on) as Cond[]).filter((k) => on[k]).map((k) => [k, vals[k]])) as Partial) };
- const valid = Object.values(on).some(Boolean) && vals.slots.length > 0 && (!on.temp || vals.temp[0] < vals.temp[1]) && (!on.humidity || vals.humidity[0] < vals.humidity[1]);
- const score = useMyGakScores(valid ? [rule] : []).data?.scores?.[0];
- const title = gakName(name) || '이름 없는 각';
- const toggleSlot = (s: Slot) =>
- set(
- 'slots',
- vals.slots.includes(s)
- ? vals.slots.filter((x) => x !== s)
- : SLOTS.map(([k]) => k).filter((k) => k === s || vals.slots.includes(k)),
- );
-
- return (
-
- {shared ? (
- 친구가 보낸 각이에요. {region.name} 기준 점수예요
- ) : (
- <>
-
- 이름
-
-
- >
- )}
- 조건
- toggle('temp')} disabled={lock}>
- set('temp', [v, vals.temp[1]])} />
- ~
- set('temp', [vals.temp[0], v])} />
- ° 체감
-
- toggle('rain')} disabled={lock}>
- set('rain', v)}
- options={[
- ['dry', '안 와야'],
- ['wet', '와야'],
- ]}
- />
-
- toggle('wind_max')} disabled={lock}>
- 초속
- set('wind_max', v)} />
- m 이하
-
- toggle('air')} disabled={lock}>
- set('air', v)}
- options={[
- ['good', '좋음만'],
- ['normal', '보통까지'],
- ]}
- />
-
- toggle('humidity')} disabled={lock}>
- set('humidity', [v, vals.humidity[1]])} />
- ~
- set('humidity', [vals.humidity[0], v])} />
- %
-
-
- 시간대
- {SLOTS.map(([k, word]) => (
- toggleSlot(k)} disabled={lock} accessibilityRole="button" accessibilityState={{ selected: vals.slots.includes(k) }} className={`rounded-full px-3 py-1.5 ${vals.slots.includes(k) ? 'bg-orange' : 'bg-[#eef4fc]'}`}>
- {word}
-
- ))}
-
-
-
-
- {title}
-
-
- {valid ? : 조건과 시간대를 하나 이상 골라요}
-
- {failed && 저장하지 못했어요. 이름에 링크나 긴 숫자가 있으면 빼 주세요}
- create({ name, icon, rule }, onDone)} className="mt-3.5 rounded-2xl bg-orange py-3 disabled:opacity-45">
- {shared ? '내 각으로 가져오기' : '내 각으로 저장'}
-
-
- );
-}
diff --git a/mobile/src/components/post/icons.tsx b/mobile/src/components/post/icons.tsx
deleted file mode 100644
index dacc6d1..0000000
--- a/mobile/src/components/post/icons.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import Svg, { Circle, Path } from 'react-native-svg';
-
-export const HEART = 'M12 20.5s-8-4.9-8-11A4.6 4.6 0 0 1 12 6.8a4.6 4.6 0 0 1 8 2.7c0 6.1-8 11-8 11z';
-
-type P = { size: number; color: string };
-
-export function HeartIcon({ size, color, filled }: P & { filled: boolean }) {
- return (
-
- );
-}
-
-export function CommentIcon({ size, color }: P) {
- return (
-
- );
-}
-
-export function SendIcon({ size, color }: P) {
- return (
-
- );
-}
-
-export function CameraIcon({ size, color }: P) {
- return (
-
- );
-}
diff --git a/mobile/src/components/post/like-burst.tsx b/mobile/src/components/post/like-burst.tsx
deleted file mode 100644
index 894b797..0000000
--- a/mobile/src/components/post/like-burst.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { useEffect } from 'react';
-import { View } from 'react-native';
-import Animated, { Easing, interpolate, useAnimatedStyle, useReducedMotion, useSharedValue, withDelay, withTiming } from 'react-native-reanimated';
-import Svg, { Path } from 'react-native-svg';
-
-import { HEART } from '@/components/post/icons';
-
-// 튀어 나가는 작은 하트: x·y 이동, 회전, 색 (웹 BURST)
-const BURST: [number, number, number, string][] = [
- [-86, -60, -24, '#ff3b5c'],
- [84, -66, 22, '#ff8e4e'],
- [-104, 18, -40, '#ffc86e'],
- [102, 24, 36, '#ff3b5c'],
- [-48, -104, -8, '#ff8aa0'],
- [52, -100, 12, '#ffc86e'],
-];
-
-function Bit({ dx, dy, rot, color }: { dx: number; dy: number; rot: number; color: string }) {
- const p = useSharedValue(0);
- useEffect(() => {
- p.value = withDelay(80, withTiming(1, { duration: 900, easing: Easing.bezier(0.2, 0.8, 0.3, 1) }));
- }, [p]);
- const style = useAnimatedStyle(() => ({
- opacity: interpolate(p.value, [0, 0.25, 1], [0, 1, 0]),
- transform: [{ translateX: dx * p.value }, { translateY: dy * p.value }, { scale: interpolate(p.value, [0, 1], [0.4, 1.1]) }, { rotate: `${rot * p.value}deg` }],
- }));
- return (
-
-
-
- );
-}
-
-function Toast() {
- const p = useSharedValue(0);
- useEffect(() => {
- p.value = withTiming(1, { duration: 1300, easing: Easing.bezier(0.2, 0.9, 0.3, 1) });
- }, [p]);
- const style = useAnimatedStyle(() => ({
- opacity: interpolate(p.value, [0, 0.18, 0.78, 1], [0, 1, 1, 0]),
- transform: [{ translateY: interpolate(p.value, [0, 0.18, 0.78, 1], [14, 0, 0, -8]) }, { scale: interpolate(p.value, [0, 0.18, 0.3, 1], [0.85, 1.06, 1, 1]) }],
- }));
- return (
-
- 좋아요했어요!
-
- );
-}
-
-/** 좋아요 때 하트 조각이 튀어 나가고 '좋아요했어요!' 가 떴다 사라진다 */
-export function LikeBurst() {
- const reduce = useReducedMotion();
- if (reduce) return null;
- return (
-
- {BURST.map(([dx, dy, rot, color], k) => (
-
- ))}
-
-
- );
-}
diff --git a/mobile/src/components/post/pager.tsx b/mobile/src/components/post/pager.tsx
deleted file mode 100644
index a552665..0000000
--- a/mobile/src/components/post/pager.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import type { ReactNode } from 'react';
-import { ScrollView, View, type NativeScrollEvent, type NativeSyntheticEvent } from 'react-native';
-
-/** 옆으로 한 장씩 넘기는 슬라이드 (웹 Embla 캐러셀 대신 가로 paging ScrollView) */
-export function Pager({ width, height, onIndex, children }: { width: number; height: number; onIndex: (i: number) => void; children: ReactNode[] }) {
- const onEnd = (e: NativeSyntheticEvent) => onIndex(Math.round(e.nativeEvent.contentOffset.x / width));
- return (
- 1} onMomentumScrollEnd={onEnd} style={{ width, height }}>
- {children.map((c, i) => (
-
- {c}
-
- ))}
-
- );
-}
-
-/** 슬라이드 위치 점 */
-export function Dots({ n, index }: { n: number; index: number }) {
- if (n < 2) return null;
- const items = Array.from({ length: n }, (_, i) => i);
- return (
-
- {items.map((i) => (
-
- ))}
-
- );
-}
diff --git a/mobile/src/components/post/post-card.tsx b/mobile/src/components/post/post-card.tsx
deleted file mode 100644
index 5edc37f..0000000
--- a/mobile/src/components/post/post-card.tsx
+++ /dev/null
@@ -1,240 +0,0 @@
-import { likePostMutation, unlikePostMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { PostType, type PostData, type ResFeed } from '@nalssigak/shared/api/client/types.gen';
-import { useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query';
-import { LinearGradient } from 'expo-linear-gradient';
-import { useEffect, useRef, useState } from 'react';
-import { Animated, Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-import Svg, { Path } from 'react-native-svg';
-import { useCSSVariable } from 'uniwind';
-
-import { CommentIcon, HEART, HeartIcon, SendIcon } from '@/components/post/icons';
-import { LikeBurst } from '@/components/post/like-burst';
-import { Dots, Pager } from '@/components/post/pager';
-import { slideBg, SlideView, type Slide } from '@/components/post/slides';
-import { Ic, Skel } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useSheet } from '@/lib/sheet';
-import { useShare } from '@/lib/share-image';
-import { SITE_URL } from '@/lib/site';
-
-const ACCOUNTS: Partial> = {
- [PostType.WEATHER]: ['오늘 날씨', 'sun'],
- [PostType.GAK]: ['오늘의 각', 'rabbit'],
- [PostType.SUNSET]: ['노을', 'sunset'],
- [PostType.SEASON]: ['계절 소식', 'maple'],
- [PostType.EVENT]: ['가까운 행사', 'fireworks'],
- [PostType.TIP]: ['날씨 상식', 'bulb'],
- [PostType.WEEK]: ['주말 예보', 'calendar'],
- [PostType.ALERT]: ['생활 알림', 'umbrella'],
- [PostType.TOMORROW]: ['내일 미리보기', 'moon'],
- [PostType.QUOTE]: ['오늘의 한 문장', 'letter'],
- [PostType.WEEKEND_PLAN]: ['주말 플랜', 'calendar'],
- [PostType.AIR]: ['미세먼지', 'vent'],
- [PostType.DAY_TRIP]: ['당일치기', 'picnic'],
- [PostType.MOON]: ['오늘 밤 달', 'moon'],
- [PostType.UV]: ['자외선', 'glasses'],
- [PostType.CARD]: ['날씨각 카드', 'stars'],
-};
-
-/** 앱이 그릴 줄 아는 글 종류만 (히어로·띠처럼 피드 반응 칸으로만 오는 종류는 뺀다) */
-export const isAppPost = (p: PostData) => p.post_type in ACCOUNTS;
-
-type PostProps = { post: PostData };
-
-/** 받아 둔 피드 데이터에도 좋아요를 반영한다. 안 하면 다른 탭에 다녀왔을 때 예전 값으로 다시 그려진다 */
-function patchFeed(queryClient: QueryClient, postId: number, patch: Partial) {
- queryClient.setQueriesData({ predicate: (q) => (q.queryKey[0] as { _id?: string } | undefined)?._id === 'getFeed' }, (feed) =>
- feed?.posts ? { ...feed, posts: feed.posts.map((p) => (p.post_id === postId ? { ...p, ...patch } : p)) } : feed,
- );
-}
-
-/** 한 줄 카드 (흐린 날 노을처럼 큰 그림이 필요 없는 소식) */
-function LineCard({ post }: PostProps) {
- const [account, avatar] = ACCOUNTS[post.post_type] ?? ['날씨각', 'sun'];
- return (
-
-
-
- {account}
-
- {post.title} {post.caption}
-
-
-
- );
-}
-
-/** 인스타식 게시물: 옆으로 넘기는 슬라이드, 두 번 눌러 좋아요 */
-export function PostCard({ post }: PostProps) {
- return post.size === 'line' ? : ;
-}
-
-/** FullCard 와 같은 틀(머리줄·4:5 그림·버튼줄·글 한 줄)의 스켈레톤 */
-export function PostCardSkel() {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-}
-
-/** 좋아요 때 가운데에 커졌다 사라지는 하트 */
-function HeartPop() {
- const [v] = useState(() => new Animated.Value(0));
- useEffect(() => {
- Animated.timing(v, { toValue: 1, duration: 800, useNativeDriver: true }).start();
- }, [v]);
- const opacity = v.interpolate({ inputRange: [0, 0.25, 0.6, 1], outputRange: [0, 1, 1, 0] });
- const scale = v.interpolate({ inputRange: [0, 0.25, 0.6, 1], outputRange: [0.3, 1.1, 1, 1] });
- return (
-
-
-
- );
-}
-
-function FullCard({ post }: PostProps) {
- const { open } = useSheet();
- const [ink, heart] = useCSSVariable(['--color-ink', '--color-heart']).map(String);
- const liked = !!post.liked;
- const likeCount = post.like_count;
- const queryClient = useQueryClient();
- const like = useMutation(likePostMutation());
- const unlike = useMutation(unlikePostMutation());
- const [width, setWidth] = useState(0);
- const [index, setIndex] = useState(0);
- const [pop, setPop] = useState(0);
- const [likeFailed, setLikeFailed] = useState(0);
- const lastTap = useRef(0);
- const [account, avatar] = ACCOUNTS[post.post_type] ?? ['날씨각', 'sun'];
- const n = post.slides.length;
- const patch = (values: Partial) => patchFeed(queryClient, post.post_id, values);
- const comments = () => open({ type: 'comments', postId: post.post_id });
- const shot = useRef(null);
- // 지금 보고 있는 슬라이드를 이미지로
- const shareView = useShare();
- const share = () => void shareView(shot, { title: post.title, message: `${post.title} · 날씨각 ${SITE_URL}` });
-
- useEffect(() => {
- if (!likeFailed) return;
- const t = setTimeout(() => setLikeFailed(0), 2500);
- return () => clearTimeout(t);
- }, [likeFailed]);
-
- // 화면을 먼저 바꾸고, 실패하면 되돌린다 (서버는 실패도 200 + result.success=false 로 준다)
- // 좋아요는 로그인 없이 된다 (웹과 같이)
- const setLike = (on: boolean) => {
- if (on === liked || like.isPending || unlike.isPending) return;
- if (on) setPop((p) => p + 1);
- setLikeFailed(0);
- patch({ liked: on, like_count: likeCount + (on ? 1 : -1) });
- const revert = () => {
- patch({ liked, like_count: likeCount });
- setLikeFailed(Date.now());
- };
- (on ? like : unlike).mutate(
- { path: { post_id: post.post_id } },
- {
- onSuccess: (res) => {
- if (!res.result?.success) return revert();
- patch({ liked: res.liked ?? on, ...(res.like_count != null ? { like_count: res.like_count } : {}) });
- if (on) track('like', { content_type: 'post', item_id: post.post_id });
- },
- onError: revert,
- },
- );
- };
-
- const onTap = () => {
- const now = Date.now();
- if (now - lastTap.current < 320) {
- if (liked) setPop((p) => p + 1);
- else setLike(true);
- }
- lastTap.current = now;
- };
-
- return (
-
-
-
-
-
-
-
-
-
- 날씨각
- {account}
-
-
- setWidth(e.nativeEvent.layout.width)} className="aspect-[4/5] overflow-hidden" accessibilityLabel={n > 1 ? `슬라이드 ${n}장, 옆으로 넘겨 보세요` : undefined}>
-
- {width > 0 && (
-
- {post.slides.map((s: Slide, i) => (
-
- ))}
-
- )}
-
- {n > 1 && (
-
-
- {index + 1}/{n}
-
-
- )}
- {pop > 0 && }
- {pop > 0 && }
- {likeFailed > 0 && (
-
- {liked ? '좋아요를 취소하지 못했어요' : '좋아요를 반영하지 못했어요'}. 다시 해 주세요.
-
- )}
-
-
-
- setLike(!liked)} hitSlop={8} accessibilityRole="button" accessibilityState={{ selected: liked }} accessibilityLabel="좋아요">
-
-
-
-
-
-
-
-
-
- 좋아요 {likeCount.toLocaleString()}개
-
- 날씨각
- {post.caption}
-
-
- {post.comment_count ? `댓글 ${post.comment_count}개 모두 보기` : '첫 댓글 남기기'}
-
- 오늘
-
- );
-}
diff --git a/mobile/src/components/post/post-frame.tsx b/mobile/src/components/post/post-frame.tsx
deleted file mode 100644
index a264f84..0000000
--- a/mobile/src/components/post/post-frame.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-import type { PostReaction } from '@nalssigak/shared/api/client/types.gen';
-import type { PinnedKey } from '@nalssigak/shared/lib/analytics';
-import { LinearGradient } from 'expo-linear-gradient';
-import { useRef, type ReactNode } from 'react';
-import { Pressable, View } from 'react-native';
-import { useCSSVariable } from 'uniwind';
-
-import { CommentIcon, HeartIcon, SendIcon } from '@/components/post/icons';
-import { Text } from '@/components/text';
-import { Ic } from '@/components/ui';
-import { usePinnedLike } from '@/lib/pinned-like';
-import { useSheet } from '@/lib/sheet';
-import { useShare } from '@/lib/share-image';
-import { SITE_URL } from '@/lib/site';
-
-type Props = { title: string; account: string; avatar: string; caption?: string; more?: ReactNode; pinned?: { key: PinnedKey; post?: PostReaction | null }; children: ReactNode };
-
-/** 오늘의 각처럼 포스트 틀(머리줄·버튼줄·글 한 줄)만 빌려 쓰는 카드 (웹 PostFrame). 좋아요·댓글은 피드의 반응 칸(pinned)에 붙는다 */
-export function PostFrame({ title, account, avatar, caption, more, pinned, children }: Props) {
- const { open } = useSheet();
- const [ink, heart] = useCSSVariable(['--color-ink', '--color-heart']).map(String);
- const like = usePinnedLike(pinned?.key ?? 'gak_post', pinned?.post);
- const postId = pinned?.post?.post_id;
- const shot = useRef(null);
- const shareView = useShare();
- const share = () => void shareView(shot, { title, message: `${title} · 날씨각 ${SITE_URL}` });
-
- return (
-
-
-
-
-
-
-
-
-
- 날씨각
- {account}
-
-
-
- {children}
-
-
- {postId != null && (
- <>
-
-
-
- open({ type: 'comments', postId })} hitSlop={8} accessibilityRole="button" accessibilityLabel="댓글 보기">
-
-
- >
- )}
-
-
-
- {more != null && {more}}
-
- {postId != null && (
-
- {like.failed ? '좋아요를 반영하지 못했어요. 다시 해 주세요.' : `좋아요 ${like.count.toLocaleString()}개`}
-
- )}
- {!!caption && (
-
- 날씨각
- {caption}
-
- )}
- {postId != null && (
- open({ type: 'comments', postId })}>
- {pinned?.post?.comment_count ? `댓글 ${pinned.post.comment_count}개 모두 보기` : '첫 댓글 남기기'}
-
- )}
-
- );
-}
diff --git a/mobile/src/components/post/slides.tsx b/mobile/src/components/post/slides.tsx
deleted file mode 100644
index 8e4d77d..0000000
--- a/mobile/src/components/post/slides.tsx
+++ /dev/null
@@ -1,285 +0,0 @@
-import type { GakSlide, HoursSlide, ImageSlide, PlanSlide, PostData, RowsSlide, SunsetSlide, WeekSlide } from '@nalssigak/shared/api/client/types.gen';
-import { PostType, SlotTone } from '@nalssigak/shared/api/client/types.gen';
-import { cardBg, clockShort } from '@nalssigak/shared/lib';
-import type { SlideBg } from '@nalssigak/shared/lib/types';
-import { deg } from '@nalssigak/shared/lib/weatherText';
-import { Image } from 'expo-image';
-import { LinearGradient } from 'expo-linear-gradient';
-import { useState, type ReactNode } from 'react';
-import { Pressable, StyleSheet, View } from 'react-native';
-import { Text } from '@/components/text';
-import Svg, { Polygon } from 'react-native-svg';
-
-import { MoonArt } from '@/components/moon';
-import { Credit, Ic, Rows, Thumb } from '@/components/ui';
-import { CARD_BG } from '@/lib/colors';
-import { useSheet } from '@/lib/sheet';
-import { apiUri, imageUri } from '@/lib/site';
-import { useSky } from '@/lib/sky';
-
-export type Slide = HoursSlide | RowsSlide | GakSlide | SunsetSlide | WeekSlide | PlanSlide | ImageSlide;
-
-type Stops = readonly [string, string, ...string[]];
-
-const GAK_BG: SlideBg[] = ['butter', 'peach', 'lilac'];
-const ROW_ICON_BG: Record = { umbrella: 'lilac', vent: 'mint', sunset: 'peach', thermo: 'sky', maple: 'peach', moon: 'lilac', glasses: 'butter' };
-const DARK = new Set(['dusk', 'night']);
-
-const chunk = (items: T[], n: number) => Array.from({ length: Math.ceil(items.length / n) }, (_, i) => items.slice(i * n, i * n + n));
-
-// 노을 하늘 상황(1 가려짐 2 낮은 구름 3 물들 구름 적음 4 넓게 물듦 5 두꺼움)별 하늘, 시간 칸 색 (웹 .b-sit-*, .b-cut-*)
-const SIT_BG: Record = {
- 1: { colors: ['#6f7690', '#9aa0b4', '#b9b4c0'], locations: [0, 0.55, 1] },
- 2: { colors: ['#7a7f9c', '#a7a3bb', '#c9b8b8'], locations: [0, 0.55, 1] },
- 3: { colors: ['#4b5aa8', '#7f86c6', '#e9b9a8', '#ffb27a', '#ff8a4c'], locations: [0, 0.38, 0.68, 0.86, 1] },
- 4: { colors: ['#5b3f9e', '#c2559a', '#ff7a6a', '#ffb35c'], locations: [0, 0.4, 0.68, 1] },
- 5: { colors: ['#6a6aa0', '#a98fb4', '#e3b1a0'], locations: [0, 0.55, 1] },
-};
-const CUT_BG: Stops[] = [
- ['#9fd0ff', '#ffd79a', '#ff9a5c'],
- ['#8f7cf0', '#ff6f8e', '#ff8a4c'],
- ['#34306e', '#7a5cc8'],
-];
-// 건물 실루엣 (웹 .b-skyline clip-path)
-const SKYLINE = '0,55 8,55 8,30 15,30 15,50 22,50 22,10 28,10 28,45 36,45 36,25 44,25 44,55 52,55 52,35 60,35 60,5 66,5 66,40 74,40 74,20 82,20 82,50 90,50 90,30 100,30 100,100 0,100';
-
-const HOUR_TONE: Record = {
- [SlotTone.NIGHT]: { bg: '#e3e7ff', edge: '#c7cff5' },
- [SlotTone.SUNSET]: { bg: '#ffe3d2', edge: '#ffc19f' },
-};
-
-/** 배경색은 API에 없어 글 종류·아이콘으로 고른다 */
-export function slideBg(post: PostData, slide: Slide): SlideBg {
- if (slide.kind === 'hours' || slide.kind === 'image') return 'sky';
- if (slide.kind === 'sunset') return 'dusk';
- if (slide.kind === 'week') return 'mint';
- if (slide.kind === 'plan') return slide.eyebrow.startsWith('일') ? 'peach' : 'butter';
- if (slide.kind === 'gak') return GAK_BG[post.post_id % GAK_BG.length];
- if (post.post_type === PostType.EVENT || post.post_type === PostType.MOON) return 'night';
- if (post.post_type === PostType.TIP) return 'sky';
- if (post.post_type === PostType.AIR) return slide.icon === 'vent' ? 'mint' : 'lilac';
- if (post.post_type === PostType.DAY_TRIP) return slide.image ? 'night' : 'mint';
- return (ROW_ICON_BG[slide.icon] ?? cardBg(slide.icon, post.post_id)) as SlideBg;
-}
-
-function Base({ colors, locations, children }: { colors: Stops; locations?: readonly [number, number, ...number[]]; children: ReactNode }) {
- return (
-
-
- {children}
-
- );
-}
-
-function Eyebrow({ children, light, className }: { children: ReactNode; light?: boolean; className?: string }) {
- return {children};
-}
-
-function Big({ children, light, className }: { children: ReactNode; light?: boolean; className?: string }) {
- return {children};
-}
-
-function Pic({ name, widthPct = 42 }: { name: string; widthPct?: number }) {
- return (
-
-
-
- );
-}
-
-// 달 포스트 밤하늘 별: [left %, top %, 크기]
-const STARS: [number, number, number][] = [
- [8, 34, 2], [18, 52, 1.5], [30, 40, 2.5], [44, 30, 1.5], [52, 58, 2], [62, 22, 1.5], [90, 18, 2], [94, 44, 1.5], [12, 70, 1.5], [38, 66, 2], [76, 74, 1.5], [86, 64, 2], [24, 12, 1.5], [70, 10, 2.5],
-];
-
-/** 달 포스트 그림: 아이콘 대신 오늘 밤 실제 모양의 달과 별 */
-function MoonPic({ pct, waxing }: { pct: number; waxing: boolean }) {
- const [w, setW] = useState(0);
- return (
- setW(e.nativeEvent.layout.width)}>
- {STARS.map(([x, y, s]) => (
-
- ))}
- {w > 0 && (
-
-
-
- )}
-
- );
-}
-
-export function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
- const { open } = useSheet();
- const { kind } = useSky();
- const palette = CARD_BG[kind === 'night' ? 'night' : 'day'];
- const colors = palette[bg] ?? palette.sky;
- const light = DARK.has(bg);
-
- if (slide.kind === 'hours') {
- const temps = slide.hours.flatMap((h) => (h.temp_c == null ? [] : [h.temp_c]));
- const lo = Math.min(...temps);
- const span = Math.max(...temps) - lo || 1;
- return (
-
- {slide.eyebrow}
- {slide.line}
- {/* 웹 grid-cols-4: 4칸씩 줄을 나눈다 */}
-
- {chunk(slide.hours, 4).map((row) => (
-
- {row.map((h) => {
- const tone = HOUR_TONE[h.tone ?? ''];
- return (
-
- {h.temp_c != null && }
- {h.label}
-
- {deg(h.temp_c)}
-
- );
- })}
- {/* 마지막 줄이 모자라면 빈 칸으로 너비를 맞춘다 */}
- {Array.from({ length: 4 - row.length }, (_, i) => (
-
- ))}
-
- ))}
-
-
- );
- }
- if (slide.kind === 'gak')
- return (
-
- 오늘의 각 · {slide.rank}위
- {slide.line}
-
- {slide.score}
- {slide.name}
- {slide.summary}
- open({ type: 'gak', indexId: slide.index_id })} className="mt-3 self-start rounded-full border-b-[5px] border-orange-deep bg-orange px-4 py-[9px]">
- 계산 근거 보기
-
-
- );
- if (slide.kind === 'sunset') {
- const sit = slide.situation ? SIT_BG[slide.situation] : undefined;
- return (
-
- {slide.eyebrow}
- {/* 노을 탭 히어로와 같은 순서: 결론 → 가장 붉을 때 → 쉬운 이유 */}
- {slide.headline ?? slide.grade_label}
- {!!slide.line && {slide.line}}
-
- {slide.cuts.map((c, i) => (
-
-
-
-
- {clockShort(c.at)}
- {c.label}
-
-
- ))}
-
-
- );
- }
- if (slide.kind === 'week')
- return (
-
- {slide.eyebrow}
- {slide.line}
- {/* 칸은 제목 바로 아래, 팁만 맨 아래로 */}
-
- {slide.days.map((d) => (
-
-
-
- {d.weekday} {d.day.split('-').slice(1).map(Number).join('.')}
-
-
- {deg(d.temp_min_c)} → {deg(d.temp_max_c)}
-
-
- 비 {d.rain_prob ?? '?'}%{d.temp_min_c != null && d.temp_max_c != null && ` · 일교차 ${Math.round(d.temp_max_c - d.temp_min_c)}°`}
-
- {d.gaks && d.gaks.length > 0 && (
-
- 이날 할 만한 각
- {d.gaks.map((g) => (
-
-
-
- {g.name}
-
- {g.score}
-
- ))}
-
- )}
-
- ))}
-
- {!!slide.tip && {slide.tip}}
-
- );
- if (slide.kind === 'plan') {
- const credits = [...new Set(slide.steps.flatMap((st) => (st.image && st.image_credit ? [st.image_credit] : [])))];
- return (
-
- {slide.eyebrow}
- {slide.line}
-
- {slide.steps.map((st, i) => (
-
- {st.time}
-
-
-
- {st.title}
-
-
- {st.sub}
-
-
- {!!st.image && }
-
- ))}
-
- {credits.length > 0 && 사진 {credits.join(' · ')}}
-
- );
- }
- // 카드뉴스: 관리자가 만든 4:5 그림 한 장 (/v1/card/... 는 API 서버 경로)
- if (slide.kind === 'image') return ;
- if (slide.kind === 'rows' && slide.image)
- return (
-
-
- {!!slide.image_credit && }
-
-
- {slide.eyebrow}
- {slide.line}
-
-
-
- );
- return (
-
- {slide.moon_pct != null && }
-
- {slide.eyebrow}
-
-
- {slide.line}
-
- {slide.moon_pct == null && }
-
-
- );
-}
diff --git a/mobile/src/components/saju/birth-form.tsx b/mobile/src/components/saju/birth-form.tsx
deleted file mode 100644
index 5f7f502..0000000
--- a/mobile/src/components/saju/birth-form.tsx
+++ /dev/null
@@ -1,108 +0,0 @@
-import { useState } from 'react';
-import { Pressable, View } from 'react-native';
-
-import { Text } from '@/components/text';
-import { Ic } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useAuth } from '@/lib/auth';
-import { BIRTH_PLACES, placeName, useSaveBirth, validBirth, type Birth } from '@/lib/saju-birth';
-
-import { Box, ChipGrid, DatePick, Stepper, type Ymd } from './pick';
-
-const HOURS: [number, string][] = [[-1, '모름'], ...Array.from({ length: 24 }, (_, i): [number, string] => [i, `${i}시`])];
-const PLACES: [string, string][] = BIRTH_PLACES.map(([k, n]) => [k, n]);
-
-function Label({ children }: { children: string }) {
- return {children};
-}
-
-/** 생년월일·태어난 시각·지역 넣기 (웹 SajuPage BirthForm) */
-export function BirthForm({ initial, onDone, onCancel }: { initial: Birth | null; onDone: () => void; onCancel?: () => void }) {
- const { loggedIn } = useAuth();
- const save = useSaveBirth();
- const [date, setDate] = useState({ y: initial?.y ?? null, m: initial?.m ?? null, d: initial?.d ?? null });
- const [hour, setHour] = useState(initial?.hour ?? null);
- const [minute, setMinute] = useState(initial?.minute ?? 0);
- const [place, setPlace] = useState(initial?.place ?? 'seoul');
- const [open, setOpen] = useState<'hour' | 'place' | null>(null);
- const [error, setError] = useState('');
- const toggle = (k: 'hour' | 'place') => setOpen((o) => (o === k ? null : k));
-
- const submit = () => {
- const { y, m, d } = date;
- if (y == null || m == null || d == null) return setError('생년월일을 모두 넣어 주세요');
- if (!validBirth(y, m, d)) return setError('없는 날짜예요. 다시 확인해 주세요');
- void save({ y, m, d, hour, minute: hour == null ? null : minute, place, gender: initial?.gender ?? null });
- track('saju_input', { with_time: hour != null });
- onDone();
- };
-
- return (
-
-
-
- {'내 사주와 오늘 날씨로\n오늘 하루를 봐요'}
-
-
-
- {
- setDate(v);
- setError('');
- }}
- />
-
-
-
-
- toggle('hour')} />
-
-
- {open === 'hour' && (
-
- {
- setHour(h < 0 ? null : h);
- setOpen(null);
- }}
- wide
- />
-
- )}
-
-
-
- toggle('place')} />
- {open === 'place' && (
-
- {
- setPlace(p);
- setOpen(null);
- }}
- wide
- />
-
- )}
- 지역마다 해가 뜨는 시각이 달라 태어난 시각을 그만큼 고쳐서 봐요.
-
- {!!error && {error}}
-
- 오늘 날씨 사주 보기
-
- {!!onCancel && (
-
- 취소
-
- )}
- {loggedIn ? '내 계정에 저장돼요. 내 정보에서 언제든 지울 수 있어요.' : '이 기기에만 저장돼요. 로그인하면 계정에 저장해 어느 기기에서든 바로 볼 수 있어요.'}
-
- );
-}
diff --git a/mobile/src/components/saju/match.tsx b/mobile/src/components/saju/match.tsx
deleted file mode 100644
index 9d5dce8..0000000
--- a/mobile/src/components/saju/match.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { matchMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import type { ResSajuMatch } from '@nalssigak/shared/api/client/types.gen';
-import { useMutation } from '@tanstack/react-query';
-import { useState } from 'react';
-import { Pressable, View } from 'react-native';
-
-import { useSoft } from '@/components/sheets/parts';
-import { Text } from '@/components/text';
-import { useRegion } from '@/lib/region';
-import { toBody, validBirth, type Birth } from '@/lib/saju-birth';
-
-import { dayWord, Panel } from './parts';
-import { DatePick, type Ymd } from './pick';
-
-const pad = (n: number) => String(n).padStart(2, '0');
-
-/** 궁합 (Lv.5): 상대 생년월일로 두 사주가 맞는 정도와 같이 나가기 좋은 날. 상대 생년월일은 저장하지 않는다 */
-export function Match({ birth }: { birth: Birth }) {
- const { region } = useRegion();
- const soft = useSoft();
- const [date, setDate] = useState({ y: null, m: null, d: null });
- const [error, setError] = useState('');
- const run = useMutation({ ...matchMutation() });
- const res: ResSajuMatch | undefined = run.data?.result?.success ? run.data : undefined;
- const go = () => {
- const { y, m, d } = date;
- if (y == null || m == null || d == null) return setError('상대 생년월일을 모두 넣어 주세요');
- if (!validBirth(y, m, d)) return setError('없는 날짜예요. 다시 확인해 주세요');
- setError('');
- run.mutate({ body: { region_code: region.code, me: toBody(birth), friend: { birth_date: `${y}-${pad(m)}-${pad(d)}`, longitude: 126.98 } } });
- };
- return (
-
- {res ? (
- <>
-
-
- 상대 {date.y}.{date.m}.{date.d}생
-
- run.reset()} hitSlop={8} accessibilityRole="button">
- 다른 사람 보기
-
-
-
- {res.title ?? ''} {res.score ?? ''}점
-
- {res.lines?.map((l) => (
-
- {l}
-
- ))}
- {!!res.day && (
-
- 앞으로 7일 중 같이 나가기 좋은 날: {dayWord(res.day.day, res.day.weekday)}
- {res.day.word ? ` · ${res.day.word} ${res.day.temp_max ?? ''}°` : ''}
-
- )}
- 상대 기운: {res.friend_scene ?? ''}
- >
- ) : (
- <>
- 상대 생년월일(양력)을 넣으면 두 사람 사주가 어떻게 맞는지와 앞으로 7일 중 같이 나가기 좋은 날을 봐요.
- {
- setDate(v);
- setError('');
- }}
- />
-
- 보기
-
- {!!error && {error}}
- {(run.isError || (!!run.data && !run.data.result?.success)) && 궁합을 불러오지 못했어요. 다시 눌러 주세요.}
- 상대 생년월일은 저장하지 않아요.
- >
- )}
-
- );
-}
diff --git a/mobile/src/components/saju/me-card.tsx b/mobile/src/components/saju/me-card.tsx
deleted file mode 100644
index d480e99..0000000
--- a/mobile/src/components/saju/me-card.tsx
+++ /dev/null
@@ -1,139 +0,0 @@
-import type { ResSaju } from '@nalssigak/shared/api/client/types.gen';
-import { Image } from 'expo-image';
-import { Pressable, View } from 'react-native';
-
-import { useSoft } from '@/components/sheets/parts';
-import { Text } from '@/components/text';
-
-import { EL_ART, EL_COLOR, EL_WORD, Panel } from './parts';
-
-const POS_WORD: Record = { hour: '시', day: '일', month: '월', year: '연' };
-const STRENGTH_WORD: Record = {
- 신강: '나를 돕는 기운이 센 사주. 태어난 달(월령)의 힘을 먼저 봐요',
- 중화: '나를 돕는 기운과 다른 기운이 비슷한 사주',
- 신약: '나를 돕는 기운이 약한 사주',
-};
-const TEN_GOD_WORD: Record = {
- 비견: '나와 같은 기운',
- 겁재: '나와 같지만 겨루는 기운',
- 식신: '내가 만들어 내는 기운',
- 상관: '내가 드러내는 기운',
- 편재: '내가 크게 굴리는 재물',
- 정재: '내가 차곡차곡 모으는 재물',
- 편관: '나를 세게 다잡는 기운',
- 정관: '나를 바르게 이끄는 기운',
- 편인: '나를 돕는 남다른 지혜',
- 정인: '나를 돕는 배움·도움',
-};
-
-function Art({ el, size }: { el: string; size: number }) {
- const src = EL_ART[el];
- return src != null ? : null;
-}
-
-function Char({ c, ko, el, me }: { c: string; ko: string; el: string; me?: boolean }) {
- const [fg, bg] = EL_COLOR[el] ?? ['#28304a', '#f3f6fb'];
- return (
-
-
- {c}
-
-
- {ko}
-
-
- );
-}
-
-function Note({ term, word }: { term: string; word: string }) {
- return (
-
- {term} = {word}
-
- );
-}
-
-/** 사주 명식: 가장 센 기운, 오행 막대, 네 기둥, 용어 풀이 */
-export function MeCard({ r, onEdit }: { r: ResSaju; onEdit: () => void }) {
- const soft = useSoft();
- const me = r.me!;
- const cols = [...me.pillars].reverse();
- const els = Object.entries(me.elements ?? {});
- const total = els.reduce((a, [, v]) => a + v, 0);
- const gods = [...new Set(me.pillars.flatMap((p) => [p.stem_ten_god, p.branch_ten_god]).filter((g): g is string => !!g && g in TEN_GOD_WORD))];
- const strength = me.strength ?? (me.strong == null ? null : me.strong ? '신강' : '신약');
- const top = me.top_element;
- return (
-
- 생년월일 바꾸기
-
- }
- >
- {!!top && !!strength && (
-
-
-
-
- {EL_WORD[top]}({top}) 기운이 가장 센 {strength} 사주
-
-
- 나를 돕는 기운 {Math.round((me.support ?? 0) * 100)}% · {me.scene}
-
-
-
- )}
- {total > 0 && (
- <>
- `${k} ${Math.round(v)}`).join(', ')}>
- {els.map(([k, v]) => (
-
- ))}
-
-
- {els.map(([k, v]) => (
-
-
-
- {k} {Math.round(v)}
-
-
- ))}
-
- >
- )}
-
- {(me.hour_known ? cols : [null, ...cols]).map((p, i) => (
-
- {p ? `${POS_WORD[p.position]}주` : '시주'}
- {p ? (
- <>
- {p.position === 'day' ? '나' : (p.stem_ten_god ?? '')}
-
-
- {p.branch_ten_god}
- {p.position === 'month' && 월령}
- >
- ) : (
-
- 시각 모름
-
- )}
-
- ))}
-
-
- {!!strength && }
- {gods.map((g) => (
-
- ))}
-
-
- {(me.need?.length ?? 0) > 0 && 내 기운에 좋은 날씨: {me.need!.join(' · ')}}
- {me.jeol_warning && 태어난 날에 절기가 바뀌어요. 태어난 시각을 넣어야 달 기둥이 정확해요.}
-
- );
-}
diff --git a/mobile/src/components/saju/panels.tsx b/mobile/src/components/saju/panels.tsx
deleted file mode 100644
index b886eca..0000000
--- a/mobile/src/components/saju/panels.tsx
+++ /dev/null
@@ -1,171 +0,0 @@
-import type { ResSaju, SajuLock } from '@nalssigak/shared/api/client/types.gen';
-import { LinearGradient } from 'expo-linear-gradient';
-import { Pressable, View } from 'react-native';
-
-import { useSoft } from '@/components/sheets/parts';
-import { Text } from '@/components/text';
-import { Ic } from '@/components/ui';
-import { useAuth } from '@/lib/auth';
-import { progress, useLevel } from '@/lib/level';
-import { useSaveBirth, type Birth } from '@/lib/saju-birth';
-import { useSheet } from '@/lib/sheet';
-
-import { dayWord, Panel } from './parts';
-
-/** 앞으로 7일 흐름 (Lv.2) */
-export function Week({ days }: { days: NonNullable }) {
- const soft = useSoft();
- return (
-
-
- {days.map((d) => (
-
-
- {dayWord(d.day, d.weekday)}
-
- {d.icon ? : }
-
- {d.temp_max != null ? `${d.temp_min}~${d.temp_max}°` : ''}
-
-
- {d.title}
-
- {d.score}
-
- ))}
-
- 점수는 그날 사주와 예보로 계산해요. 주황색은 7일 중 점수가 가장 높은 날이에요.
-
- );
-}
-
-/** 금전운·일운 (Lv.3) */
-export function Money({ money, work }: { money: string[]; work: string[] }) {
- const lines = [...money.map((l) => ['money_bag', l]), ...work.map((l) => ['briefcase', l])];
- return (
-
-
- {lines.map(([icon, l]) => (
-
-
- {l}
-
- ))}
-
-
- );
-}
-
-/** 앞으로 7일 연애운 (Lv.4). 성별을 고르면 이성 인연까지 */
-export function Love({ love, birth }: { love: NonNullable; birth: Birth }) {
- const soft = useSoft();
- const save = useSaveBirth();
- const pick = (g: 'M' | 'F' | null) => void save({ ...birth, gender: g });
- return (
-
- {love.good ? (
-
- 연애 기운이 좋은 날
-
- {dayWord(love.good.day, love.good.weekday)}
- {love.good.word ? ` · ${love.good.word} ${love.good.temp_max ?? ''}°` : ''}
-
- {love.good.body}
- {love.good.why}
-
- ) : (
- 앞으로 7일 중엔 연애 기운이 두드러지는 날이 없어요.
- )}
- {!!love.caution && (
-
- 조심할 날 {dayWord(love.caution.day, love.caution.weekday)}: {love.caution.body} · {love.caution.why}
-
- )}
- {love.gender_known ? (
-
- {birth.gender === 'M' ? '남성' : '여성'} 기준으로 이성 인연(재성·관성)까지 봤어요 ·{' '}
- pick(null)} accessibilityRole="button" className="font-extrabold text-orange">
- 빼고 보기
-
-
- ) : (
-
- 성별을 고르면 이성 인연(재성·관성)까지 봐요
- {(
- [
- ['M', '남성'],
- ['F', '여성'],
- ] as const
- ).map(([g, word]) => (
- pick(g)} accessibilityRole="button" className="rounded-full px-2.5 py-1" style={{ backgroundColor: soft.soft }}>
- {word}
-
- ))}
-
- )}
-
- );
-}
-
-/** 이달·올해 (Lv.6·7) */
-export function Period({ id, icon, p }: { id: string; icon: string; p: NonNullable }) {
- return (
-
-
- {p.title} ({p.ten_god})
-
- {p.body}
- {(p.months?.length ?? 0) > 0 && (
-
- {p.label.includes('미리') ? '내 사주와 잘 맞는 달' : '남은 달 중 잘 맞는 달'}: {p.months!.map((m) => `${m}월`).join(' · ')}
-
- )}
- {p.notes?.map((n) => (
-
- {n}
-
- ))}
-
- );
-}
-
-/** 아직 안 열린 것: 다음에 열릴 하나를 크게, 나머지는 한 줄로. 로그인 전이면 로그인부터 */
-export function Locked({ locks }: { locks: SajuLock[] }) {
- const { loggedIn } = useAuth();
- const { open } = useSheet();
- const soft = useSoft();
- const level = useLevel().data;
- if (!locks.length) return null;
- const [next, ...rest] = [...locks].sort((a, b) => a.level - b.level);
- const close = loggedIn && !!level && level.next_points != null && level.level + 1 === next.level;
- return (
-
-
-
-
- {loggedIn ? `다음은 ${next.name}` : '각을 모으면 더 볼 수 있어요'}
-
- {loggedIn ? (close && level ? `${level.next_points! - level.points}각 더 모으면 열려요` : `Lv.${next.level}이 되면 열려요`) : "로그인하고 출석·사주 보기·좋아요를 하면 활동 포인트 '각'이 쌓여요"}
-
-
- open(loggedIn ? { type: 'level' } : { type: 'login', why: 'level' })} accessibilityRole="button" className="rounded-full bg-ink-btn px-3 py-1.5">
- {loggedIn ? '각 모으는 법' : '로그인'}
-
-
- {close && !!level && (
-
-
-
- )}
-
- {(loggedIn ? rest : [next, ...rest]).map((l) => (
-
-
- Lv.{l.level} {l.name}
-
-
- ))}
-
-
- );
-}
diff --git a/mobile/src/components/saju/parts.tsx b/mobile/src/components/saju/parts.tsx
deleted file mode 100644
index 6445304..0000000
--- a/mobile/src/components/saju/parts.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { createContext, use, type ReactNode } from 'react';
-import { View } from 'react-native';
-
-import { Text } from '@/components/text';
-import { Ic } from '@/components/ui';
-
-export const EL_COLOR: Record = { 木: ['#2f8a4c', '#e3f6ea'], 火: ['#d9442f', '#ffe6e0'], 土: ['#a8761a', '#fbf0d6'], 金: ['#6b7486', '#eef0f4'], 水: ['#2d4a8a', '#e3ebfb'] };
-export const EL_WORD: Record = { 木: '나무', 火: '불', 土: '흙', 金: '쇠', 水: '물' };
-// 오행 그림 (웹 public/saju). Metro 는 정적 require 만 묶을 수 있어 하나씩 적는다
-export const EL_ART: Record = {
- 木: require('../../../../frontend/public/saju/wood.webp'),
- 火: require('../../../../frontend/public/saju/fire.webp'),
- 土: require('../../../../frontend/public/saju/earth.webp'),
- 金: require('../../../../frontend/public/saju/metal.webp'),
- 水: require('../../../../frontend/public/saju/water.webp'),
-};
-
-/** 2026-11-04 + 수 → 11/4(수) */
-export const dayWord = (iso: string, weekday: string) => `${Number(iso.slice(5, 7))}/${Number(iso.slice(8, 10))}(${weekday})`;
-
-/** ?open= 으로 연 칸: 그 칸이 자리를 잡으면 화면이 그 위치로 내려간다 (웹 #hash 스크롤) */
-export const OpenTarget = createContext<{ id?: string; onLayout: (y: number) => void }>({ onLayout: () => {} });
-
-/** 흰 판: 아이콘·제목·오른쪽 버튼 */
-export function Panel({ id, icon, title, right, children }: { id?: string; icon: string; title: string; right?: ReactNode; children: ReactNode }) {
- const target = use(OpenTarget);
- const mine = !!id && target.id === id;
- return (
- target.onLayout(e.nativeEvent.layout.y) : undefined} className="mx-4 rounded-[22px] border-b-4 border-shade bg-card px-4 py-3.5">
-
-
- {title}
- {right != null && {right}}
-
- {children}
-
- );
-}
diff --git a/mobile/src/components/saju/pick.tsx b/mobile/src/components/saju/pick.tsx
deleted file mode 100644
index 180c9ea..0000000
--- a/mobile/src/components/saju/pick.tsx
+++ /dev/null
@@ -1,131 +0,0 @@
-import { useState } from 'react';
-import { Pressable, View } from 'react-native';
-
-import { useSoft } from '@/components/sheets/parts';
-import { Text } from '@/components/text';
-
-/** 고르는 칸: 누르면 아래에 칩이 펼쳐진다 (웹 input·select 대신. 숫자 자판 없이 눌러서 고른다) */
-export function Box({ label, value, placeholder, open, onPress, disabled, flex = 1 }: { label: string; value: string | null; placeholder: string; open: boolean; onPress: () => void; disabled?: boolean; flex?: number }) {
- const soft = useSoft();
- return (
-
-
- {value ?? placeholder}
-
- {open ? '▲' : '▼'}
-
- );
-}
-
-/** 칩 여러 개 중 하나 고르기 */
-export function ChipGrid({ items, value, onPick, label, wide }: { items: [K, string][]; value: K | null; onPick: (k: K) => void; label: string; wide?: boolean }) {
- const soft = useSoft();
- return (
-
- {items.map(([k, word]) => {
- const on = value === k;
- return (
- onPick(k)} accessibilityRole="radio" accessibilityState={{ checked: on }} className={`min-h-[40px] items-center justify-center rounded-xl px-1 ${wide ? 'w-[64px]' : 'w-[44px]'} ${on ? 'bg-orange' : 'bg-card'}`}>
- {word}
-
- );
- })}
-
- );
-}
-
-/** 연도: 먼저 10년 단위를 고르고 그 안에서 연도 */
-function YearGrid({ value, onPick, label }: { value: number | null; onPick: (y: number) => void; label: string }) {
- const thisYear = new Date().getFullYear();
- const [decade, setDecade] = useState(value != null ? Math.floor(value / 10) * 10 : 1990);
- const decades: [number, string][] = [];
- for (let d = 1900; d <= thisYear; d += 10) decades.push([d, `${String(d).slice(2)}년대`]);
- const years: [number, string][] = [];
- for (let y = decade; y < decade + 10 && y <= thisYear; y++) years.push([y, String(y)]);
- return (
-
-
-
-
- );
-}
-
-const MONTHS: [number, string][] = Array.from({ length: 12 }, (_, i) => [i + 1, `${i + 1}월`]);
-const daysIn = (y: number | null, m: number | null) => (m == null ? 31 : new Date(y ?? 2000, m, 0).getDate());
-
-export type Ymd = { y: number | null; m: number | null; d: number | null };
-
-/** 생년월일(양력) 고르기: 연도 → 월 → 일 순서로 이어서 펼친다 */
-export function DatePick({ value, onChange, label = '' }: { value: Ymd; onChange: (v: Ymd) => void; label?: string }) {
- const [open, setOpen] = useState<'y' | 'm' | 'd' | null>(null);
- const toggle = (k: 'y' | 'm' | 'd') => setOpen((o) => (o === k ? null : k));
- const days: [number, string][] = Array.from({ length: daysIn(value.y, value.m) }, (_, i) => [i + 1, String(i + 1)]);
- return (
-
-
- toggle('y')} flex={1.5} />
- toggle('m')} />
- toggle('d')} />
-
- {open === 'y' ? (
- {
- onChange({ ...value, y });
- setOpen(value.m == null ? 'm' : null);
- }}
- />
- ) : open === 'm' ? (
- {
- onChange({ ...value, m });
- setOpen(value.d == null ? 'd' : null);
- }}
- wide
- />
- ) : open === 'd' ? (
- {
- onChange({ ...value, d });
- setOpen(null);
- }}
- />
- ) : null}
-
- );
-}
-
-/** 숫자: −/+ 버튼 (분) */
-export function Stepper({ value, onChange, min, max, label, unit, disabled }: { value: number; onChange: (v: number) => void; min: number; max: number; label: string; unit: string; disabled?: boolean }) {
- const soft = useSoft();
- const set = (v: number) => onChange(Math.min(max, Math.max(min, v)));
- return (
-
- set(value - 1)} onLongPress={() => set(value - 10)} disabled={disabled || value <= min} hitSlop={4} accessibilityLabel={`${label} 내리기`} className="px-3.5 py-2">
- −
-
-
- {value}
- {unit}
-
- set(value + 1)} onLongPress={() => set(value + 10)} disabled={disabled || value >= max} hitSlop={4} accessibilityLabel={`${label} 올리기`} className="px-3.5 py-2">
- +
-
-
- );
-}
diff --git a/mobile/src/components/saju/reading.tsx b/mobile/src/components/saju/reading.tsx
deleted file mode 100644
index e5b9df7..0000000
--- a/mobile/src/components/saju/reading.tsx
+++ /dev/null
@@ -1,172 +0,0 @@
-import { myLevelQueryKey } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { reading } from '@nalssigak/shared/api/client/sdk.gen';
-import type { SajuCard } from '@nalssigak/shared/api/client/types.gen';
-import { useQuery, useQueryClient } from '@tanstack/react-query';
-import { useEffect, useRef } from 'react';
-import { Pressable, View } from 'react-native';
-import Svg, { Circle } from 'react-native-svg';
-import { useCSSVariable } from 'uniwind';
-
-import { useSoft } from '@/components/sheets/parts';
-import { Text } from '@/components/text';
-import { Ic } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useAuth } from '@/lib/auth';
-import { useLevel } from '@/lib/level';
-import { useRegion } from '@/lib/region';
-import { markSajuSeen, toBody, type Birth } from '@/lib/saju-birth';
-import { useShare } from '@/lib/share-image';
-import { SITE_URL } from '@/lib/site';
-
-import { Match } from './match';
-import { MeCard } from './me-card';
-import { Locked, Love, Money, Period, Week } from './panels';
-
-const CARD_ICON: Record = { when: 'alarm_clock', do: 'check_mark_button', avoid: 'warning', good: 'sparkles', wear: 'tshirt' };
-
-function DecisionCard({ c }: { c: SajuCard }) {
- return (
-
-
-
- {c.kind === 'when' ? '내 기운에 맞는 시간' : c.title}
- {c.kind === 'when' ? `${c.title} · ${c.sub ?? ''}` : c.body}
- {(c.kind === 'when' ? c.body : c.sub) ?? ''}
-
-
- );
-}
-
-const RING_R = 46;
-const RING_LEN = 2 * Math.PI * RING_R;
-
-function ScoreRing({ score }: { score: number }) {
- const soft = useSoft();
- return (
-
-
- {score}
- 오늘의 점수
-
- );
-}
-
-function ScoreBar({ label, value, width, color, signed }: { label: string; value: number; width: number; color: string; signed?: boolean }) {
- const soft = useSoft();
- return (
-
-
-
- {label}
-
-
- {`${signed ? (value >= 0 ? '+' : '−') : ''}${Math.abs(value)}점`}
-
-
-
-
-
-
- );
-}
-
-/** 오늘 점수와 할 일, 내 기운, 레벨로 열리는 이번 주·금전·연애·궁합·이달·올해 (웹 SajuPage Reading) */
-export function Reading({ birth, onEdit }: { birth: Birth; onEdit: () => void }) {
- const { region } = useRegion();
- const { loggedIn } = useAuth();
- const queryClient = useQueryClient();
- const soft = useSoft();
- const ink = String(useCSSVariable('--color-ink'));
- const share = useShare();
- const level = useLevel().data?.level;
- const body = { ...toBody(birth), region_code: region.code, gender: birth.gender === 'M' ? ('male' as const) : birth.gender === 'F' ? ('female' as const) : undefined };
- // 레벨이 오르면 키가 바뀌어 새로 열린 칸까지 다시 받는다. 사주를 보면 각이 쌓이니 레벨도 새로 받는다
- const q = useQuery({
- queryKey: ['saju', body, loggedIn, level],
- staleTime: 10 * 60_000,
- queryFn: async () => {
- const { data } = await reading({ body });
- if (!data.result?.success) throw new Error(data.result?.desc ?? 'saju');
- if (loggedIn) void queryClient.invalidateQueries({ queryKey: myLevelQueryKey() });
- return data;
- },
- });
- const shot = useRef(null);
- const r = q.data;
-
- useEffect(() => {
- if (!r?.today) return;
- markSajuSeen();
- track('saju_view', { scene: r.me?.scene ?? '', score: r.today.score, strength: r.me?.strength ?? '', top_element: r.me?.top_element ?? '' });
- }, [r]);
-
- if (q.isPending) return 사주를 풀고 있어요…;
- if (!r?.today || !r.me)
- return (
-
- 결과를 불러오지 못했어요.
- void q.refetch()} accessibilityRole="button" className="mt-3 rounded-full bg-ink-btn px-4 py-2">
- 다시 시도
-
-
- );
- const t = r.today;
- const matchOpen = !!r.locks?.find((l) => l.key === 'saju_match')?.unlocked;
- const title = `오늘 내 날씨 사주 ${t.score}점 · ${t.title}`;
-
- return (
-
-
-
- {Number(t.day.slice(5, 7))}월 {Number(t.day.slice(8, 10))}일 {t.pillar}일 · 오늘의 점수
-
-
-
-
- {t.title}
-
- {t.weather_points != null && = 0 ? '#1f7a4f' : '#e8663a'} signed />}
-
-
- {(t.why?.length ?? 0) > 0 && (
-
- {t.why!.map((w) => {
- const down = w.startsWith('↓');
- return (
-
- {w}
-
- );
- })}
-
- )}
-
-
-
- {t.cards.map((c) => (
-
- ))}
-
-
-
-
- {!!r.week && }
- {!!r.money && }
- {!!r.love && }
- {matchOpen && }
- {!!r.month && }
- {!!r.year && }
- !l.unlocked)} />
-
-
- 재미로 보는 날씨 사주
- void share(shot, { title, message: `${title} ${SITE_URL}/saju` })} accessibilityRole="button" className="rounded-full bg-ink-btn px-4 py-2">
- 공유
-
-
-
- );
-}
diff --git a/mobile/src/components/screen-header.tsx b/mobile/src/components/screen-header.tsx
deleted file mode 100644
index 1f55e7e..0000000
--- a/mobile/src/components/screen-header.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { router } from 'expo-router';
-import { Pressable, View } from 'react-native';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import Svg, { Path } from 'react-native-svg';
-import { useCSSVariable } from 'uniwind';
-
-import { Text } from '@/components/text';
-import { useSky } from '@/lib/sky';
-
-/** 탭 밖 화면(사주·이야기·게임 등) 머리줄: 뒤로 가기와 제목. 뒤로 갈 곳이 없으면(링크로 바로 열림) 오늘 탭으로 */
-export function ScreenHeader({ title, right }: { title: string; right?: React.ReactNode }) {
- const { top } = useSafeAreaInsets();
- const { kind } = useSky();
- const ink = String(useCSSVariable('--color-ink'));
- const back = () => (router.canGoBack() ? router.back() : router.replace('/'));
- return (
-
-
-
-
-
-
- {title}
-
- {right}
-
-
- );
-}
diff --git a/mobile/src/components/season/parts.tsx b/mobile/src/components/season/parts.tsx
deleted file mode 100644
index 2519948..0000000
--- a/mobile/src/components/season/parts.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-import type { ArticleSummary, ResSeasonWeek } from '@nalssigak/shared/api/client/types.gen';
-import { ARTICLE_LABEL, cardBg, dateRange, shortDay } from '@nalssigak/shared/lib';
-import { LinearGradient } from 'expo-linear-gradient';
-import { Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-
-import { Fall } from '@/components/fall';
-import { Credit, Ic, Skel, Thumb } from '@/components/ui';
-import { CARD_BG } from '@/lib/colors';
-import { useSky } from '@/lib/sky';
-
-const HEAD_BOX = 'mx-3 mt-3 min-h-[250px] overflow-hidden rounded-[28px] p-5';
-const ROW = 'flex-row items-center gap-3 border-b-[1.5px] border-line px-4 py-3.5';
-const ROW_SKELS = [0, 1, 2, 3];
-
-// 분류 글자색 (웹 ARTICLE_CAT). 밤엔 밝게
-const CAT_COLOR: Record = { 1: ['#1f9d62', '#4fd39a'], 2: ['#7a5cd6', '#b9a6ff'], 3: ['#ff7a45', '#ff8a57'] };
-
-/** 특집 상자와 같은 틀: 머리말 · 제목 두 줄 · 시 한 줄 · 절기 막대 */
-export function HeadSkel() {
- return (
-
-
-
-
-
-
-
-
- );
-}
-
-export function RowsSkel() {
- return (
- <>
- {ROW_SKELS.map((i) => (
-
-
-
-
-
-
-
-
- ))}
- >
- );
-}
-
-/** 이번 주 특집: 제목·시·절기 막대. 누르면 이번 주 절기 창 */
-export function SeasonHead({ week: w, onPress }: { week: ResSeasonWeek; onPress: () => void }) {
- const { kind } = useSky();
- const night = kind === 'night';
- const progress = Math.round((w.progress ?? 0) * 100);
- const poem = w.poem_lines ?? [];
- return (
-
-
-
-
-
- 이번 주 특집{w.start && w.end ? ` · ${dateRange(w.start, w.end)}` : ''}
- {w.headline}
- {poem.length > 0 && {poem.join('\n')}}
- {!!w.term_now && !!w.term_next && (
-
-
-
- {w.term_now.name} {shortDay(w.term_now.day)}
-
-
- {w.term_next.name} {shortDay(w.term_next.day)}
-
-
-
-
-
-
- )}
-
- );
-}
-
-export function ArticleRow({ article: a, onPress }: { article: ArticleSummary; onPress: () => void }) {
- const { kind } = useSky();
- const night = kind === 'night';
- const color = CAT_COLOR[a.category]?.[night ? 1 : 0];
- return (
-
-
- {!!ARTICLE_LABEL[a.category] && (
-
- {ARTICLE_LABEL[a.category]}
-
- )}
- {a.title}
- {a.read_minutes}분 읽기
-
-
-
- {!!a.image && !!a.image_credit && }
-
-
- );
-}
diff --git a/mobile/src/components/sheets/article.tsx b/mobile/src/components/sheets/article.tsx
deleted file mode 100644
index 763d0fa..0000000
--- a/mobile/src/components/sheets/article.tsx
+++ /dev/null
@@ -1,88 +0,0 @@
-import { getArticleOptions, getSeasonWeekOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { ARTICLE_LABEL, articleMeta, cardBg, dateRange, loadOf, shortDay } from '@nalssigak/shared/lib';
-import { useQuery } from '@tanstack/react-query';
-import { LinearGradient } from 'expo-linear-gradient';
-import { useEffect, useRef } from 'react';
-import { Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-
-import { Credit, Ic, StateBox, Thumb } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { CARD_BG } from '@/lib/colors';
-import { useSheet } from '@/lib/sheet';
-import { useSky } from '@/lib/sky';
-
-import { ArticleSkel, Body } from './parts';
-
-export function ArticleSheet({ articleId, onTitle }: { articleId: number; onTitle: (t: string) => void }) {
- const q = useQuery(getArticleOptions({ path: { article_id: articleId } }));
- const a = q.data?.article;
- const night = useSky().kind === 'night';
-
- useEffect(() => {
- onTitle(a ? (ARTICLE_LABEL[a.category] ?? '') : '');
- }, [a, onTitle]);
-
- const tracked = useRef(0);
- useEffect(() => {
- if (!a || tracked.current === a.article_id) return;
- tracked.current = a.article_id;
- track('select_content', { content_type: 'article', item_id: a.article_id, category: ARTICLE_LABEL[a.category] ?? a.category });
- }, [a]);
-
- const load = loadOf(q);
- if (!a) return {load === 'loading' ? : q.refetch()} empty="글을 찾지 못했어요." hold={} boxClassName="inset-0" />};
- return (
-
-
-
- {!!a.image && !!a.image_credit && }
-
- {articleMeta(a)}
- {a.title}
- {(q.data?.body ?? []).map((t) => (
-
- {t}
-
- ))}
-
- );
-}
-
-export function SeasonWeekSheet() {
- const { open } = useSheet();
- const night = useSky().kind === 'night';
- const q = useQuery(getSeasonWeekOptions());
- const w = q.data;
- const load = loadOf(q);
- if (!w?.headline) return {load === 'loading' ? : q.refetch()} empty="이번 주 특집이 아직 없어요." hold={} boxClassName="inset-0" />};
- return (
-
-
-
-
-
- {w.start && w.end ? dateRange(w.start, w.end) : '이번 주'}
- {w.headline}
- {(w.poem_lines ?? []).length > 0 && (
-
-
- {w.poem_lines?.join(' ')}
-
- {!!w.author && {w.author}}
-
- )}
- {!!w.term_now && !!w.term_next && (
-
- 지금 절기는 {w.term_now.name}({shortDay(w.term_now.day)}), 다음 절기는 {w.term_next.name}({shortDay(w.term_next.day)})예요.
-
- )}
- {(w.news ?? []).map((n) => (
- open({ type: 'article', articleId: n.article_id })} className="flex-row items-center gap-2.5 border-b-[1.5px] border-line py-2.5">
-
- {n.title}
-
- ))}
-
- );
-}
diff --git a/mobile/src/components/sheets/comments.tsx b/mobile/src/components/sheets/comments.tsx
deleted file mode 100644
index f7c44b3..0000000
--- a/mobile/src/components/sheets/comments.tsx
+++ /dev/null
@@ -1,393 +0,0 @@
-import {
- addCommentMutation,
- addTalkCommentMutation,
- agreeTermsMutation,
- blockAuthorMutation,
- deleteCommentMutation,
- getFeedQueryKey,
- likeCommentMutation,
- listBlockedQueryKey,
- listCommentsInfiniteOptions,
- listCommentsInfiniteQueryKey,
- listTalkCommentsInfiniteOptions,
- listTalkCommentsInfiniteQueryKey,
- meQueryKey,
- reportCommentMutation,
- unlikeCommentMutation,
-} from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { ReportReason, type CommentData, type ResCommentList } from '@nalssigak/shared/api/client/types.gen';
-import { ago, loadOf } from '@nalssigak/shared/lib';
-import { useInfiniteQuery, useMutation, useQueryClient, type InfiniteData } from '@tanstack/react-query';
-import { useEffect, useRef, useState } from 'react';
-import { Linking, Pressable, TextInput, View } from 'react-native';
-import { Text } from '@/components/text';
-import { useCSSVariable } from 'uniwind';
-
-import { Avatar, Skel, StateBox } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useAuth } from '@/lib/auth';
-import { useRegion } from '@/lib/region';
-import { useSheet, type CommentTarget } from '@/lib/sheet';
-import { SITE_URL } from '@/lib/site';
-
-import { Body, ErrorLine, Field, HeartIcon, useSoft } from './parts';
-
-const NOT_FOUND = 3001; // 서버 ErrorType.NOT_FOUND
-const EMOJIS = ['☀️', '🌂', '🍻', '🌇', '😍', '👍'];
-const N3 = [0, 1, 2];
-const REPORT_REASONS = [
- [ReportReason.ABUSE, '욕설·비하'],
- [ReportReason.AD, '광고'],
- [ReportReason.PRIVACY, '개인정보 노출'],
- [ReportReason.OTHER, '기타'],
-] as const;
-export const isCommentList = (q: { queryKey: readonly unknown[] }) => ['listComments', 'listTalkComments'].includes((q.queryKey[0] as { _id?: string } | undefined)?._id ?? '');
-const isTalkList = (q: { queryKey: readonly unknown[] }) => (q.queryKey[0] as { _id?: string } | undefined)?._id === 'listTalks';
-
-/** 댓글 목록 캐시 키: 지우기·신고 뒤 다시 받을 때 쓴다 */
-function commentListKey(to: CommentTarget) {
- return 'talkId' in to ? listTalkCommentsInfiniteQueryKey({ path: { talk_id: to.talkId } }) : listCommentsInfiniteQueryKey({ path: { post_id: to.postId } });
-}
-
-function Chip({ label, onPress, disabled, danger }: { label: string; onPress: () => void; disabled?: boolean; danger?: boolean }) {
- const s = useSoft();
- return (
-
- {label}
-
- );
-}
-
-/** 남의 댓글: ⋯ → 신고하기(이유 고르기) / 이 사람 차단하기(한 번 더 묻기). 끝나면 목록을 다시 받아 그 댓글이 빠진다 */
-function CommentMenu({ c, to, onNotice }: { c: CommentData; to: CommentTarget; onNotice: (text: string) => void }) {
- const { loggedIn } = useAuth();
- const { open } = useSheet();
- const queryClient = useQueryClient();
- const [step, setStep] = useState<'closed' | 'menu' | 'report' | 'block'>('closed');
- const [failed, setFailed] = useState(false);
- const report = useMutation(reportCommentMutation());
- const block = useMutation(blockAuthorMutation());
- const pending = report.isPending || block.isPending;
-
- const finish = (notice: string, done: () => void) => ({
- onSuccess: (res: { result?: { success?: boolean } }) => {
- if (!res.result?.success) return setFailed(true);
- done();
- setStep('closed');
- onNotice(notice);
- queryClient.invalidateQueries({ predicate: isCommentList });
- queryClient.invalidateQueries({ queryKey: listBlockedQueryKey() });
- },
- onError: () => setFailed(true),
- });
- const go = (next: typeof step) => {
- setFailed(false);
- if (next !== 'closed' && !loggedIn) return open({ type: 'login', then: { type: 'comments', ...to } });
- setStep(next);
- };
-
- return (
- <>
- go(step === 'closed' ? 'menu' : 'closed')} hitSlop={10} accessibilityRole="button" accessibilityState={{ expanded: step !== 'closed' }} accessibilityLabel="댓글 메뉴" className="px-1">
- ⋯
-
- {step !== 'closed' && (
-
- {step === 'menu' && (
- <>
- go('report')} />
- go('block')} />
- >
- )}
- {step === 'report' &&
- REPORT_REASONS.map(([reason, label]) => (
- report.mutate({ path: { comment_id: c.comment_id }, body: { reason } }, finish('신고했어요. 확인하고 조치할게요.', () => track('report', { content_type: 'comment', reason })))} />
- ))}
- {step === 'block' && (
- <>
- {c.nickname}님 댓글을 더는 안 볼까요?
- block.mutate({ path: { comment_id: c.comment_id } }, finish('차단했어요. 내 정보에서 풀 수 있어요.', () => track('block', { content_type: 'comment' })))} />
- go('closed')} />
- >
- )}
- {failed && (
-
- 잠시 뒤에 다시 해 주세요.
-
- )}
-
- )}
- >
- );
-}
-
-function CommentsSkel() {
- return (
-
- {N3.map((i) => (
-
-
-
-
-
-
-
- ))}
-
- );
-}
-
-function CommentRow({ c, to, onNotice }: { c: CommentData; to: CommentTarget; onNotice: (text: string) => void }) {
- const { region } = useRegion();
- const queryClient = useQueryClient();
- const [heart, ink3] = useCSSVariable(['--color-heart', '--color-ink3']).map(String);
- const [liked, setLiked] = useState(c.liked);
- const [count, setCount] = useState(c.like_count);
- const like = useMutation(likeCommentMutation());
- const unlike = useMutation(unlikeCommentMutation());
- const remove = useMutation(deleteCommentMutation());
- const [removeFailed, setRemoveFailed] = useState(false);
- const [likeFailed, setLikeFailed] = useState(false);
-
- // 좋아요는 로그인 없이 된다 (웹과 같이)
- const toggle = () => {
- if (like.isPending || unlike.isPending) return;
- const next = !liked;
- setLikeFailed(false);
- setLiked(next);
- setCount((n) => n + (next ? 1 : -1));
- const revert = () => {
- setLiked(!next);
- setCount(c.like_count);
- };
- (next ? like : unlike).mutate(
- { path: { comment_id: c.comment_id } },
- {
- onSuccess: (res) => {
- if (res.result?.success) {
- setLiked(!!res.liked);
- if (res.like_count != null) setCount(res.like_count);
- if (next) track('like', { content_type: 'comment', item_id: c.comment_id });
- return;
- }
- revert();
- // 그 사이 지워진 댓글이면 알림 없이 목록을 다시 받아 사라지게 한다
- if (res.result?.code === NOT_FOUND) queryClient.invalidateQueries({ queryKey: commentListKey(to) });
- else setLikeFailed(true);
- },
- onError: () => {
- revert();
- setLikeFailed(true);
- },
- },
- );
- };
-
- // 지우는 동안은 흐리게 두고, 성공하면 다시 받기 전에 목록 캐시에서 바로 뺀다
- const del = () => {
- setRemoveFailed(false);
- remove.mutate(
- { path: { comment_id: c.comment_id } },
- {
- onSuccess: async (res) => {
- if (!res.result?.success) return setRemoveFailed(true);
- const key = commentListKey(to);
- await queryClient.cancelQueries({ queryKey: key });
- queryClient.setQueryData>(key, (data) =>
- data ? { ...data, pages: data.pages.map((p) => ({ ...p, comments: p.comments?.filter((x) => x.comment_id !== c.comment_id) })) } : data,
- );
- queryClient.invalidateQueries({ queryKey: key });
- if ('talkId' in to) queryClient.invalidateQueries({ predicate: isTalkList });
- else queryClient.invalidateQueries({ queryKey: getFeedQueryKey({ query: { region: region.code } }) });
- },
- onError: () => setRemoveFailed(true),
- },
- );
- };
-
- return (
-
-
-
-
- {c.nickname}
- {c.official && (
- <>
- {' 날씨각 '}{' '}
- >
- )}
- {c.body}
-
-
-
- {ago(c.created_at)} · {likeFailed ? 좋아요를 못 했어요. 잠시 뒤에 다시 눌러 주세요 : `좋아요 ${count}개`}
- {c.mine && (
- <>
- {' · '}
-
- {remove.isPending ? '지우는 중…' : removeFailed ? '못 지웠어요 · 다시' : '지우기'}
-
- >
- )}
-
- {/* 날씨각 캐릭터 댓글은 운영 문구라 신고·차단 메뉴가 없다 */}
- {!c.mine && !c.official && }
-
-
-
-
-
-
- );
-}
-
-/** 포스트 댓글, 또는 사람 글 댓글(로그인한 사람만 쓴다) */
-export function CommentsSheet({ to, draft }: { to: CommentTarget; draft?: string }) {
- const { region } = useRegion();
- const { me } = useAuth();
- const { open } = useSheet();
- const queryClient = useQueryClient();
- const talkId = 'talkId' in to ? to.talkId : undefined;
- const postId = 'postId' in to ? to.postId : undefined;
- // 둘 중 하나만 받는다
- const postList = useInfiniteQuery({
- ...listCommentsInfiniteOptions({ path: { post_id: postId ?? 0 } }),
- initialPageParam: { path: { post_id: postId ?? 0 } },
- getNextPageParam: (last) => last.next_cursor ?? undefined,
- enabled: postId != null,
- });
- const talkList = useInfiniteQuery({
- ...listTalkCommentsInfiniteOptions({ path: { talk_id: talkId ?? 0 } }),
- initialPageParam: { path: { talk_id: talkId ?? 0 } },
- getNextPageParam: (last) => last.next_cursor ?? undefined,
- enabled: talkId != null,
- });
- const list = talkId != null ? talkList : postList;
- const addPost = useMutation(addCommentMutation());
- const addTalk = useMutation(addTalkCommentMutation());
- const add = { isPending: addPost.isPending || addTalk.isPending };
- const agree = useMutation(agreeTermsMutation());
- const s = useSoft();
- const [addFailed, setAddFailed] = useState(false);
- const [askTerms, setAskTerms] = useState(false);
- const [notice, setNotice] = useState('');
- const [text, setText] = useState(draft ?? '');
- const inputRef = useRef(null);
- const comments = list.data?.pages.flatMap((p) => p.comments ?? []) ?? [];
-
- useEffect(() => {
- if (!notice) return;
- const t = setTimeout(() => setNotice(''), 3000);
- return () => clearTimeout(t);
- }, [notice]);
-
- const send = () => {
- const body = text.trim();
- if (!body || add.isPending) return;
- setAddFailed(false);
- const handlers = {
- onSuccess: (res: { result?: { success?: boolean; desc?: string } }) => {
- if (res.result?.desc === 'TERMS_REQUIRED') return setAskTerms(true);
- setAddFailed(!res.result?.success);
- if (!res.result?.success) return;
- setText('');
- queryClient.invalidateQueries({ queryKey: commentListKey(to) });
- if (talkId != null) {
- track('talk_comment', { talk_id: talkId });
- queryClient.invalidateQueries({ predicate: isTalkList });
- } else if (postId != null) {
- track('comment', { post_id: postId });
- queryClient.invalidateQueries({ queryKey: getFeedQueryKey({ query: { region: region.code } }) });
- }
- },
- onError: () => setAddFailed(true),
- };
- if (talkId != null) addTalk.mutate({ path: { talk_id: talkId }, body: { body } }, handlers);
- else if (postId != null) addPost.mutate({ path: { post_id: postId }, body: { body, region: region.code } }, handlers);
- };
-
- // 댓글은 로그인 없이 '○○구 익명'으로 쓴다. 로그인했으면 약관에 동의해야 쓸 수 있고, 동의하면 쓰던 댓글을 바로 올린다
- const submit = () => {
- if (talkId != null && !me) return open({ type: 'login', then: { type: 'comments', ...to, draft: text } });
- if (me && !me.terms_agreed) return setAskTerms(true);
- send();
- };
- const agreeAndSend = () => {
- setAddFailed(false);
- agree.mutate(
- {},
- {
- onSuccess: (res) => {
- if (!res.result?.success) return setAddFailed(true);
- queryClient.setQueryData(meQueryKey(), res);
- track('terms_agree', {});
- setAskTerms(false);
- send();
- },
- onError: () => setAddFailed(true),
- },
- );
- };
-
- return (
- <>
-
- {comments.length ? (
- <>
- {/* 다시 받은 좋아요 상태(로그인 바뀜 등)가 행에 반영되도록 key 에 넣는다 */}
- {comments.map((c) => (
-
- ))}
- {list.hasNextPage && (
- list.fetchNextPage()} disabled={list.isFetchingNextPage} className="my-2 disabled:opacity-50">
- {list.isFetchingNextPage ? '불러오는 중…' : '댓글 더 보기'}
-
- )}
- >
- ) : loadOf(list) === 'loading' ? (
-
- ) : (
- list.refetch()} empty="아직 댓글이 없어요. 첫 댓글을 남겨 보세요." hold={} boxClassName="inset-0" />
- )}
-
- {askTerms ? (
-
- 댓글을 쓰려면 이용약관에 동의해 주세요. 욕설·광고·개인정보 노출은 숨겨지고, 계속되면 이용이 제한돼요.
-
- void Linking.openURL(`${SITE_URL}/terms.html`)} accessibilityRole="link" className="flex-1 rounded-[12px] bg-card p-2.5">
- 이용약관 보기
-
-
- 동의하고 쓰기
-
-
-
- ) : (
-
- {EMOJIS.map((e) => (
- {
- setText((t) => (t + e).slice(0, 60));
- inputRef.current?.focus();
- }}
- >
- {e}
-
- ))}
-
- )}
- {addFailed ? : {notice}}
-
-
-
-
-
- {add.isPending ? '올리는 중…' : '게시'}
-
-
- >
- );
-}
diff --git a/mobile/src/components/sheets/gak.tsx b/mobile/src/components/sheets/gak.tsx
deleted file mode 100644
index 29202db..0000000
--- a/mobile/src/components/sheets/gak.tsx
+++ /dev/null
@@ -1,229 +0,0 @@
-import { getIndexOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import type { Factor, ResIndexDetail } from '@nalssigak/shared/api/client/types.gen';
-import { loadOf } from '@nalssigak/shared/lib';
-import { useQuery } from '@tanstack/react-query';
-import { LinearGradient } from 'expo-linear-gradient';
-import { useEffect, useRef } from 'react';
-import { View } from 'react-native';
-import { Text } from '@/components/text';
-import Svg, { Circle, Line, Polygon, Text as SvgText, TSpan } from 'react-native-svg';
-
-import { Ic, Skel, StateBox } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useRegion } from '@/lib/region';
-import { useSky } from '@/lib/sky';
-
-import { Body, useSoft } from './parts';
-
-const SLOT_KEYS = ['morning', 'day', 'evening', 'night'] as const;
-const SLOT_NAMES = { morning: '아침', day: '낮', evening: '저녁', night: '밤' } as const;
-const N4 = [0, 1, 2, 3];
-const N6 = [0, 1, 2, 3, 4, 5];
-
-const labelLines = (label: string) => {
- const cut = label.indexOf(' ');
- return cut < 0 ? [label] : [label.slice(0, cut), label.slice(cut + 1)];
-};
-
-function Radar({ name, factors, size = 250 }: { name: string; factors: Factor[]; size?: number }) {
- const night = useSky().kind === 'night';
- const c = size / 2;
- const r = size / 2 - 40;
- const n = factors.length;
- const pt = (i: number, v: number) => {
- const a = -Math.PI / 2 + (i * 2 * Math.PI) / n;
- return [c + Math.cos(a) * r * v, c + Math.sin(a) * r * v] as const;
- };
- const ring = (v: number) => factors.map((_, i) => pt(i, v).join(',')).join(' ');
- return (
-
-
-
- );
-}
-
-function GakSkel() {
- const s = useSoft();
- return (
-
-
-
-
-
-
-
-
-
-
-
- {N4.map((i) => (
-
-
-
-
- ))}
-
-
- {N6.map((i) => (
-
-
-
-
-
- ))}
-
-
- );
-}
-
-export function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: string) => void }) {
- const { region } = useRegion();
- const s = useSoft();
- const q = useQuery(getIndexOptions({ path: { index_id: indexId }, query: { region: region.code } }));
- const d: ResIndexDetail | undefined = q.data;
- const g = d?.index;
-
- useEffect(() => {
- onTitle(g ? `${g.rank}위 ${g.name}` : '계산 근거');
- }, [g, onTitle]);
-
- // 지역이 바뀌어 다시 받아도 한 번만 보낸다
- const tracked = useRef(0);
- useEffect(() => {
- if (!g || tracked.current === g.index_id) return;
- tracked.current = g.index_id;
- track('view_gak', { index_id: g.index_id, gak_name: g.name, score: g.score, rank: g.rank });
- }, [g]);
-
- const load = loadOf(q);
- if (!g) return {load === 'loading' ? : q.refetch()} empty="이 각의 계산 근거가 아직 없어요." hold={} boxClassName="inset-0" />};
- const factors = d.factors ?? [];
- const bands = d.bands ?? [];
- const now = bands.find((b) => b.current);
- return (
-
-
-
-
- {g.name}
- {!!d.description && {d.description}}
-
- {g.score}
-
- {!g.active && 지금 시간대엔 해당 없어요. 점수는 오늘 가장 좋은 시간대 기준이에요.}
- {now && (
-
-
- {now.low}~{now.high}점{' '}
-
- {now.text}
-
- )}
- {factors.length > 2 && }
- {g.slots && g.slots.length > 0 && (
-
- {SLOT_KEYS.map((k) => {
- const sl = g.slots?.find((x) => x.slot === k);
- const cur = g.active && g.slot === k;
- return (
-
-
- {SLOT_NAMES[k]}
- {cur && ' · 지금'}
-
- {sl ? sl.score : '–'}
-
- );
- })}
-
- )}
- {g.trend && g.trend.length > 0 && (
-
- {g.trend.map((t) => (
-
-
- {t.label}
-
- {t.score}
- 예상
-
- ))}
-
- )}
- {bands.length > 0 && (
-
- {bands.map((b) => (
-
-
-
- {b.low}~{b.high}
-
-
- {b.text}
-
- ))}
-
- )}
-
- {factors.map((f) => (
-
-
- {f.label}
-
-
-
- 비중 {f.weight}%
-
- {f.note}
-
- ))}
-
-
- {!!d.zero_reason && (
-
- 오늘 걸린 조건: {d.zero_reason}
-
- )}
- {factors.length > 0 && (
-
- 계산 방법: 요소 점수에 비중을 곱해 더하고, 가장 낮은 요소가 낮을수록 최대 25%까지 더 깎아요
-
- )}
- {!!d.zero_rules && (
-
- 점수 깎이는 조건: {d.zero_rules}
-
- )}
- {!!d.limit && (
-
- 반영 못 한 것: {d.limit}
-
- )}
-
-
- );
-}
diff --git a/mobile/src/components/sheets/google.tsx b/mobile/src/components/sheets/google.tsx
deleted file mode 100644
index ee3f776..0000000
--- a/mobile/src/components/sheets/google.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { authConfigOptions, googleLoginMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import type { ResAuth } from '@nalssigak/shared/api/client/types.gen';
-import { GoogleSignin, isErrorWithCode, isSuccessResponse, statusCodes } from '@react-native-google-signin/google-signin';
-import { useMutation, useQuery } from '@tanstack/react-query';
-import { useState } from 'react';
-import { Platform, Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-
-/** 구글로 계속하기. 서버에 클라이언트 ID가 없거나 안드로이드가 아니면 그리지 않는다 */
-export function GoogleButton({ onResult, onFail }: { onResult: (res: ResAuth) => void; onFail: () => void }) {
- const clientId = useQuery({ ...authConfigOptions(), staleTime: Infinity, enabled: Platform.OS === 'android' }).data?.google_client_id;
- const login = useMutation(googleLoginMutation());
- const [busy, setBusy] = useState(false);
- const [broken, setBroken] = useState(false);
-
- const press = async () => {
- if (!clientId) return;
- setBroken(false);
- setBusy(true);
- try {
- GoogleSignin.configure({ webClientId: clientId });
- await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true });
- const res = await GoogleSignin.signIn();
- if (!isSuccessResponse(res)) return;
- const token = res.data.idToken;
- if (!token) return onFail();
- login.mutate({ body: { credential: token } }, { onSuccess: onResult, onError: onFail });
- } catch (e) {
- if (isErrorWithCode(e) && e.code === statusCodes.IN_PROGRESS) return;
- console.error('[google] sign in', e);
- setBroken(true);
- } finally {
- setBusy(false);
- }
- };
-
- if (Platform.OS !== 'android' || !clientId) return null;
- const pending = busy || login.isPending;
- return (
-
-
- {pending ? '구글로 로그인 중…' : '구글로 계속하기'}
-
- {broken && 구글 로그인을 하지 못했어요. 잠시 뒤에 다시 해 주세요.}
-
- );
-}
diff --git a/mobile/src/components/sheets/index.tsx b/mobile/src/components/sheets/index.tsx
deleted file mode 100644
index 5ccdb37..0000000
--- a/mobile/src/components/sheets/index.tsx
+++ /dev/null
@@ -1,109 +0,0 @@
-import { subscribeAuth } from '@nalssigak/shared/api/auth';
-import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react';
-import { KeyboardAvoidingView, Modal, Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from 'react-native-reanimated';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
-
-import { MixSheet, MyGakSheet } from '@/components/my-gak/my-gak';
-import { track } from '@/lib/analytics';
-import { SheetContext, useSheet, type SheetState } from '@/lib/sheet';
-
-import { ArticleSheet, SeasonWeekSheet } from './article';
-import { CommentsSheet } from './comments';
-import { GakSheet } from './gak';
-import { LevelSheet, LevelUpSheet } from './level';
-import { LoginSheet } from './login';
-import { MeSheet } from './me';
-import { RegionSheet } from './region';
-import { WeatherWhySheet } from './weather-why';
-
-export function SheetProvider({ children }: { children: ReactNode }) {
- const [state, setState] = useState(null);
- const open = useCallback((s: Exclude) => {
- track('sheet_open', { sheet: s.type });
- setState(s);
- }, []);
- const close = useCallback(() => setState(null), []);
- const api = useMemo(() => ({ open, close }), [open, close]);
-
- // 로그인이 필요한 요청이 401을 받으면 로그인 창을 띄운다
- useEffect(() => subscribeAuth((reason) => reason === 'required' && open({ type: 'login' })), [open]);
-
- return (
-
- {children}
-
-
- );
-}
-
-const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기', weatherWhy: '날씨 점수는 이렇게 나와요', level: '내 레벨', levelUp: '레벨이 올랐어요' } as const;
-
-/** 판만 아래에서 올라온다 (웹 b-sheet: 0.26초, 40px 아래·흐릿하게에서) */
-function Rise({ children }: { children: ReactNode }) {
- const reduce = useReducedMotion();
- const p = useSharedValue(reduce ? 1 : 0);
- useEffect(() => {
- p.value = withTiming(1, { duration: 260, easing: Easing.bezier(0.2, 0.9, 0.3, 1) });
- }, [p]);
- const anim = useAnimatedStyle(() => ({ opacity: 0.4 + 0.6 * p.value, transform: [{ translateY: 40 * (1 - p.value) }] }));
- return {children};
-}
-
-/** 아래에서 올라오는 창. 배경은 제자리에서 서서히. 바깥을 누르거나 뒤로 가기(안드로이드)로 닫는다 */
-function SheetHost({ state: next, onClose }: { state: SheetState; onClose: () => void }) {
- // 닫는 동안(배경이 사라지는 동안)에도 마지막 내용을 그대로 보여 준다. 열 때마다 판을 새로 올린다
- const [last, setLast] = useState(next);
- const [isOpen, setIsOpen] = useState(next != null);
- const [opens, setOpens] = useState(0);
- if (next && next !== last) setLast(next);
- if ((next != null) !== isOpen) {
- setIsOpen(next != null);
- if (next) setOpens((n) => n + 1);
- }
- const state = next ?? last;
- const { open } = useSheet();
- const { bottom } = useSafeAreaInsets();
- const [gakTitle, setGakTitle] = useState('');
- const [articleTitle, setArticleTitle] = useState('');
-
- const then = state?.type === 'login' ? state.then : undefined;
- const title = !state ? '' : state.type === 'gak' ? gakTitle : state.type === 'article' ? articleTitle || TITLES.article : state.type === 'mix' ? (state.shared ? '받은 각' : '내 각 만들기') : state.type === 'myGak' ? '내 각' : TITLES[state.type];
-
- return (
-
- {/* 안드로이드도 화면 끝까지 그려(edge-to-edge) 창이 줄지 않으니 양쪽 모두 키보드 높이만큼 밀어 올린다 */}
-
-
- {state && (
-
-
-
-
-
- {title}
-
-
- ×
-
-
- {state.type === 'gak' && }
- {state.type === 'article' && }
- {state.type === 'seasonWeek' && }
- {state.type === 'comments' && }
- {state.type === 'login' && open(then) : onClose} why={state.why} />}
- {state.type === 'me' && }
- {state.type === 'region' && }
- {state.type === 'weatherWhy' && }
- {state.type === 'level' && }
- {state.type === 'mix' && }
- {state.type === 'myGak' && }
- {state.type === 'levelUp' && }
-
-
- )}
-
-
- );
-}
diff --git a/mobile/src/components/sheets/level.tsx b/mobile/src/components/sheets/level.tsx
deleted file mode 100644
index f49241c..0000000
--- a/mobile/src/components/sheets/level.tsx
+++ /dev/null
@@ -1,138 +0,0 @@
-import { LinearGradient } from 'expo-linear-gradient';
-import { Pressable, View } from 'react-native';
-
-import { Text } from '@/components/text';
-import { Ic } from '@/components/ui';
-import { HIDDEN, josa, levelIcon, nextUnlock, progress, useCloseAndGo, useLevel } from '@/lib/level';
-import { useSheet } from '@/lib/sheet';
-
-import { Body, useSoft } from './parts';
-
-// 각을 주는 일 → 그 일을 하러 가는 곳, 숨긴 기능에 딸린 일 (서버 ACTIONS 키, 웹 level.tsx)
-const ACTION_TO: Record = { saju: '/saju', react: '/', talk: '/talk' };
-const ACTION_FEATURE: Record = { tarot: 'tarot', checkin: 'tarot' };
-
-function Bar({ value }: { value: number }) {
- const s = useSoft();
- return (
-
-
-
- );
-}
-
-/** 내 정보 위쪽: 레벨·모은 각·다음 레벨에서 열리는 것. link 가 있으면 '각 모으는 법'으로 내 레벨 창을 연다 */
-export function LevelCard({ link = true }: { link?: boolean }) {
- const level = useLevel().data;
- const { open } = useSheet();
- const s = useSoft();
- if (!level) return null;
- const unlock = nextUnlock(level);
- return (
-
-
-
-
- Lv.{level.level} {level.name}
-
- {level.points}각
-
-
-
-
-
-
- {level.next_points == null
- ? '가장 높은 레벨이에요'
- : unlock.length > 0
- ? `${level.next_points - level.points}각 더 모으면 ${josa(unlock.join(', '), '이', '가')} 열려요`
- : `${level.next_points - level.points}각 더 모으면 Lv.${level.level + 1} ${level.next_name}`}
-
- {link && (
- open({ type: 'level' })} hitSlop={8} accessibilityRole="button">
- 각 모으는 법 ›
-
- )}
-
-
- );
-}
-
-/** 내 레벨 창: 오늘 받을 수 있는 각, 레벨마다 열리는 것 */
-export function LevelSheet() {
- const level = useLevel().data;
- const go = useCloseAndGo();
- const s = useSoft();
- if (!level) return null;
- const steps = (level.unlocks ?? []).reduce>((m, u) => ({ ...m, [u.level]: [...(m[u.level] ?? []), u.name] }), {});
- const actions = (level.today ?? []).filter((a) => !HIDDEN.has(ACTION_FEATURE[a.action] ?? a.action));
- return (
-
-
-
- 오늘 받을 수 있는 각
-
- {actions.map((a, i) => {
- const done = a.earned >= a.cap;
- const to = ACTION_TO[a.action];
- return (
- to && go(to)} className={`flex-row items-center gap-2.5 px-3.5 py-2.5 ${i < actions.length - 1 ? 'border-b border-line' : ''}`}>
- {done && ✓}
- {a.name}
- {done ? `오늘 ${a.earned}각 받음` : a.earned > 0 ? `${a.earned}/${a.cap}각` : `+${a.points}각`}
- {!!to && !done && ›}
-
- );
- })}
-
- {level.streak > 0 ? `${level.streak}일째 연속 출석 중 · 7일 연속이면 +50각` : '7일 연속 출석하면 +50각을 더 받아요'}
-
-
- 레벨이 오르면 열려요
-
- {(level.levels ?? []).map(({ level: lv, name, points }) => {
- const reached = level.level >= lv;
- return (
-
-
-
-
- Lv.{lv} {name} · {points}각
-
- {lv === 1 ? '날씨각의 기본 기능 모두' : (steps[lv] ?? []).join(', ')}
-
-
- );
- })}
-
-
-
- );
-}
-
-/** 레벨이 오른 순간 */
-export function LevelUpSheet({ level: lv }: { level: number }) {
- const level = useLevel().data;
- const { open } = useSheet();
- const go = useCloseAndGo();
- const unlocks = (level?.unlocks ?? []).filter((u) => u.level === lv);
- const opened = unlocks.map((u) => u.name);
- const name = level?.levels?.find((l) => l.level === lv)?.name;
- return (
-
-
-
- Lv.{lv} {name}
-
- {opened.length > 0 && 이제 {josa(opened.join(', '), '을', '를')} 볼 수 있어요}
- {unlocks.length > 0 && (
- go(`/saju?open=${unlocks[0].key}`)} className="mt-3 w-full rounded-full bg-orange py-3">
- {opened[0]} 보러 가기
-
- )}
- open({ type: 'level' })} className={`w-full py-2 ${unlocks.length ? '' : 'mt-3 rounded-full bg-orange py-3'}`}>
- 내 레벨 보기
-
-
- );
-}
diff --git a/mobile/src/components/sheets/login.tsx b/mobile/src/components/sheets/login.tsx
deleted file mode 100644
index 7b84cce..0000000
--- a/mobile/src/components/sheets/login.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { setTokens } from '@nalssigak/shared/api/auth';
-import type { ResAuth } from '@nalssigak/shared/api/client/types.gen';
-import { useState } from 'react';
-import { Pressable } from 'react-native';
-
-import { Text } from '@/components/text';
-import { track } from '@/lib/analytics';
-import { useAuth } from '@/lib/auth';
-
-import { GoogleButton } from './google';
-import { MeSheet } from './me';
-import { Body, ErrorLine } from './parts';
-
-export function LoginSheet({ onDone, onLoggedIn, why }: { onDone: () => void; onLoggedIn: () => void; why?: 'level' }) {
- const { me } = useAuth();
- const [error, setError] = useState('');
-
- const done = (res: ResAuth) => {
- if (!res.result?.success || !res.access_token) {
- setError('구글로 로그인하지 못했어요. 다시 해 주세요.');
- return;
- }
- setTokens(res.access_token, res.refresh_token ?? null);
- track(res.is_new ? 'sign_up' : 'login', { method: 'google' });
- onLoggedIn();
- };
- const fail = () => setError('서버에 닿지 못했어요. 잠시 뒤에 다시 해 주세요.');
-
- if (me) return ;
-
- return (
-
- {why === 'level' ? '로그인하면 출석·사주·좋아요로 각이 쌓여 레벨이 올라요.' : '글쓰기는 로그인한 뒤에 할 수 있어요.'}
- {
- setError('');
- done(res);
- }}
- onFail={fail}
- />
-
-
- 나중에 할게요
-
-
- );
-}
diff --git a/mobile/src/components/sheets/me.tsx b/mobile/src/components/sheets/me.tsx
deleted file mode 100644
index db4e49b..0000000
--- a/mobile/src/components/sheets/me.tsx
+++ /dev/null
@@ -1,221 +0,0 @@
-import { clearTokens } from '@nalssigak/shared/api/auth';
-import { listBlockedOptions, listBlockedQueryKey, meQueryKey, unblockMutation, updateMeMutation, withdrawMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { AuthProvider } from '@nalssigak/shared/api/client/types.gen';
-import { AVATAR_COLORS, CHARACTERS, MOODS } from '@nalssigak/shared/lib';
-import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
-import { useState } from 'react';
-import { Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-
-import { Avatar, Ic } from '@/components/ui';
-import { MyTalks } from '@/components/talk/talk';
-import { useAuth } from '@/lib/auth';
-
-import { isCommentList } from './comments';
-import { LevelCard } from './level';
-import { Body, Field, useSoft } from './parts';
-
-/** 탈퇴: 한 번 더 묻고 지운다. 계정이 없어지니 이 기기 토큰도 지운다 */
-function Withdraw({ onDone }: { onDone: () => void }) {
- const withdraw = useMutation(withdrawMutation());
- const [asking, setAsking] = useState(false);
- const [failed, setFailed] = useState(false);
- if (!asking)
- return (
- setAsking(true)} hitSlop={8} className="self-center p-1">
- 탈퇴하기
-
- );
- const run = () => {
- setFailed(false);
- withdraw.mutate(
- {},
- {
- onSuccess: (res) => {
- if (!res.result?.success) return setFailed(true);
- clearTokens();
- onDone();
- },
- onError: () => setFailed(true),
- },
- );
- };
- return (
-
- {'탈퇴하면 계정과 남긴 댓글·좋아요가\n모두 지워져요. 되돌릴 수 없어요.'}
-
- setAsking(false)} disabled={withdraw.isPending} className="flex-1 rounded-[14px] bg-card p-3">
- 그만둘게요
-
-
- 탈퇴할게요
-
-
- {failed && 탈퇴하지 못했어요. 잠시 뒤에 다시 해 주세요.}
-
- );
-}
-
-/** 차단한 사람: 있을 때만 보이고, 풀면 그 사람 댓글이 다시 보인다 */
-function Blocked() {
- const s = useSoft();
- const queryClient = useQueryClient();
- const list = useQuery(listBlockedOptions());
- const unblock = useMutation(unblockMutation());
- const [failed, setFailed] = useState(false);
- const users = list.data?.users ?? [];
- if (!users.length) return null;
- const release = (user_id: string) => {
- setFailed(false);
- unblock.mutate(
- { path: { user_id } },
- {
- onSuccess: (res) => {
- if (!res.result?.success) return setFailed(true);
- queryClient.invalidateQueries({ queryKey: listBlockedQueryKey() });
- queryClient.invalidateQueries({ predicate: isCommentList });
- },
- onError: () => setFailed(true),
- },
- );
- };
- return (
-
- 차단한 사람
-
- {users.map((u) => (
-
-
- {u.nickname}
- release(u.user_id)} disabled={unblock.isPending} className="rounded-[12px] px-3 py-2 disabled:opacity-50" style={{ backgroundColor: s.soft }}>
- 풀기
-
-
- ))}
-
- {failed && 잠시 뒤에 다시 해 주세요.}
-
- );
-}
-
-/** 내 정보: 캐릭터·배경색·기분·닉네임·로그아웃·차단한 사람·탈퇴 */
-export function MeSheet({ onDone }: { onDone: () => void }) {
- const { me, logout } = useAuth();
- const s = useSoft();
- const queryClient = useQueryClient();
- const update = useMutation(updateMeMutation());
- const [nickname, setNickname] = useState(me?.nickname ?? '');
- const [error, setError] = useState('');
- if (!me) return null;
-
- const save = (body: { nickname?: string; character?: string; color?: string; mood?: string }) => {
- setError('');
- update.mutate(
- { body },
- {
- onSuccess: (res) => {
- if (!res.result?.success) return setError(res.result?.desc === 'INVALID_INPUT' ? '닉네임은 2~12자로 써 주세요.' : '잠시 뒤에 다시 해 주세요.');
- queryClient.setQueryData(meQueryKey(), res);
- // 댓글에 보이는 내 캐릭터·닉네임도 바뀐다
- queryClient.invalidateQueries({ predicate: (q) => (q.queryKey[0] as { _id?: string } | undefined)?._id === 'listComments' });
- },
- onError: () => setError('서버에 닿지 못했어요. 잠시 뒤에 다시 해 주세요.'),
- },
- );
- };
-
- // 저장하는 동안은 고른 값을 바로 선택으로 보여 준다. 실패하면 me 값으로 돌아간다
- const saving = update.isPending ? update.variables?.body : undefined;
- const character = saving?.character ?? me.character;
- const color = saving?.color ?? me.color;
- const mood = saving?.mood ?? me.mood;
- const nick = nickname.trim();
-
- return (
-
-
-
- {me.provider === AuthProvider.GOOGLE ? '구글 계정으로 로그인했어요' : `${me.login_id}(으)로 로그인했어요`}
-
-
-
- 내 캐릭터
-
- {CHARACTERS.map(([key, label]) => (
- save({ character: key })}
- className={`items-center gap-1 rounded-[18px] border-2 py-2.5 ${character === key ? 'border-orange' : 'border-transparent'}`}
- style={{ width: '31.5%', backgroundColor: s.field }}
- >
-
- {label}
-
- ))}
-
-
-
- 배경색
-
- {Object.entries(AVATAR_COLORS).map(([key, hex]) => (
- save({ color: key })}
- className={`size-9 rounded-full border-[3px] ${color === key ? 'border-ink' : 'border-white'}`}
- style={{ backgroundColor: hex }}
- />
- ))}
-
-
-
- 오늘 기분
-
- {MOODS.map(([key, emoji, label]) => (
- save({ mood: mood === key ? '' : key })}
- className={`items-center gap-0.5 rounded-[14px] border-2 py-2 ${mood === key ? 'border-orange' : 'border-transparent'}`}
- style={{ width: '23%', backgroundColor: s.field }}
- >
- {emoji}
- {label}
-
- ))}
-
- 한 번 더 누르면 지워져요
-
-
-
- nick.length >= 2 && save({ nickname: nick })} />
-
- save({ nickname: nick })} disabled={update.isPending || nick === me.nickname || nick.length < 2} className="rounded-[14px] bg-ink-btn px-4 py-3 disabled:opacity-40">
- {saving?.nickname != null ? '저장 중…' : '바꾸기'}
-
-
- {saving ? (saving.nickname == null ? '저장 중…' : '') : error}
-
- {
- logout();
- onDone();
- }}
- className="rounded-[14px] p-[13px]"
- style={{ backgroundColor: s.soft }}
- >
- 로그아웃
-
-
-
-
- );
-}
diff --git a/mobile/src/components/sheets/parts.tsx b/mobile/src/components/sheets/parts.tsx
deleted file mode 100644
index 0664030..0000000
--- a/mobile/src/components/sheets/parts.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import type { ReactNode, Ref } from 'react';
-import { ScrollView, TextInput, View, type TextInputProps } from 'react-native';
-import { Text } from '@/components/text';
-import Svg, { Path } from 'react-native-svg';
-
-import { Skel } from '@/components/ui';
-import { useSky } from '@/lib/sky';
-
-/** 웹의 연한 판(#f3f6fb)·입력칸·따뜻한 판(#fff4ec)을 밤엔 어두운 판으로 */
-export function useSoft() {
- const night = useSky().kind === 'night';
- return {
- soft: night ? '#2b3470' : '#f3f6fb',
- field: night ? '#2b3470' : '#f7f9fc',
- fieldBorder: night ? 'rgba(255,255,255,0.12)' : '#dfe5ee',
- warm: night ? 'rgba(255,138,87,0.16)' : '#fff4ec',
- bar: night ? 'rgba(255,255,255,0.12)' : '#e3eaf4',
- placeholder: night ? '#a1a9db' : '#8a92aa',
- };
-}
-
-export function Body({ children, className }: { children: ReactNode; className?: string }) {
- return (
-
- {children}
-
- );
-}
-
-/** 입력칸: 둥근 연한 판 */
-export function Field({ round = false, style, ...props }: TextInputProps & { round?: boolean; ref?: Ref }) {
- const s = useSoft();
- return (
-
- );
-}
-
-export function HeartIcon({ size, fill, stroke }: { size: number; fill: string; stroke: string }) {
- return (
-
- );
-}
-
-const N3 = [0, 1, 2];
-
-/** 읽을거리·이번 주 특집: 그림 150px · 머리말 · 제목 · 본문 */
-export function ArticleSkel() {
- return (
-
-
-
-
- {N3.map((k) => (
-
-
-
-
- ))}
-
- );
-}
-
-/** 빨간 안내 한 줄 (자리 높이는 그대로) */
-export function ErrorLine({ text, className }: { text?: string; className?: string }) {
- return {text ?? ''};
-}
diff --git a/mobile/src/components/sheets/region.tsx b/mobile/src/components/sheets/region.tsx
deleted file mode 100644
index 9d5b9d9..0000000
--- a/mobile/src/components/sheets/region.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import { listRegionsOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { loadOf } from '@nalssigak/shared/lib';
-import { useQuery } from '@tanstack/react-query';
-import { useDeferredValue, useEffect, useRef, useState } from 'react';
-import { Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-
-import { Skel, StateBox } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useAuth } from '@/lib/auth';
-import { useRegion } from '@/lib/region';
-import { useSheet } from '@/lib/sheet';
-
-import { Body, Field } from './parts';
-
-const LOCATE_TEXT = { idle: '', locating: '위치를 찾는 중이에요…', denied: '위치 권한이 꺼져 있어요. 아래 목록에서 골라 주세요.', error: '위치를 찾지 못했어요. 아래 목록에서 골라 주세요.' } as const;
-
-const N14 = Array.from({ length: 14 }, (_, i) => i);
-
-function RegionsSkel() {
- return (
-
- {N14.map((i) => (
-
-
-
- ))}
-
- );
-}
-
-/** 지역 바꾸기: 지금 위치로 찾기 + 구 이름으로 찾기 + 목록 */
-export function RegionSheet({ onDone }: { onDone: () => void }) {
- const { region, setRegion, locate, locateStatus } = useRegion();
- const alive = useRef(true);
- useEffect(() => {
- alive.current = true;
- return () => {
- alive.current = false;
- };
- }, []);
- const { me, logout } = useAuth();
- const { open } = useSheet();
- const [q, setQ] = useState('');
- const deferred = useDeferredValue(q.trim());
- const list = useQuery(listRegionsOptions(deferred ? { query: { q: deferred } } : undefined));
- const regions = list.data?.regions ?? [];
- const listLoad = loadOf(list);
-
- return (
-
- locate(() => alive.current && onDone())} disabled={locateStatus === 'locating'} className="items-center rounded-full border-b-[5px] border-orange-deep bg-orange p-3 disabled:opacity-60">
- 지금 위치로 찾기
-
-
- {LOCATE_TEXT[locateStatus]}
-
-
- {listLoad === 'loading' && }
- {listLoad !== 'loading' && !regions.length && (listLoad === 'ready' ? : list.refetch()} hold={} boxClassName="inset-x-0 top-2 bottom-0" />)}
-
- {regions.map((r) => {
- const here = r.code === region.code;
- return (
- {
- setRegion(r);
- track('region_change', { region_name: r.name, method: 'list' });
- onDone();
- }}
- className="flex-row items-center justify-between border-b-[1.5px] border-line px-1 py-3"
- >
- {r.name}
- {here && 지금 보는 곳}
-
- );
- })}
-
-
- {me ? `${me.nickname}(으)로 로그인했어요` : '로그인하면 좋아요·댓글을 쓸 수 있어요'}
- open({ type: 'login' })} hitSlop={8}>
- {me ? '로그아웃' : '로그인'}
-
-
-
- );
-}
diff --git a/mobile/src/components/sheets/weather-why.tsx b/mobile/src/components/sheets/weather-why.tsx
deleted file mode 100644
index 7435864..0000000
--- a/mobile/src/components/sheets/weather-why.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import type { WeatherWhy } from '@nalssigak/shared/api/client/types.gen';
-import { View } from 'react-native';
-
-import { Text } from '@/components/text';
-
-import { Body, useSoft } from './parts';
-
-/** status: 히어로 상태 줄 그대로 (단계 이름, 실제 값) */
-export type WeatherWhyPayload = { label: string; score: number; why: WeatherWhy[]; status?: { label: string; value: string; tone?: string; detail?: string | null }[] };
-
-// 조건마다 같은 색을 막대 칸과 아래 줄 점에 같이 써서 이어 보이게 (웹 weatherWhy.tsx)
-const COLOR: Record = { 기온: '#ff7a45', 비: '#4f97e3', 햇볕: '#ffb02e', 바람: '#5fb8b0', 습도: '#8e8cf0', 미세먼지: '#b59a86' };
-const colorOf = (label: string) => COLOR[label] ?? '#9aa3b8';
-
-// 상태 줄 항목마다 단계를 나누는 기준 (backend/services/hero_stats.py 와 같은 값)
-const RULE: Record = {
- 습도: '30% 아래는 건조, 60% 넘으면 습함이에요',
- 불쾌지수: '68 아래는 쾌적, 75부터 불쾌예요',
- 자외선: '3 아래는 낮음, 6부터 높음이에요',
- 미세먼지: '에어코리아 기준 등급이에요',
-};
-
-/** 날씨 점수 근거: 비중만큼 나눈 막대(채운 만큼 얻은 점수)와 조건별 지금 값 */
-export function WeatherWhySheet({ d }: { d: WeatherWhyPayload }) {
- const s = useSoft();
- return (
-
-
- {d.score}
- {d.label} 날씨 점수
-
-
- `${w.label} 비중 ${w.weight}% 중 ${w.score}점`).join(', ')}>
- {d.why.map((w) => (
-
-
-
- ))}
-
- 칸 넓이는 비중, 채운 만큼이 얻은 점수예요
-
-
- {d.why.map((w) => (
-
-
-
-
- {w.label} 비중 {w.weight}%
-
- {w.note}
-
- {w.score}
-
- ))}
-
-
- {!!d.status?.length && (
- <>
- 지금 상태
-
- {d.status.map((x) => (
-
-
- {x.label}
- {!!RULE[x.label] && {RULE[x.label]}}
-
-
-
- {x.value}
-
- {x.detail?.split(' · ').map((v) => (
-
- {v}
-
- ))}
-
-
- ))}
-
- >
- )}
-
- 조건마다 점수를 매겨 비중대로 합쳐요. 유난히 아쉬운 조건이 있으면 조금 더 깎고, 모든 조건이 완벽할 때만 만점이 나와요.
-
- );
-}
diff --git a/mobile/src/components/shorts/player.tsx b/mobile/src/components/shorts/player.tsx
deleted file mode 100644
index d00318d..0000000
--- a/mobile/src/components/shorts/player.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import { useImperativeHandle, useRef, type Ref } from 'react';
-import { WebView } from 'react-native-webview';
-
-import { SITE_URL } from '@/lib/site';
-
-const YT_ORIGIN = 'https://www.youtube-nocookie.com';
-
-export type PlayerFunc = 'playVideo' | 'seekTo' | 'mute' | 'unMute';
-export type PlayerHandle = { command: (func: PlayerFunc, args?: unknown[]) => void };
-
-function embed(id: string) {
- const q = new URLSearchParams({ autoplay: '1', mute: '1', playsinline: '1', loop: '1', playlist: id, controls: '0', rel: '0', modestbranding: '1', enablejsapi: '1', origin: SITE_URL });
- return `${YT_ORIGIN}/embed/${id}?${q}`;
-}
-
-/**
- * 유튜브 플레이어를 날씨각 주소를 기준으로 한 작은 문서 안 iframe 으로 띄운다.
- * 앱 웹뷰에서 embed 주소를 바로 열면 보낸 곳(Referer)이 없어 유튜브가 막는다. 웹과 같이 IFrame API 메시지로 재생 상태를 받고 명령한다
- */
-function html(id: string) {
- return `
-
-`;
-}
-
-/** 소리 없이 자동재생하는 쇼츠 플레이어. 첫 장면이 나오면 onPlaying (그 전엔 위에 표지를 덮어 둔다) */
-export function ShortPlayer({ id, onPlaying, ref }: { id: string; onPlaying: () => void; ref?: Ref }) {
- const view = useRef(null);
- useImperativeHandle(ref, () => ({
- command: (func, args = []) => view.current?.injectJavaScript(`window.cmd && window.cmd(${JSON.stringify(func)}, ${JSON.stringify(args)}); true;`),
- }));
- return (
- e.nativeEvent.data === 'playing' && onPlaying()}
- mediaPlaybackRequiresUserAction={false}
- allowsInlineMediaPlayback
- scrollEnabled={false}
- setSupportMultipleWindows={false}
- style={{ backgroundColor: 'transparent' }}
- />
- );
-}
diff --git a/mobile/src/components/shorts/rail.tsx b/mobile/src/components/shorts/rail.tsx
deleted file mode 100644
index 57f6cdb..0000000
--- a/mobile/src/components/shorts/rail.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { listShortsOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { useQuery } from '@tanstack/react-query';
-import { Image } from 'expo-image';
-import { LinearGradient } from 'expo-linear-gradient';
-import { Link } from 'expo-router';
-import { Pressable, View } from 'react-native';
-
-import { Text } from '@/components/text';
-import { Rail } from '@/components/ui';
-
-const SKELS = [0, 1, 2, 3];
-
-export const thumb = (id: string) => `https://i.ytimg.com/vi/${id}/hqdefault.jpg`;
-
-/** 오늘 화면 히어로 아래 쇼츠 줄. 누르면 쇼츠 화면에서 위아래로 넘겨 본다. 앱은 데이터를 아끼려고 줄에서는 표지만 (웹은 첫 카드를 소리 없이 재생) */
-export function ShortsRail() {
- const q = useQuery(listShortsOptions());
- const items = q.data?.items ?? [];
- if (q.isPending)
- return (
-
- {SKELS.map((i) => (
-
- ))}
-
- );
- if (!items.length) return null;
- return (
-
-
- {items.map((s) => (
-
-
-
-
-
- {s.title}
-
-
-
- ))}
-
-
- );
-}
diff --git a/mobile/src/components/sky-bg.tsx b/mobile/src/components/sky-bg.tsx
deleted file mode 100644
index e9df293..0000000
--- a/mobile/src/components/sky-bg.tsx
+++ /dev/null
@@ -1,121 +0,0 @@
-import type { TimeKind } from '@nalssigak/shared/lib';
-import { holidayOn, type Holiday } from '@nalssigak/shared/lib/holiday';
-import { Image } from 'expo-image';
-import { LinearGradient } from 'expo-linear-gradient';
-import { useEffect, useState } from 'react';
-import { StyleSheet, useWindowDimensions, View, type DimensionValue } from 'react-native';
-import Animated, { cancelAnimation, Easing, interpolate, useAnimatedStyle, useReducedMotion, useSharedValue, withDelay, withRepeat, withTiming } from 'react-native-reanimated';
-
-import { useSky } from '@/lib/sky';
-
-const KINDS: TimeKind[] = ['morning', 'day', 'sunset', 'night'];
-
-const SKY: Record = {
- morning: { colors: ['#ffe0c4', '#fff0e2', '#e4f2ff'], locations: [0, 0.38, 1] },
- day: { colors: ['#cde7ff', '#e9f5ff', '#f7fbff'], locations: [0, 0.45, 1] },
- sunset: { colors: ['#ffd0b5', '#f9c3cf', '#ddd2f6'], locations: [0, 0.42, 1] },
- night: { colors: ['#0e1433', '#1b2356', '#2a2e6e'], locations: [0, 0.5, 1] },
-};
-
-const STARS = Array.from({ length: 46 }, (_, i) => ({ left: `${(i * 41 + 7) % 100}%`, top: `${(i * 67 + 3) % 96}%`, size: 1 + (i % 3) * 0.8, period: (3 + (i % 5)) * 1000, delay: ((i * 0.7) % 6) * 1000 }) as const);
-
-/** 시간대 하나의 하늘 판. 고른 시간대만 1.4초 동안 서서히 드러난다 */
-function Layer({ kind, on, reduce }: { kind: TimeKind; on: boolean; reduce: boolean }) {
- const shown = useSharedValue(on ? 1 : 0);
- useEffect(() => {
- shown.value = reduce ? (on ? 1 : 0) : withTiming(on ? 1 : 0, { duration: 1400, easing: Easing.ease });
- }, [on, reduce, shown]);
- const style = useAnimatedStyle(() => ({ opacity: shown.value }));
- return (
-
-
-
- );
-}
-
-/** 밤 별: 제각각 주기로 반짝인다 */
-function Star({ star, reduce }: { star: (typeof STARS)[number]; reduce: boolean }) {
- const glow = useSharedValue(0);
- useEffect(() => {
- if (reduce) return;
- glow.value = withDelay(star.delay, withRepeat(withTiming(1, { duration: star.period / 2, easing: Easing.inOut(Easing.ease) }), -1, true));
- return () => cancelAnimation(glow);
- }, [reduce, glow, star]);
- const style = useAnimatedStyle(() => ({ opacity: reduce ? 0.7 : 0.25 + glow.value * 0.75 }));
- return ;
-}
-
-export type ShootSpec = { top: DimensionValue; left: DimensionValue; len: number; dur: number; dl: number };
-
-// 별똥별: 위치·길이·주기를 엇갈려 몇 초마다 하나씩 떨어지게 (웹 BLayout SHOOTS, 밀리초)
-const SHOOTS: ShootSpec[] = [
- { top: '8%', left: '78%', len: 110, dur: 7000, dl: 1000 },
- { top: '22%', left: '46%', len: 80, dur: 9000, dl: 3500 },
- { top: '5%', left: '30%', len: 95, dur: 8000, dl: 5500 },
- { top: '36%', left: '88%', len: 70, dur: 10000, dl: 2200 },
- { top: '52%', left: '62%', len: 90, dur: 11000, dl: 7000 },
- { top: '14%', left: '96%', len: 120, dur: 12000, dl: 9000 },
-];
-
-/** 별똥별 하나: 주기 끝 14% 동안만 비스듬히 240px 미끄러지며 반짝 (웹 .b-shoot). 동작 줄이기면 그리지 않는다 */
-export function Shoot({ top, left, len, dur, dl }: ShootSpec) {
- const reduce = useReducedMotion();
- const p = useSharedValue(0);
- useEffect(() => {
- if (reduce) return;
- p.value = withDelay(dl, withRepeat(withTiming(1, { duration: dur, easing: Easing.in(Easing.ease) }), -1, false));
- return () => cancelAnimation(p);
- }, [reduce, dur, dl, p]);
- const style = useAnimatedStyle(() => ({
- opacity: interpolate(p.value, [0, 0.86, 0.89, 1], [0, 0, 1, 0]),
- transform: [{ rotate: '-24deg' }, { translateX: interpolate(p.value, [0, 0.86, 1], [0, 0, -240]) }],
- }));
- if (reduce) return null;
- return (
-
-
-
- );
-}
-
-/** 화면 전체 하늘: 시간대별 색이 서서히 바뀌고, 밤에는 별이 반짝이고 별똥별이 떨어진다 */
-// 기념일 소품: 투명 배경 그림을 화면 네 귀퉁이에 (웹 b.css .b-sky-holiday, frontend/public/b/holiday, 4:5 그림)
-const PROPS: Record = {
- halloween: [require('../../../frontend/public/b/holiday/halloween-tl.webp'), require('../../../frontend/public/b/holiday/halloween-tr.webp'), require('../../../frontend/public/b/holiday/halloween-bl.webp'), require('../../../frontend/public/b/holiday/halloween-br.webp')],
- pepero: [require('../../../frontend/public/b/holiday/pepero-tl.webp'), require('../../../frontend/public/b/holiday/pepero-tr.webp'), require('../../../frontend/public/b/holiday/pepero-bl.webp'), require('../../../frontend/public/b/holiday/pepero-br.webp')],
- christmas: [require('../../../frontend/public/b/holiday/christmas-tl.webp'), require('../../../frontend/public/b/holiday/christmas-tr.webp'), require('../../../frontend/public/b/holiday/christmas-bl.webp'), require('../../../frontend/public/b/holiday/christmas-br.webp')],
- chuseok: [require('../../../frontend/public/b/holiday/chuseok-tl.webp'), require('../../../frontend/public/b/holiday/chuseok-tr.webp'), require('../../../frontend/public/b/holiday/chuseok-bl.webp'), require('../../../frontend/public/b/holiday/chuseok-br.webp')],
- suneung: [require('../../../frontend/public/b/holiday/suneung-tl.webp'), require('../../../frontend/public/b/holiday/suneung-tr.webp'), require('../../../frontend/public/b/holiday/suneung-bl.webp'), require('../../../frontend/public/b/holiday/suneung-br.webp')],
- newyear: [require('../../../frontend/public/b/holiday/newyear-tl.webp'), require('../../../frontend/public/b/holiday/newyear-tr.webp'), require('../../../frontend/public/b/holiday/newyear-bl.webp'), require('../../../frontend/public/b/holiday/newyear-br.webp')],
-};
-const CORNERS = [{ top: 0, left: 0 }, { top: 0, right: 0 }, { bottom: 0, left: 0 }, { bottom: 0, right: 0 }] as const;
-
-/** 기념일 기간에만 네 귀퉁이 소품. 폰은 반씩 나눠 폭을 채우고 넓은 화면은 300 으로. 밤엔 조금 어둡게 */
-function HolidayProps({ night }: { night: boolean }) {
- const [holiday] = useState(holidayOn);
- const { width } = useWindowDimensions();
- if (!holiday) return null;
- const w = Math.min(width / 2, 300);
- return (
- <>
- {PROPS[holiday.key].map((src, i) => (
-
- ))}
- >
- );
-}
-
-export function SkyBg() {
- const { kind } = useSky();
- const reduce = useReducedMotion();
- return (
-
- {KINDS.map((k) => (
-
- ))}
-
- {kind === 'night' && STARS.map((s, i) => )}
- {kind === 'night' && SHOOTS.map((s, i) => )}
-
- );
-}
diff --git a/mobile/src/components/sky/colors.ts b/mobile/src/components/sky/colors.ts
deleted file mode 100644
index 909d523..0000000
--- a/mobile/src/components/sky/colors.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-// 웹 b.css 노을 탭 그라데이션. 등급별 하늘색(히어로·3일 타일)과 시간표 막대
-type Grad = { colors: readonly [string, string, ...string[]]; locations?: readonly [number, number, ...number[]] };
-
-export const GRADE_SKY: Record = {
- 잿빛: { hero: { colors: ['#6f7690', '#9aa0b4', '#b9b4c0'], locations: [0, 0.55, 1] }, tile: { colors: ['#8f8aa5', '#b9b0bf'] } },
- 은은함: { hero: { colors: ['#4b5aa8', '#7f86c6', '#e9b9a8', '#ffb27a'], locations: [0, 0.4, 0.78, 1] }, tile: { colors: ['#7f86c6', '#e9b9a8', '#f6b07a'], locations: [0, 0.7, 1] } },
- 고움: { hero: { colors: ['#5b3f9e', '#c2559a', '#ff7a6a', '#ffb35c'], locations: [0, 0.45, 0.78, 1] }, tile: { colors: ['#5b3f9e', '#c2559a', '#ff7a6a'], locations: [0, 0.55, 1] } },
- 붉음: { hero: { colors: ['#4a2a8a', '#b0306a', '#ff4a3a', '#ff9a3c'], locations: [0, 0.4, 0.72, 1] }, tile: { colors: ['#4a2a8a', '#b0306a', '#ff4a3a'], locations: [0, 0.5, 1] } },
-};
-
-export const skyOf = (grade?: string | null) => GRADE_SKY[grade ?? ''] ?? GRADE_SKY['은은함'];
-
-export const RAIL = {
- sunset: { colors: ['#f2b84b', '#f6844e', '#e8506a', '#8c5aa6', '#2d3f8f'], locations: [0, 0.45, 0.62, 0.82, 1] },
- sunrise: { colors: ['#2d3f8f', '#8c5aa6', '#e8506a', '#f6844e', '#f2b84b'], locations: [0, 0.25, 0.45, 0.6, 1] },
-} satisfies Record;
diff --git a/mobile/src/components/sky/parts.tsx b/mobile/src/components/sky/parts.tsx
deleted file mode 100644
index 209c280..0000000
--- a/mobile/src/components/sky/parts.tsx
+++ /dev/null
@@ -1,190 +0,0 @@
-import type { BestTime, SkyPlanData } from '@nalssigak/shared/api/client/types.gen';
-import { clockShort } from '@nalssigak/shared/lib';
-import { LinearGradient } from 'expo-linear-gradient';
-import { useState, type ReactNode } from 'react';
-import { Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-import { useCSSVariable } from 'uniwind';
-
-import { RAIL, skyOf } from '@/components/sky/colors';
-import { SitSun, Skyline } from '@/components/sky/skyline';
-import { MapLink, Skel } from '@/components/ui';
-
-const SHADOW = { textShadowColor: 'rgb(50 25 70 / 0.35)', textShadowOffset: { width: 0, height: 2 }, textShadowRadius: 10 };
-const FOUR = [0, 1, 2, 3];
-
-/** 히어로엔 답만: 노을 피크 시각과 어떻게 물드는지. 상자는 불러오는 중·실패·빈 값 모두 같은 크기 */
-export function SkyHero({ plan, children }: { plan?: SkyPlanData; children?: ReactNode }) {
- const g = skyOf(plan?.grade_label).hero;
- return (
-
-
-
-
- {children ?? (
-
- {plan ? (
-
- {plan.title}
-
- ) : (
-
- )}
- {!plan ? (
-
- ) : plan.situation_label ? (
-
- {plan.situation_label}
-
- ) : null}
-
- )}
-
- );
-}
-
-/** 오늘·내일·모레를 그날 예상 하늘색 타일로. 누르면 그날로 */
-export function DayTiles({ plans, day, onPick }: { plans: SkyPlanData[]; day?: string; onPick: (day: string) => void }) {
- const ink = String(useCSSVariable('--color-ink'));
- return (
-
- {plans.map((p) => {
- const g = skyOf(p.grade_label).tile;
- const on = p.day === day;
- return (
- onPick(p.day)} className="flex-1 rounded-[18px] p-[2px]" style={{ borderWidth: 3, borderColor: on ? ink : 'transparent' }}>
-
-
- {p.when}
- {p.best_at ? clockShort(p.best_at) : '–'}
-
- {p.grade_label} {p.score}
-
-
-
- );
- })}
-
- );
-}
-
-function Toggle({ label, children, end }: { label: ReactNode; children: ReactNode; end?: boolean }) {
- const [open, setOpen] = useState(false);
- return (
-
- setOpen(!open)} accessibilityState={{ expanded: open }} className={`flex-row items-center gap-1.5 ${end ? 'justify-between' : ''}`}>
- {label}
-
- {open && children}
-
- );
-}
-
-const Q = ({ className = 'bg-card/80' }: { className?: string }) => (
-
- ?
-
-);
-
-/** 노을 점수 뜻. 지금 하늘이 아니라 해 질(뜰) 무렵 예보라는 것도 */
-export function ScoreHelp({ plan }: { plan: SkyPlanData }) {
- const sunAt = plan.timeline?.find((t) => t.kind === 'sun')?.at;
- const rise = plan.kind === 'sunrise';
- return (
-
-
- 노을 점수 100점 만점 · 높을수록 붉어요
-
- >
- }
- >
-
- 80점 넘으면 붉게, 60점 넘으면 곱게, 40점 넘으면 은은하게 물들어요.
- {sunAt && ` 해 ${rise ? '뜰' : '질'} 무렵(${new Date(sunAt).getHours()}시) 날씨 예보로 계산했고, 노을 피크 시각은 해 ${rise ? '뜨기 10~20분 전' : '지고 10~20분 뒤'}로 어림한 거라 실제와 다를 수 있어요.`}
-
-
-
- );
-}
-
-/** 언제 보면 좋을까: 왼쪽 세로 줄 색이 그 시각 하늘색, 노을 피크만 강조 */
-export function Timeline({ rows, kind = 'sunset' }: { rows?: BestTime[]; kind?: SkyPlanData['kind'] }) {
- const rail = RAIL[kind === 'sunrise' ? 'sunrise' : 'sunset'];
- const list = rows ?? FOUR.map(() => undefined);
- return (
-
-
-
-
- {list.map((t, i) => {
- const peak = t?.kind === 'peak';
- return (
-
-
- {t ? {t.end ? `${clockShort(t.at)}~${clockShort(t.end)}` : clockShort(t.at)} : }
-
- {t ? {t.label} : }
-
- );
- })}
-
-
- {rows && (
-
-
-
- 골든아워·블루아워가 뭐예요
- >
- }
- >
-
- 골든아워 해가 {kind === 'sunrise' ? '뜬 뒤' : '지기 전'}, 햇빛이 금빛으로 물드는 시간{'\n'}
- 블루아워 해가 {kind === 'sunrise' ? '뜨기 전' : '진 뒤'}, 하늘이 짙은 파랑으로 남는 시간
-
-
-
- )}
-
- );
-}
-
-const ROW = 'flex-row items-center gap-2.5 px-1 py-3';
-
-export function LiSkel({ ghost = false, last = false }: { ghost?: boolean; last?: boolean }) {
- return (
-
-
-
-
-
-
-
-
-
-
- );
-}
-
-/** 번호 · 이름(+설명) · 오른쪽 값 한 줄 */
-export function Li({ no, title, sub, right, mine = false, place, last = false }: { no: number; title: string; sub?: string | null; right: string; mine?: boolean; place?: string; last?: boolean }) {
- return (
-
- {no}
-
-
- {place ? {title} : title}
- {mine && 내 지역}
-
-
- {sub || ' '}
-
-
- {right}
-
- );
-}
diff --git a/mobile/src/components/sky/skyline.tsx b/mobile/src/components/sky/skyline.tsx
deleted file mode 100644
index 21eb8c7..0000000
--- a/mobile/src/components/sky/skyline.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { View } from 'react-native';
-import Svg, { Defs, Polygon, RadialGradient, Rect, Stop } from 'react-native-svg';
-
-// 웹 .b-skyline::after 의 clip-path 를 그대로 (0~100 비율)
-const POINTS = '0,55 8,55 8,30 15,30 15,50 22,50 22,10 28,10 28,45 36,45 36,25 44,25 44,55 52,55 52,35 60,35 60,5 66,5 66,40 74,40 74,20 82,20 82,50 90,50 90,30 100,30 100,100 0,100';
-
-/** 아래에 깔리는 동네 건물 실루엣. height 는 상자 높이 대비 비율 */
-export function Skyline({ height = '22%' }: { height?: `${number}%` }) {
- return (
-
-
-
- );
-}
-
-/** 건물 뒤로 지는 해 (.b-sit-sun) */
-export function SitSun({ size = 112, bottom = 24, opacity = 1 }: { size?: number; bottom?: number; opacity?: number }) {
- return (
-
-
-
- );
-}
diff --git a/mobile/src/components/svg.tsx b/mobile/src/components/svg.tsx
deleted file mode 100644
index 45ea166..0000000
--- a/mobile/src/components/svg.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import Svg, { Circle, Path, Rect } from 'react-native-svg';
-
-export type TabName = 'today' | 'gak' | 'sky' | 'week' | 'season';
-
-const line = { fill: 'none', strokeLinecap: 'round', strokeLinejoin: 'round' } as const;
-
-export function PinIcon({ size, color }: { size: number; color: string }) {
- return (
-
- );
-}
-
-export function TabIcon({ name, size, color, strokeWidth }: { name: TabName; size: number; color: string; strokeWidth: number }) {
- return (
-
- );
-}
diff --git a/mobile/src/components/tab-bar.tsx b/mobile/src/components/tab-bar.tsx
deleted file mode 100644
index 0ba38ec..0000000
--- a/mobile/src/components/tab-bar.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import type { BottomTabBarProps } from 'expo-router/tabs';
-import { LinearGradient } from 'expo-linear-gradient';
-import { Pressable, View } from 'react-native';
-import { Text } from '@/components/text';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { useCSSVariable } from 'uniwind';
-
-import { TabIcon, type TabName } from '@/components/svg';
-import { useSky } from '@/lib/sky';
-
-const LABELS: Record = {
- sky: ['sky', '노을'],
- gak: ['gak', '각'],
- index: ['today', '오늘'],
- week: ['week', '주말·행사'],
- season: ['season', '계절·상식'],
-};
-
-/** 아래 탭 막대. 가운데 오늘 탭은 막대 위로 솟은 큰 주황 동그라미 */
-export function TabBar({ state, navigation }: BottomTabBarProps) {
- const { bottom } = useSafeAreaInsets();
- const { kind } = useSky();
- const [ink, ink3, orange] = useCSSVariable(['--color-ink', '--color-ink3', '--color-orange']).map(String);
- const night = kind === 'night';
- return (
-
- {state.routes.map((route, i) => {
- const [icon, label] = LABELS[route.name] ?? ['today', route.name];
- const focused = state.index === i;
- const onPress = () => {
- const event = navigation.emit({ type: 'tabPress', target: route.key, canPreventDefault: true });
- if (!focused && !event.defaultPrevented) navigation.navigate(route.name);
- };
- if (icon === 'today')
- return (
-
-
-
-
-
-
-
- {label}
-
-
- );
- return (
-
-
-
- {label}
-
-
- );
- })}
-
- );
-}
diff --git a/mobile/src/components/talk/talk.tsx b/mobile/src/components/talk/talk.tsx
deleted file mode 100644
index b577601..0000000
--- a/mobile/src/components/talk/talk.tsx
+++ /dev/null
@@ -1,426 +0,0 @@
-import { addTalkMutation, blockTalkAuthorMutation, deleteTalkMutation, likeTalkMutation, reportTalkMutation, unlikeTalkMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
-import { uploadTalkImage } from '@nalssigak/shared/api/client/sdk.gen';
-import { TalkReport, TalkTopic, type TalkData } from '@nalssigak/shared/api/client/types.gen';
-import { holidayByTopic } from '@nalssigak/shared/lib/holiday';
-import { useMutation } from '@tanstack/react-query';
-import { Image } from 'expo-image';
-import * as ImagePicker from 'expo-image-picker';
-import { LinearGradient } from 'expo-linear-gradient';
-import { useRef, useState } from 'react';
-import { Pressable, TextInput, View } from 'react-native';
-import { useCSSVariable } from 'uniwind';
-
-import { CameraIcon, CommentIcon, HeartIcon, SendIcon } from '@/components/post/icons';
-import { useSoft } from '@/components/sheets/parts';
-import { Text } from '@/components/text';
-import { Avatar } from '@/components/ui';
-import { track } from '@/lib/analytics';
-import { useAuth } from '@/lib/auth';
-import { CARD_BG } from '@/lib/colors';
-import { useRegion } from '@/lib/region';
-import { useShare } from '@/lib/share-image';
-import { useSheet } from '@/lib/sheet';
-import { SITE_URL } from '@/lib/site';
-import { openTopics, talkImage, talkMeta, useMyTalks, useRefreshTalks } from '@/lib/talk';
-
-const BODY_MAX = 100;
-const PHOTO_MAX = 10 * 1024 * 1024;
-
-// 서버 ErrorType 이름 → 안내
-const WRITE_ERRORS: Record = {
- LINK_NOT_ALLOWED: '링크나 전화번호는 쓸 수 없어요.',
- DAILY_LIMIT: '오늘은 더 쓸 수 없어요. 하루 5개까지예요.',
- INVALID_INPUT: '100자 안으로 써 주세요.',
-};
-
-const REASONS = [
- [TalkReport.ABUSE, '욕설·비하'],
- [TalkReport.SPAM, '광고·도배'],
- [TalkReport.PRIVACY, '개인정보 노출'],
- [TalkReport.ETC, '기타'],
-] as const;
-
-type Photo = { uri: string; name: string; type: string };
-
-/** 고른 사진을 올려 주소를 받는다. 앱의 사진은 Blob 이 아니라 {uri} 라서 FormData 를 직접 만든다 */
-async function uploadPhoto(photo: Photo) {
- const form = new FormData();
- form.append('file', photo as unknown as Blob);
- const { data } = await uploadTalkImage({ body: { file: photo as unknown as Blob }, bodySerializer: () => form });
- if (!data.result?.success || !data.image) throw new Error(data.result?.desc ?? 'upload');
- return data.image;
-}
-
-/** 이야기 쓰는 칸: 로그인해야 쓴다. 주제·사진(하나)을 붙여 올린다 */
-export function Composer() {
- const { region } = useRegion();
- const { loggedIn, me } = useAuth();
- const { open } = useSheet();
- const s = useSoft();
- const [ink2] = useCSSVariable(['--color-ink2']).map(String);
- const refresh = useRefreshTalks();
- const add = useMutation(addTalkMutation());
- const [text, setText] = useState('');
- const [topic, setTopic] = useState(TalkTopic.LOCAL);
- const [error, setError] = useState(null);
- const [photo, setPhoto] = useState(null);
- const [uploading, setUploading] = useState(false);
- const busy = add.isPending || uploading;
- const place = region.name.split(' ').at(-1);
-
- const pick = async () => {
- if (!loggedIn) return open({ type: 'login' });
- try {
- const res = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ['images'], quality: 0.85 });
- const a = res.canceled ? undefined : res.assets[0];
- if (!a) return;
- if (a.fileSize && a.fileSize > PHOTO_MAX) return setError('사진은 10MB까지 올릴 수 있어요.');
- setError(null);
- setPhoto({ uri: a.uri, name: a.fileName ?? 'photo.jpg', type: a.mimeType ?? 'image/jpeg' });
- } catch (e) {
- console.error('[talk] pick photo', e);
- setError('사진을 고르지 못했어요. 다시 해 주세요.');
- }
- };
-
- const submit = async () => {
- if (!loggedIn) return open({ type: 'login' });
- const body = text.trim();
- if (!body || busy) return;
- setError(null);
- let image: string | undefined;
- if (photo) {
- setUploading(true);
- try {
- image = await uploadPhoto(photo);
- } catch (e) {
- console.error('[talk] photo upload', e);
- return setError('사진을 올리지 못했어요. 사진 파일인지 확인해 주세요.');
- } finally {
- setUploading(false);
- }
- }
- add.mutate(
- { body: { region_code: region.code, body, image, topic } },
- {
- onSuccess: (res) => {
- if (!res.result?.success) return setError(WRITE_ERRORS[res.result?.desc ?? ''] ?? '글을 올리지 못했어요. 다시 해 주세요.');
- track('talk_post', { topic, with_image: !!image });
- setText('');
- setPhoto(null);
- setTopic(TalkTopic.LOCAL);
- refresh();
- },
- onError: () => setError('글을 올리지 못했어요. 다시 해 주세요.'),
- },
- );
- };
-
- return (
-
- {/* 로그인 전엔 칸을 눌러도 키보드 대신 로그인 창 */}
- open({ type: 'login' })}>
-
-
- {photo && (
-
-
- setPhoto(null)} accessibilityRole="button" accessibilityLabel="사진 빼기" className="absolute -top-1.5 -right-1.5 size-6 items-center justify-center rounded-full bg-ink-btn">
- ×
-
-
- )}
-
- {openTopics().map(([k, label]) => (
- setTopic(k)} accessibilityRole="radio" accessibilityState={{ checked: topic === k }} className={`rounded-full px-2.5 py-1 ${topic === k ? 'bg-ink-btn' : ''}`} style={topic === k ? undefined : { backgroundColor: s.soft }}>
- {label}
-
- ))}
-
-
- {/* 주제 칩과 헷갈리지 않게 글자 대신 카메라 아이콘 */}
-
-
-
-
- {me ? `${me.nickname} · ${place} · 지금 날씨가 함께 올라가요` : '로그인하면 쓸 수 있어요'}
-
-
- {text.length}/{BODY_MAX}
-
-
- {busy ? '올리는 중…' : '올리기'}
-
-
- {!!error && (
-
- {error}
-
- )}
-
- );
-}
-
-type Menu = 'closed' | 'open' | 'confirm' | 'report' | 'done';
-
-/** 좋아요: 로그인 없이 된다. 화면을 먼저 바꾸고, 실패하면 되돌린다 */
-function useTalkLike(t: TalkData) {
- const [liked, setLiked] = useState(t.liked);
- const [count, setCount] = useState(t.like_count);
- const like = useMutation(likeTalkMutation());
- const unlike = useMutation(unlikeTalkMutation());
- const toggle = () => {
- if (like.isPending || unlike.isPending) return;
- const next = !liked;
- setLiked(next);
- setCount((n) => n + (next ? 1 : -1));
- const revert = () => {
- setLiked(!next);
- setCount(t.like_count);
- };
- (next ? like : unlike).mutate(
- { path: { talk_id: t.talk_id } },
- {
- onSuccess: (res) => {
- if (!res.result?.success || res.like_count == null) return revert();
- if (next) track('like', { content_type: 'talk', item_id: t.talk_id });
- setCount(res.like_count);
- },
- onError: revert,
- },
- );
- };
- return { liked, count, toggle };
-}
-
-function Chip({ label, danger, onPress, disabled }: { label: string; danger?: boolean; onPress: () => void; disabled?: boolean }) {
- return (
-
- {label}
-
- );
-}
-
-/** 글 메뉴(⋯)를 눌렀을 때 나오는 버튼 줄: 내 글은 지우기, 남의 글은 안 보기·신고 */
-function TalkMenu({ t, menu, setMenu, className }: { t: TalkData; menu: Menu; setMenu: (m: Menu) => void; className?: string }) {
- const { loggedIn } = useAuth();
- const { open } = useSheet();
- const refresh = useRefreshTalks();
- const remove = useMutation(deleteTalkMutation());
- const report = useMutation(reportTalkMutation());
- const block = useMutation(blockTalkAuthorMutation());
- const [failed, setFailed] = useState(false);
-
- // 메뉴의 동작은 끝나면 목록을 다시 받아 숨긴 글·안 보기로 한 사람의 글이 빠지게 한다
- const after = (done?: () => void) => ({
- onSuccess: (res: { result?: { success?: boolean } }) => {
- if (!res.result?.success) return setFailed(true);
- done?.();
- setMenu('done');
- refresh();
- },
- onError: () => setFailed(true),
- });
- const guard = (run: () => void) => (loggedIn ? run() : open({ type: 'login' }));
-
- return (
-
- {menu === 'done' ? (
- 처리했어요
- ) : t.mine && menu === 'confirm' ? (
- <>
- 지울까요?
- remove.mutate({ path: { talk_id: t.talk_id } }, after())} />
- setMenu('closed')} />
- >
- ) : t.mine ? (
- setMenu('confirm')} />
- ) : menu === 'report' ? (
- REASONS.map(([reason, label]) => report.mutate({ path: { talk_id: t.talk_id }, body: { reason } }, after(() => track('report', { content_type: 'talk', reason })))} />)
- ) : (
- <>
- guard(() => block.mutate({ path: { talk_id: t.talk_id } }, after(() => track('block', { content_type: 'talk' }))))} />
- guard(() => setMenu('report'))} />
- >
- )}
- {failed && 못 했어요. 다시 해 주세요}
-
- );
-}
-
-function MenuButton({ menu, setMenu }: { menu: Menu; setMenu: (m: Menu) => void }) {
- return (
- setMenu(menu === 'closed' ? 'open' : 'closed')} hitSlop={12} accessibilityRole="button" accessibilityState={{ expanded: menu !== 'closed' }} accessibilityLabel="글 메뉴">
- ⋯
-
- );
-}
-
-function MineBadge() {
- return (
-
- {' 내 글 '}
-
- );
-}
-
-/** 한 줄 글: 목록·내 정보의 내 글 */
-function TalkRow({ t, last }: { t: TalkData; last?: boolean }) {
- const { liked, count, toggle } = useTalkLike(t);
- const [menu, setMenu] = useState