Compare commits

..
12 changed files with 97 additions and 15 deletions

No files matched your search

+1
View File
@@ -54,6 +54,7 @@ class SajuMe(WebPacketProtocol):
elements: dict[str, float] = Field({}, description="오행 세력 점수 木火土金水 (월지 30·일지 20·나머지 10, 지지는 지장간 날 수로 나눔)") elements: dict[str, float] = Field({}, description="오행 세력 점수 木火土金水 (월지 30·일지 20·나머지 10, 지지는 지장간 날 수로 나눔)")
top_element: Optional[str] = Field(None, description="가장 센 오행") top_element: Optional[str] = Field(None, description="가장 센 오행")
strong: Optional[bool] = Field(None, description="신강이면 true, 신약이면 false") strong: Optional[bool] = Field(None, description="신강이면 true, 신약이면 false")
strength: Optional[str] = Field(None, description="신강 · 중화 · 신약 (득령이면 돕는 몫에 가산, 45~55% 사이는 중화)")
support: Optional[float] = Field(None, description="일간을 뺀 점수 중 일간을 돕는 기운 몫 0~1") support: Optional[float] = Field(None, description="일간을 뺀 점수 중 일간을 돕는 기운 몫 0~1")
+1 -1
View File
@@ -31,7 +31,7 @@ def _res(r: Reading) -> Res_Saju:
pillars=[SajuPillar(position=pos, stem=p.stem, branch=p.branch, stem_ko=ko(p.stem), branch_ko=ko(p.branch), stem_element=stem_element(p.stem), branch_element=branch_element(p.branch), pillars=[SajuPillar(position=pos, stem=p.stem, branch=p.branch, stem_ko=ko(p.stem), branch_ko=ko(p.branch), stem_element=stem_element(p.stem), branch_element=branch_element(p.branch),
stem_ten_god=gods[pos]["stem"], branch_ten_god=gods[pos]["branch"]) for pos, p in pillars], stem_ten_god=gods[pos]["stem"], branch_ten_god=gods[pos]["branch"]) for pos, p in pillars],
hour_known=c.hour is not None, jeol_warning=c.jeol_on_birth_day, scene=r.scene[0], scene_desc=r.scene[1], scene_icon=r.scene_icon, need=r.need, hour_known=c.hour is not None, jeol_warning=c.jeol_on_birth_day, scene=r.scene[0], scene_desc=r.scene[1], scene_icon=r.scene_icon, need=r.need,
elements=strength.elements, top_element=strength.top, strong=strength.strong, support=strength.support, elements=strength.elements, top_element=strength.top, strong=strength.strong, strength=strength.label, support=strength.support,
), ),
today=SajuToday( today=SajuToday(
day=today.day, pillar=ko(today.facts.pillar.stem + today.facts.pillar.branch), ten_god=today.facts.stem_ten_god, title=T.TEN_GOD_TEXT[today.facts.stem_ten_god][0], day=today.day, pillar=ko(today.facts.pillar.stem + today.facts.pillar.branch), ten_god=today.facts.stem_ten_god, title=T.TEN_GOD_TEXT[today.facts.stem_ten_god][0],
+14 -3
View File
@@ -10,7 +10,10 @@ POSITION_POINTS = {
("year", "stem"): 10, ("year", "branch"): 10, ("month", "stem"): 10, ("month", "branch"): 30, ("year", "stem"): 10, ("year", "branch"): 10, ("month", "stem"): 10, ("month", "branch"): 30,
("day", "stem"): 10, ("day", "branch"): 20, ("hour", "stem"): 10, ("hour", "branch"): 10, ("day", "stem"): 10, ("day", "branch"): 20, ("hour", "stem"): 10, ("hour", "branch"): 10,
} }
STRONG_FROM = 0.5 # 일간을 뺀 점수 중 비겁·인성 몫이 이 이상이면 신강 # 월령: 태어난 달의 오행. 일간 오행이 이와 같거나(왕) 달이 일간을 생하면(상) 득령. 강약은 득령을 먼저 본다
SEASON_ELEMENT = dict(zip("寅卯巳午申酉亥子辰戌丑未", "木木火火金金水水土土土土"))
DEUK_RYEONG_BONUS = 0.15 # 득령이면 돕는 몫에 더한다
STRONG_FROM, WEAK_BELOW = 0.55, 0.45 # (돕는 몫 + 득령 가산) 이 이상이면 신강, 미만이면 신약, 사이는 중화
@dataclass(frozen=True) @dataclass(frozen=True)
@@ -18,7 +21,12 @@ class Strength:
elements: dict[str, float] # 오행별 점수 (일간 포함), 木火土金水 순 elements: dict[str, float] # 오행별 점수 (일간 포함), 木火土金水 순
top: str # 가장 센 오행 top: str # 가장 센 오행
support: float # 일간을 뺀 점수 중 일간을 돕는 오행(같은 오행·생해 주는 오행) 몫 0~1 support: float # 일간을 뺀 점수 중 일간을 돕는 오행(같은 오행·생해 주는 오행) 몫 0~1
strong: bool deuk_ryeong: bool
label: str # 신강 · 중화 · 신약
@property
def strong(self) -> bool:
return self.label == "신강"
def char_points(chart: Chart) -> list[tuple[str, str, str, float]]: def char_points(chart: Chart) -> list[tuple[str, str, str, float]]:
@@ -48,4 +56,7 @@ def chart_strength(chart: Chart) -> Strength:
support += points if el in helpers else 0.0 support += points if el in helpers else 0.0
elements = {k: round(v, 1) for k, v in elements.items()} elements = {k: round(v, 1) for k, v in elements.items()}
ratio = round(support / others, 3) ratio = round(support / others, 3)
return Strength(elements, max(elements, key=elements.get), ratio, ratio >= STRONG_FROM) deuk = SEASON_ELEMENT[chart.month.branch] in helpers
judged = ratio + (DEUK_RYEONG_BONUS if deuk else 0.0)
label = "신강" if judged >= STRONG_FROM else "신약" if judged < WEAK_BELOW else "중화"
return Strength(elements, max(elements, key=elements.get), ratio, deuk, label)
+1 -1
View File
@@ -36,7 +36,7 @@ async def test_reading_for_anyone_gives_me_today_and_cards(offline):
assert [p["stem"] + p["branch"] for p in r["me"]["pillars"]] == ["乙亥", "己卯", "甲辰"] and r["me"]["hour_known"] is False assert [p["stem"] + p["branch"] for p in r["me"]["pillars"]] == ["乙亥", "己卯", "甲辰"] and r["me"]["hour_known"] is False
assert r["me"]["scene"].endswith("기운") and r["today"]["title"] and 0 <= r["today"]["score"] <= 100 assert r["me"]["scene"].endswith("기운") and r["today"]["title"] and 0 <= r["today"]["score"] <= 100
assert [(p.get("stem_ten_god"), p["branch_ten_god"]) for p in r["me"]["pillars"]] == [("겁재", "편인"), ("정재", "겁재"), (None, "편재")] assert [(p.get("stem_ten_god"), p["branch_ten_god"]) for p in r["me"]["pillars"]] == [("겁재", "편인"), ("정재", "겁재"), (None, "편재")]
assert r["me"]["top_element"] == "木" and r["me"]["strong"] is True and r["me"]["elements"]["木"] == 58.3 assert r["me"]["top_element"] == "木" and r["me"]["strong"] is True and r["me"]["strength"] == "신강" and r["me"]["elements"]["木"] == 58.3
kinds = [x["kind"] for x in r["today"]["cards"]] kinds = [x["kind"] for x in r["today"]["cards"]]
assert "when" in kinds and "do" in kinds and "wear" in kinds assert "when" in kinds and "do" in kinds and "wear" in kinds
# 근거 줄은 쉬운 말 + 괄호 용어, 숫자 없이 # 근거 줄은 쉬운 말 + 괄호 용어, 숫자 없이
+9
View File
@@ -269,6 +269,15 @@ def test_summer_earth_chart_reads_hot_and_dry_not_rainy():
assert climate.strength.top == "土" and climate.strength.strong assert climate.strength.top == "土" and climate.strength.strong
def test_month_rooted_day_master_stays_strong_whatever_the_hour():
# 未월 己土는 득령(월령 土) — 시주가 물·쇠라도 신강, 득령 없는 같은 몫이면 낮게
for h in range(0, 24, 2):
s = chart_strength(make_chart(date(1959, 7, 16), time(h, 30)))
assert s.deuk_ryeong and s.label == "신강", (h, s)
winter = chart_strength(make_chart(date(1959, 12, 20))) # 子월 — 己土 득령 아님
assert not winter.deuk_ryeong
def test_month_dries_summer_earth_and_soaks_winter_earth(): def test_month_dries_summer_earth_and_soaks_winter_earth():
assert seasoned("己", "未")[1] < 0 < seasoned("己", "子")[1] assert seasoned("己", "未")[1] < 0 < seasoned("己", "子")[1]
assert seasoned("壬", "未")[0] > seasoned("壬", "子")[0] assert seasoned("壬", "未")[0] > seasoned("壬", "子")[0]
+3 -2
View File
@@ -7,7 +7,7 @@
| 단계 | 하는 일 | 코드 | | 단계 | 하는 일 | 코드 |
|---|---|---| |---|---|---|
| 1. 네 기둥 | 연주는 입춘, 월주는 절입 시각(천문 계산), 일주·시주는 출생지 지방평균시(서머타임 걷어냄)로 가른다 | `services/saju/pillars.py`, `birth.py`, `solar_terms.py` | | 1. 네 기둥 | 연주는 입춘, 월주는 절입 시각(천문 계산), 일주·시주는 출생지 지방평균시(서머타임 걷어냄)로 가른다 | `services/saju/pillars.py`, `birth.py`, `solar_terms.py` |
| 2. 오행 세력 | 자리 점수(월지 30·일지 20·나머지 10)를 지지는 지장간 날 수대로 나눠 오행별로 더한다. 일간을 돕는 몫이 50% 이상이면 신강 | `services/saju/strength.py` | | 2. 오행 세력 | 자리 점수(월지 30·일지 20·나머지 10)를 지지는 지장간 날 수대로 나눠 오행별로 더한다. 일간을 돕는 몫 + 득령 가산 0.15 가 55% 이상 신강, 45% 미만 신약, 사이 중화 | `services/saju/strength.py` |
| 3. 조후(내 기운) | 글자마다 한난·조습 값을 두고, 태어난 달(월령)이 다른 글자를 데우거나 식힌다. 흙은 계절 따라 마르고 젖는다. 자리 점수로 평균 → '따뜻·마름' 같은 결 + 계절 = 기운 장면 | `services/saju/climate.py` | | 3. 조후(내 기운) | 글자마다 한난·조습 값을 두고, 태어난 달(월령)이 다른 글자를 데우거나 식힌다. 흙은 계절 따라 마르고 젖는다. 자리 점수로 평균 → '따뜻·마름' 같은 결 + 계절 = 기운 장면 | `services/saju/climate.py` |
| 4. 사주 점수 | 50에서 시작, 오늘 일진의 십성·원국과의 합충형파해·도화·홍염을 더한다 | `services/saju/daily.py` | | 4. 사주 점수 | 50에서 시작, 오늘 일진의 십성·원국과의 합충형파해·도화·홍염을 더한다 | `services/saju/daily.py` |
| 5. 날씨 궁합 | 시간별 체감·습도·비가 내 조후를 균형 쪽으로 옮기는지. 50이 보통 | `services/saju/climate.py` | | 5. 날씨 궁합 | 시간별 체감·습도·비가 내 조후를 균형 쪽으로 옮기는지. 50이 보통 | `services/saju/climate.py` |
@@ -36,7 +36,8 @@
- 예: 월지 未 30점 → 丁(화) 9, 乙(목) 3, 己(토) 18. - 예: 월지 未 30점 → 丁(화) 9, 乙(목) 3, 己(토) 18.
- `elements`: 일간 포함 오행별 합. `top`: 가장 큰 오행(같으면 木火土金水 순 앞). - `elements`: 일간 포함 오행별 합. `top`: 가장 큰 오행(같으면 木火土金水 순 앞).
- `support` = (일간 빼고) 일간과 같은 오행 + 일간을 생하는 오행 점수 ÷ 일간 뺀 점수 합. 시주가 있으면 분모 100. - `support` = (일간 빼고) 일간과 같은 오행 + 일간을 생하는 오행 점수 ÷ 일간 뺀 점수 합. 시주가 있으면 분모 100.
- `strong` = support ≥ 0.5 (신강). - 득령 = 월지 계절 오행(寅卯 木, 巳午 火, 申酉 金, 亥子 水, 辰戌丑未 土)이 일간과 같거나 일간을 생함. 득령이면 support 에 0.15 를 더해 판정.
- `label` = (support + 득령 가산) ≥ 0.55 신강, < 0.45 신약, 사이 중화. 강약은 득령을 먼저 본다 (10/29 사용자 결정 — 未월 己土가 시주 하나로 신약이 되던 문제).
- 근거: 득령(월지)·득지(일지)·득세 판단, 월지 30·일지 20·그 외 10 배점은 흔히 쓰는 예시 배점. - 근거: 득령(월지)·득지(일지)·득세 판단, 월지 30·일지 20·그 외 10 배점은 흔히 쓰는 예시 배점.
- 화면: API `me.elements`·`top_element`·`strong`·`support`, 기둥별 `stem_ten_god`·`branch_ten_god`(지지는 정기 기준) → 사주 명식 카드. - 화면: API `me.elements`·`top_element`·`strong`·`support`, 기둥별 `stem_ten_god`·`branch_ten_god`(지지는 정기 기준) → 사주 명식 카드.
+2 -1
View File
@@ -34,6 +34,7 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화
| `install_choice` | 설치창에서 고름 (안드로이드·PC Chrome·Edge) | `outcome: 'accepted' \| 'dismissed'` | `install.ts` `promptInstall` | | `install_choice` | 설치창에서 고름 (안드로이드·PC Chrome·Edge) | `outcome: 'accepted' \| 'dismissed'` | `install.ts` `promptInstall` |
| `install_done` | 설치 완료 (브라우저가 `appinstalled`를 줄 때만. 아이폰은 오지 않음) | 없음 | `install.ts` | | `install_done` | 설치 완료 (브라우저가 `appinstalled`를 줄 때만. 아이폰은 오지 않음) | 없음 | `install.ts` |
| `app_launch` | 홈 화면 아이콘(설치한 앱)으로 엶 | `mode: 'standalone'` | `main.tsx` | | `app_launch` | 홈 화면 아이콘(설치한 앱)으로 엶 | `mode: 'standalone'` | `main.tsx` |
| `boot_stuck` | 8초 넘게 '날씨 불러오는 중' 첫 화면이 남음 (페이지마다 한 번) | `reason`(첫 오류 문구, 100자), `seconds`, `tries`(연달아 다시 불러온 횟수), `app_started`(앱 파일 실행 여부) | `index.html` 첫 화면 스크립트 |
| `sheet_open` | 아래에서 올라오는 창이 열림 (각·글·보내기·댓글·로그인·내 정보·지역·내 각·홈 화면 추가·점수 근거·이야기 등) | `sheet`(창 종류: `gak`·`article`·`share`·`comments`·`login`·`me`·`region`·`mix`·`myGak`·`install`·`weatherWhy`·`talk`·`seasonWeek`) | `Sheets.tsx` `SheetProvider` `open` | | `sheet_open` | 아래에서 올라오는 창이 열림 (각·글·보내기·댓글·로그인·내 정보·지역·내 각·홈 화면 추가·점수 근거·이야기 등) | `sheet`(창 종류: `gak`·`article`·`share`·`comments`·`login`·`me`·`region`·`mix`·`myGak`·`install`·`weatherWhy`·`talk`·`seasonWeek`) | `Sheets.tsx` `SheetProvider` `open` |
| `like` | 좋아요 성공 (취소는 안 보냄) | `content_type: 'post' \| 'comment' \| 'talk' \| 'hero_post' \| 'gak_post' \| 'foliage_post' \| 'events_post' \| 'season_post'`, `item_id`(포스트·댓글·글 번호) | `Post.tsx` `FullCard`, `pinnedLike.ts`, `Sheets.tsx` `CommentRow`, `talk.tsx` | | `like` | 좋아요 성공 (취소는 안 보냄) | `content_type: 'post' \| 'comment' \| 'talk' \| 'hero_post' \| 'gak_post' \| 'foliage_post' \| 'events_post' \| 'season_post'`, `item_id`(포스트·댓글·글 번호) | `Post.tsx` `FullCard`, `pinnedLike.ts`, `Sheets.tsx` `CommentRow`, `talk.tsx` |
| `comment` | 댓글 올리기 성공 | `post_id` | `Sheets.tsx` `CommentsSheet` `send` | | `comment` | 댓글 올리기 성공 | `post_id` | `Sheets.tsx` `CommentsSheet` `send` |
@@ -54,7 +55,7 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화
| `day_log` | 저녁 체크인을 적어 둠 (고쳐 적어도 보냄). 다녀온 곳 이름은 보내지 않음 | `mood`(1~5), `went_out`, `card_hit`(맞았어요 true·글쎄요 false·안 고름 null) | `fortune.tsx` `useTodayCard` | | `day_log` | 저녁 체크인을 적어 둠 (고쳐 적어도 보냄). 다녀온 곳 이름은 보내지 않음 | `mood`(1~5), `went_out`, `card_hit`(맞았어요 true·글쎄요 false·안 고름 null) | `fortune.tsx` `useTodayCard` |
| `today_icon` | 오늘 탭 아이콘 줄에서 아이콘을 누름 | `icon`(`tarot`·`saju`·`game`·`foliage`·`shorts`·`myGak`·`talk`) | `todayIcons.tsx` `TodayIcons` | | `today_icon` | 오늘 탭 아이콘 줄에서 아이콘을 누름 | `icon`(`tarot`·`saju`·`game`·`foliage`·`shorts`·`myGak`·`talk`) | `todayIcons.tsx` `TodayIcons` |
| `saju_input` | 날씨 사주 생년월일을 넣음 (생년월일 값은 보내지 않음) | `with_time` | `SajuPage.tsx` `BirthForm` | | `saju_input` | 날씨 사주 생년월일을 넣음 (생년월일 값은 보내지 않음) | `with_time` | `SajuPage.tsx` `BirthForm` |
| `saju_view` | 날씨 사주 결과가 뜸 | `scene`(내 기운 이름), `score`, `strength`(신강·신약), `top_element`(가장 센 오행) | `SajuPage.tsx` `Reading` | | `saju_view` | 날씨 사주 결과가 뜸 | `scene`(내 기운 이름), `score`, `strength`(신강·중화·신약), `top_element`(가장 센 오행) | `SajuPage.tsx` `Reading` |
| `game_start` | 구름 합치기 한 판의 첫 그림을 떨어뜨림 (페이지만 열고 안 한 사람과 구분) | `again`(다시 하기로 시작), `logged_in`, `wind_ms`(오늘 우리 구 풍속) | `CloudMergePage.tsx` `onUp` | | `game_start` | 구름 합치기 한 판의 첫 그림을 떨어뜨림 (페이지만 열고 안 한 사람과 구분) | `again`(다시 하기로 시작), `logged_in`, `wind_ms`(오늘 우리 구 풍속) | `CloudMergePage.tsx` `onUp` |
| `game_round` | 구름 합치기 라운드를 깸 | `round`(깬 라운드), `score`(그때 총점), `logged_in`(각을 받는지) | `CloudMergePage.tsx` `onScore` | | `game_round` | 구름 합치기 라운드를 깸 | `round`(깬 라운드), `score`(그때 총점), `logged_in`(각을 받는지) | `CloudMergePage.tsx` `onScore` |
| `game_over` | 구름 합치기가 넘쳐서 끝남 | `round`(끝난 라운드), `score`, `best`(최고 기록 갱신), `drops`(떨어뜨린 횟수) | `CloudMergePage.tsx` `onOver` | | `game_over` | 구름 합치기가 넘쳐서 끝남 | `round`(끝난 라운드), `score`, `best`(최고 기록 갱신), `drops`(떨어뜨린 횟수) | `CloudMergePage.tsx` `onOver` |
+48 -4
View File
@@ -13,24 +13,68 @@
<script> <script>
// 이미 열었던 탭을 다시 열면 브라우저가 예전 HTML 을 다시 쓰고, 그 HTML 이 부르는 예전 빌드 파일은 배포로 지워져 첫 화면에서 멈춘다. // 이미 열었던 탭을 다시 열면 브라우저가 예전 HTML 을 다시 쓰고, 그 HTML 이 부르는 예전 빌드 파일은 배포로 지워져 첫 화면에서 멈춘다.
// 돌아왔을 때 망이 아직 안 붙어 다시 불러온 것까지 실패하기도 하니, 첫 화면이 남아 있는 동안은 계속 다시 시도한다: // 돌아왔을 때 망이 아직 안 붙어 다시 불러온 것까지 실패하기도 하니, 첫 화면이 남아 있는 동안은 계속 다시 시도한다:
// 빌드 파일을 못 받았을 때, 12초마다, 탭을 다시 볼 때, 망이 다시 붙을 때 (10초 안에 또 하지는 않는다) // 빌드 파일을 못 받았을 때, 12초마다, 탭을 다시 볼 때, 망이 다시 붙을 때 (10초 안에 또 하지는 않는다).
// 연달아 3번 다시 불러와도 그대로면 멈추고, 8초 넘게 첫 화면이면 그 까닭과 '다시 불러오기'를 보여 주고 GA boot_stuck 으로 보낸다
(function () { (function () {
var KEY = 'nalssigak.bootReload' var KEY = 'nalssigak.bootReload'
var TRIES = 'nalssigak.bootTries'
var errs = []
var start = Date.now()
function tries() {
try {
return Date.now() - Number(sessionStorage.getItem(KEY) || 0) < 60000 ? Number(sessionStorage.getItem(TRIES) || 0) : 0
} catch (e) {
console.error('[boot] storage', e)
return 0
}
}
function retry() { function retry() {
if (!document.getElementById('boot') || document.hidden) return if (!document.getElementById('boot') || document.hidden) return
var n = tries()
try { try {
var last = Number(sessionStorage.getItem(KEY) || 0) if (Date.now() - Number(sessionStorage.getItem(KEY) || 0) < 10000 || n >= 3) return
if (Date.now() - last < 10000) return
sessionStorage.setItem(KEY, String(Date.now())) sessionStorage.setItem(KEY, String(Date.now()))
sessionStorage.setItem(TRIES, String(n + 1))
} catch (e) { } catch (e) {
console.error('[boot] storage', e) console.error('[boot] storage', e)
} }
location.reload() location.reload()
} }
function note(msg) {
if (errs.length < 3) errs.push(String(msg).slice(0, 160))
}
window.addEventListener('error', function (e) { window.addEventListener('error', function (e) {
var el = e.target var el = e.target
if (el && (el.tagName === 'SCRIPT' || el.tagName === 'LINK') && (el.src || el.href || '').indexOf(location.origin + '/') === 0) retry() if (el && (el.tagName === 'SCRIPT' || el.tagName === 'LINK')) {
var url = el.src || el.href || ''
if (url.indexOf(location.origin + '/') !== 0) return
note('파일 못 받음 ' + url.slice(location.origin.length))
retry()
return
}
note((e.message || 'error') + (e.filename ? ' @' + e.filename.split('/').pop() + ':' + e.lineno : ''))
}, true) }, true)
window.addEventListener('unhandledrejection', function (e) {
var r = e.reason
note('promise ' + (r && r.message ? r.message : String(r)))
})
setTimeout(function () {
var boot = document.getElementById('boot')
if (!boot) return
var reason = errs[0] || (window.__appStarted ? '앱이 떴지만 첫 화면을 못 걷음' : '앱 파일이 실행되지 않음')
var p = document.createElement('p')
p.style.cssText = 'margin:0 24px;font:12px/1.5 sans-serif;opacity:.7;text-align:center;word-break:break-all'
p.textContent = errs.length ? errs.join(' / ') : reason
var b = document.createElement('button')
b.textContent = '다시 불러오기'
b.style.cssText = 'padding:10px 20px;border:0;border-radius:999px;background:#28304a;color:#fff;font:16px Jua,sans-serif'
b.onclick = function () {
location.reload()
}
boot.appendChild(p)
boot.appendChild(b)
gtag('event', 'boot_stuck', { reason: reason.slice(0, 100), seconds: Math.round((Date.now() - start) / 1000), tries: tries(), app_started: !!window.__appStarted })
}, 8000)
var timer = setInterval(function () { var timer = setInterval(function () {
if (document.getElementById('boot')) retry() if (document.getElementById('boot')) retry()
else clearInterval(timer) else clearInterval(timer)
+7 -3
View File
@@ -19,7 +19,11 @@ const CARD_ICON: Record<string, string> = { when: 'alarm_clock', do: 'check_mark
const POS_WORD: Record<string, string> = { hour: '시', day: '일', month: '월', year: '연' } const POS_WORD: Record<string, string> = { hour: '시', day: '일', month: '월', year: '연' }
const EL_WORD: Record<string, string> = { 木: '나무', 火: '불', 土: '흙', 金: '쇠', 水: '물' } const EL_WORD: Record<string, string> = { 木: '나무', 火: '불', 土: '흙', 金: '쇠', 水: '물' }
const EL_ART: Record<string, string> = { 木: 'wood', 火: 'fire', 土: 'earth', 金: 'metal', 水: 'water' } const EL_ART: Record<string, string> = { 木: 'wood', 火: 'fire', 土: 'earth', 金: 'metal', 水: 'water' }
const STRENGTH_WORD: Record<string, string> = { 신강: '나를 돕는 기운이 절반이 넘는 사주', 신약: '나를 돕는 기운이 절반보다 적은 사주' } const STRENGTH_WORD: Record<string, string> = {
신강: '나를 돕는 기운이 센 사주. 태어난 달(월령)의 힘을 먼저 봐요',
중화: '나를 돕는 기운과 다른 기운이 비슷한 사주',
신약: '나를 돕는 기운이 약한 사주',
}
const TEN_GOD_WORD: Record<string, string> = { const TEN_GOD_WORD: Record<string, string> = {
비견: '나와 같은 기운', 비견: '나와 같은 기운',
겁재: '나와 같지만 겨루는 기운', 겁재: '나와 같지만 겨루는 기운',
@@ -207,7 +211,7 @@ function Reading({ birth, onEdit }: { birth: Birth; onEdit: () => void }) {
useEffect(() => { useEffect(() => {
if (!r?.today) return if (!r?.today) return
markSeen() markSeen()
track('saju_view', { scene: r.me?.scene ?? '', score: r.today.score, strength: r.me?.strong == null ? '' : r.me.strong ? '신강' : '신약', top_element: r.me?.top_element ?? '' }) track('saju_view', { scene: r.me?.scene ?? '', score: r.today.score, strength: r.me?.strength ?? '', top_element: r.me?.top_element ?? '' })
}, [r]) }, [r])
if (q.isPending) return <p className="m-0 px-4 py-16 text-center font-semibold text-(--ink2)">사주를 풀고 있어요…</p> if (q.isPending) return <p className="m-0 px-4 py-16 text-center font-semibold text-(--ink2)">사주를 풀고 있어요…</p>
@@ -356,7 +360,7 @@ function MeCard({ r, onEdit }: { r: ResSaju; onEdit: () => void }) {
const els = Object.entries(me.elements ?? {}) const els = Object.entries(me.elements ?? {})
const total = els.reduce((a, [, v]) => a + v, 0) 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 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.strong == null ? null : me.strong ? '신강' : '신약' const strength = me.strength ?? (me.strong == null ? null : me.strong ? '신강' : '신약')
return ( return (
<Panel icon={me.scene_icon} title="사주 명식" right={<button type="button" onClick={onEdit} className="cursor-pointer text-xs font-extrabold text-(--orange)">생년월일 바꾸기</button>}> <Panel icon={me.scene_icon} title="사주 명식" right={<button type="button" onClick={onEdit} className="cursor-pointer text-xs font-extrabold text-(--orange)">생년월일 바꾸기</button>}>
{me.top_element && strength && ( {me.top_element && strength && (
+2
View File
@@ -14,6 +14,8 @@ type Events = {
install_choice: { outcome: 'accepted' | 'dismissed' } install_choice: { outcome: 'accepted' | 'dismissed' }
install_done: Record<string, never> install_done: Record<string, never>
app_launch: { mode: 'standalone' } app_launch: { mode: 'standalone' }
/** index.html 첫 화면 스크립트가 gtag 로 바로 보낸다 */
boot_stuck: { reason: string; seconds: number; tries: number; app_started: boolean }
sheet_open: { sheet: SheetType } sheet_open: { sheet: SheetType }
like: { content_type: 'post' | 'comment' | 'talk' | PinnedKey; item_id: number } like: { content_type: 'post' | 'comment' | 'talk' | PinnedKey; item_id: number }
comment: { post_id: number } comment: { post_id: number }
+3
View File
@@ -8,6 +8,9 @@ import App from './App.tsx'
import './b/install' import './b/install'
import { track } from './lib/analytics' import { track } from './lib/analytics'
// index.html 의 첫 화면이 멈췄을 때 앱 파일까지는 실행됐는지 가르는 표시
;(window as Window & { __appStarted?: boolean }).__appStarted = true
// iOS는 user-scalable=no를 무시해서 두 손가락 확대를 직접 막는다 // iOS는 user-scalable=no를 무시해서 두 손가락 확대를 직접 막는다
for (const type of ['gesturestart', 'gesturechange']) document.addEventListener(type, (e) => e.preventDefault(), { passive: false }) for (const type of ['gesturestart', 'gesturechange']) document.addEventListener(type, (e) => e.preventDefault(), { passive: false })
+6
View File
@@ -3855,6 +3855,12 @@ export type SajuMe = {
* 신강이면 true, 신약이면 false * 신강이면 true, 신약이면 false
*/ */
strong?: boolean | null; strong?: boolean | null;
/**
* Strength
*
* 신강 · 중화 · 신약 (득령이면 돕는 몫에 가산, 45~55% 사이는 중화)
*/
strength?: string | null;
/** /**
* Support * Support
* *