@@ -264,9 +272,9 @@ function Char({ c, ko, el }: { c: string; ko: string; el: string }) {
)
}
-function Panel({ icon, title, right, children }: { icon: string; title: string; right?: ReactNode; children: ReactNode }) {
+function Panel({ id, icon, title, right, children }: { id?: string; icon: string; title: string; right?: ReactNode; children: ReactNode }) {
return (
-
+
{title}
@@ -317,7 +325,7 @@ function Locked({ locks }: { locks: SajuLock[] }) {
function Week({ r }: { r: ResSaju }) {
return (
-
+
{r.week!.map((d) => (
-
@@ -340,7 +348,7 @@ function Love({ r, birth }: { r: ResSaju; birth: Birth }) {
const love = r.love!
const pick = (g: 'M' | 'F' | null) => setBirth({ ...birth, gender: g })
return (
-
+
{love.good ? (
연애 기운 좋은 날
@@ -373,13 +381,14 @@ function Love({ r, birth }: { r: ResSaju; birth: Birth }) {
)
}
-function Period({ icon, p }: { icon: string; p: NonNullable
}) {
+function Period({ id, icon, p }: { id: string; icon: string; p: NonNullable }) {
return (
-
+
{p.title} ({p.pillar} · {p.ten_god})
{p.body}
+ {(p.months?.length ?? 0) > 0 && 잘 맞는 달: {p.months!.map((m) => `${m}월`).join(' · ')}
}
{(p.notes?.length ?? 0) > 0 && {p.notes!.join(' · ')}
}
)
@@ -401,9 +410,15 @@ function Match({ birth }: { birth: Birth }) {
run.mutate({ body: { region_code: region.code, me: toBody(birth), friend: { birth_date: `${yy}-${String(mm).padStart(2, '0')}-${String(dd).padStart(2, '0')}`, longitude: 126.98 } } })
}
return (
-
+
{res ? (
<>
+
+ 상대 {y}.{m}.{d}생
+
+
{res.title} {res.score}
diff --git a/frontend/src/b/level.tsx b/frontend/src/b/level.tsx
index 8b3db6a..cf518ff 100644
--- a/frontend/src/b/level.tsx
+++ b/frontend/src/b/level.tsx
@@ -1,4 +1,5 @@
import { useEffect, useRef } from 'react'
+import { useNavigate } from 'react-router'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { attendMutation, myLevelOptions, myLevelQueryKey, sharedMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen'
import type { ResLevel } from '@nalssigak/shared/api/client/types.gen'
@@ -8,6 +9,20 @@ import { HIDDEN } from './features'
import { useSheet } from './sheetContext'
import { Ic } from './ui'
+// 각을 주는 일 → 그 일을 하러 가는 곳, 숨긴 기능에 딸린 일 (서버 ACTIONS 키)
+const ACTION_TO: Record = { saju: '/saju', react: '/', talk: '/talk' }
+const ACTION_FEATURE: Record = { tarot: 'tarot', checkin: 'tarot' }
+
+// 창이 쌓아 둔 방문 기록을 닫으며 되돌리므로, 되돌린 뒤(popstate)에 이동해야 새 주소가 안 지워진다
+function useCloseAndGo() {
+ const { close } = useSheet()
+ const navigate = useNavigate()
+ return (to: string) => {
+ window.addEventListener('popstate', () => navigate(to), { once: true })
+ close()
+ }
+}
+
// 레벨마다 보여 줄 하늘 아이콘 (이름은 서버 LEVELS)
const LEVEL_ICON = ['droplet', 'sun', 'leaf', 'rainbow', 'sunset', 'milky_way', 'shooting_star']
export const levelIcon = (level: number) => LEVEL_ICON[Math.min(Math.max(level, 1), LEVEL_ICON.length) - 1]
@@ -126,6 +141,7 @@ export function LevelCard({ link = true }: { link?: boolean }) {
/** 내 레벨 창: 오늘 받을 수 있는 각, 레벨마다 열리는 것 */
export function LevelSheet() {
const level = useLevel().data
+ const go = useCloseAndGo()
if (!level) return null
const steps = (level.unlocks ?? []).reduce>((m, u) => ({ ...m, [u.level]: [...(m[u.level] ?? []), u.name] }), {})
return (
@@ -134,15 +150,21 @@ export function LevelSheet() {
오늘 받을 수 있는 각
- {(level.today ?? []).filter((a) => !HIDDEN.has(a.action)).map((a) => {
+ {(level.today ?? []).filter((a) => !HIDDEN.has(ACTION_FEATURE[a.action] ?? a.action)).map((a) => {
const done = a.earned >= a.cap
+ const to = ACTION_TO[a.action]
return (
- -
+
- go(to) : undefined}
+ className={cx('flex items-center gap-2.5 border-b border-[#eef1f6] px-3.5 py-2.5 text-[13.5px] font-bold last:border-0', to && !done && 'cursor-pointer')}
+ >
{done ? '✓' : ''}
{a.name}
{a.earned > 0 && a.cap > a.points ? `${a.earned}/${a.cap}` : `+${a.points}`}각
+ {to && !done && ›}
)
})}
@@ -176,7 +198,9 @@ export function LevelSheet() {
export function LevelUpSheet({ level: lv }: { level: number }) {
const level = useLevel().data
const { open } = useSheet()
- const opened = (level?.unlocks ?? []).filter((u) => u.level === lv).map((u) => u.name)
+ 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 (
@@ -185,7 +209,12 @@ export function LevelUpSheet({ level: lv }: { level: number }) {
Lv.{lv} {name}
{opened.length > 0 &&
새로 열렸어요: {opened.join(', ')}
}
-
diff --git a/shared/api/client/types.gen.ts b/shared/api/client/types.gen.ts
index d23442f..0e3d557 100644
--- a/shared/api/client/types.gen.ts
+++ b/shared/api/client/types.gen.ts
@@ -2947,13 +2947,13 @@ export type ResSaju = {
/**
* Money
*
- * 레벨 3부터
+ * 레벨 3부터: 이번 주 돈을 정할 날·피할 날
*/
- money?: string | null;
+ money?: Array | null;
/**
* Work
*/
- work?: string | null;
+ work?: Array | null;
/**
* 레벨 4부터
*/
@@ -3730,6 +3730,12 @@ export type SajuPeriod = {
* Notes
*/
notes?: Array;
+ /**
+ * Months
+ *
+ * 올해: 잘 맞는 달 (양력 달)
+ */
+ months?: Array;
};
/**