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 && 태어난 날에 절기가 바뀌어요. 태어난 시각을 넣어야 달 기둥이 정확해요.} ); }