Skip to content

Dev - #85

Open
Retsomm wants to merge 9 commits into
mainfrom
dev
Open

Dev#85
Retsomm wants to merge 9 commits into
mainfrom
dev

Conversation

@Retsomm

@Retsomm Retsomm commented Aug 6, 2026

Copy link
Copy Markdown
Owner

No description provided.

Retsomm and others added 9 commits August 6, 2026 16:54
原本 1220 行的 chartPdf.ts 混雜 HTML/SVG 產生(純計算)與 expo-print/
expo-sharing 的實際下載動作,拆成 lib/pdf/ 目錄:純函式(palette/
bodyGraphSvg/htmlHelpers/三種報告的 HTML 模板/AI 提示詞產生)與唯一
含副作用的 actions.ts 分開,4 個呼叫端改為直接 import 新路徑。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
saveChart/saveTransitChart/saveCompositeChart 原本各自把「組 API
payload」跟「fetch 存檔」揉在同一函式裡。拆出 lib/chartPayloads.ts
放三個純 payload 組裝函式,saveChart.ts 只留三個薄 Action,共用同一個
postChartPayload() 處理 fetch + 錯誤訊息,呼叫端介面不變。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AccountContent() 原本 894 行混雜三個分頁(個人資料/我的圖表/通知)的
全部 state、effect、渲染。拆成 ProfileSection.tsx/NotificationsSection.tsx
兩個自帶 hook 的獨立元件,圖表重算邏輯拆成 useActiveChartRecompute
(Action) + lib/chartRecompute.ts 純函式(Calculation),順便合併原本
重算 effect 與渲染各寫一份的合圖出生資料解析邏輯。AccountClient.tsx
從 953 行降到 440 行左右。

ProfileSection/NotificationsSection 用 isActive prop 控制渲染但元件本身
無條件掛載,保留原本「切分頁不重置編輯草稿」「通知查詢 enabled 開關」
的行為。另外「我的圖表」標題補上目前選取圖表的名稱。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
524 行的 ChartView 混雜衍生顯示值計算、DetailDrawer 選取狀態管理、
下載/複製/儲存三個動作、跟渲染邏輯。拆成三個 hook:
useChartDisplayData(HdResult 衍生值,保留原本的 useMemo 依賴陣列)、
useChartSelection(點擊 BodyGraph/卡片/通道後的選取狀態與 handler)、
useChartExportActions(下載/複製提示詞/儲存三個動作)。ChartView.tsx
降到 395 行,只留渲染邏輯。「生成時間」的 useMemo(() => new Date()..., [])
特意留在元件本體,避免拆分後變成每次 render 重新讀系統時間。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
555 行的合圖計算頁把表單/驗證/計算/儲存/PDF 下載/複製提示詞全部 state
與 handler 跟渲染混在一起。拆出 useCompositeForm hook 集中管理,
CompositeView.tsx 降到 423 行只留渲染邏輯。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
TransitView.tsx 比照 CompositeView 拆出 useTransitForm,393→295 行。
profile.tsx 的 PersonalView() 其實是帳號設定跟出生資料管理兩個獨立
關注點疊在一起,拆成 useAccountSettings + useBirthProfileManager 兩個
hook,~398→~228 行。神級元件清單(AccountClient/ChartView/mobile
CompositeView+TransitView+profile.tsx)到此全部處理完。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
用 tsc --noUnusedLocals/--noUnusedParameters 抓未讀變數/參數,knip 抓
跨檔案未用 export,逐一 grep 驗證後清除確認為死碼的部分:

- lib/computeTransit.ts 的 analyzeTransitImpact()/TransitImpactLayer:
  被 lib/transitImpact.ts 的 computeImpact() 取代後留下的重複舊版邏輯
- lib/transitImpact.ts computeImpact() 未用參數 transitCenterIds,
  連帶更新 app/api/transit/{impact,create}/route.ts 兩處呼叫端
- TransitView.tsx 的 CentersSection 從未讀取的 transit prop
- lib/humanDesign/engine.ts 的 calculateDefinedCenters(零呼叫端)
- lib/swissEph.ts re-export 裡沒人用的 HouseSystem/CalendarType
- lib/humanDesign/constants.ts:未使用的 PLANET_SYMBOLS,以及整組
  「English display maps」(13 個 export)——此專案曾規劃多語系但
  考量後決定不做,含 AUTHORITY_KEY_MAP 對應的建構邏輯一併清除
- shared/humanDesign/hd-chart-data.ts 的 LEGEND_ITEMS(零使用)
- components/humanDesign/BodyGraph.tsx 未用的型別轉發 re-export
- app/dashboard/page.tsx 未用的 Link import
- mobile/app/(tabs)/profile.tsx 的 hdChart/hdLoading 死碼(抓資料但
  從未渲染),mobile BodyGraph.tsx/CenterList.tsx/GateChip.tsx 三處
  未用的 import/參數

knip 的「Unused files」清單在此 monorepo 下幾乎全是誤報(不理解
mobile/ 是獨立 Expo app),予以忽略;一批「unused export」型別驗證後
發現是同檔案內部有用到只是沒被其他檔案 import,非死碼,未清除。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
359 處 function 宣告(159 個檔案,web+mobile)統一改成箭頭函數
const 宣告。用 codemod 腳本處理(文字層級 splice,只動
function Name( -> const Name = ( 這段 signature,函式 body/參數列/
型別逐字保留原始排版),純風格重構、無邏輯變更。export default
function Name() 轉成 const Name = () => {} + 額外一行 export default
Name。

驗證:tsc --noEmit(web+mobile)全過,eslint 剩下的既有 error/warning
用 git stash 比對過跟改動前完全一樣,確認跟這次轉換無關。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1. 流日圖「流日時間」誤顯示成出生時間:useActiveChartRecompute 只認
   得 web 端存檔格式(meta.transitMeta),沒處理 mobile 端存檔格式
   (meta.transitSnapshot,頂層 birthDate/birthTime 對 mobile 圖表
   來說就是真實出生資料)。補上第三個分支直接讀 transitSnapshot 已存
   好的流日資料,不重新計算(重算等於拿出生當下去算流日,時間又會
   錯)。lib/useCharts.ts 的 ChartMeta 型別原本也沒宣告 transitSnapshot
   欄位,一併補上。mobile 端本身沒有這個問題(早就同時處理兩種格式)。

2. 存檔導頁回 /account 顯示的不是剛存的圖表:refetchCharts() 是非同步
   的,原本「圖表清單變動後保留原本選取,否則選第一筆」的 effect 會
   在 refetch 真正完成前先用舊清單跑一次,選到存檔前的最新一筆,之後
   被「保留原本選取」鎖住,即使真正的新清單到位也不會更新。改成直接
   await refetchCharts() 拿到的最新資料來決定要選哪一筆,不依賴 effect
   執行順序。mobile 端因為圖表清單是用 key 強制重新掛載,架構上不會
   踩到同一個坑。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
self-map Ready Ready Preview Aug 6, 2026 12:19pm

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 166 files, which is 66 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f995a2e5-8433-475f-a96b-2b7da8c39ae0

📥 Commits

Reviewing files that changed from the base of the PR and between c69073c and e4c7db6.

📒 Files selected for processing (166)
  • app/HomeClient.tsx
  • app/about/AboutClient.tsx
  • app/about/page.tsx
  • app/account/AccountClient.tsx
  • app/account/NotificationsSection.tsx
  • app/account/ProfileSection.tsx
  • app/account/page.tsx
  • app/account/useActiveChartRecompute.ts
  • app/api/account/delete/route.ts
  • app/api/aura-flow/_compute.ts
  • app/api/aura-flow/live-svg/route.ts
  • app/api/aura-flow/route.ts
  • app/api/birth-profiles/[id]/route.ts
  • app/api/birth-profiles/route.ts
  • app/api/charts/[id]/route.ts
  • app/api/charts/route.ts
  • app/api/composite/create/route.ts
  • app/api/composite/route.ts
  • app/api/notifications/[id]/route.ts
  • app/api/notifications/route.ts
  • app/api/stats/route.ts
  • app/api/transit/create/route.ts
  • app/api/transit/impact/route.ts
  • app/api/transit/route.ts
  • app/aura-flow/page.tsx
  • app/create/page.tsx
  • app/dashboard/DashboardClient.tsx
  • app/dashboard/page.tsx
  • app/error.tsx
  • app/global-error.tsx
  • app/human-design/page.tsx
  • app/layout.tsx
  • app/map/[chartId]/MapClient.tsx
  • app/map/[chartId]/page.tsx
  • app/page.tsx
  • app/private/PrivateClient.tsx
  • app/private/page.tsx
  • app/robots.ts
  • app/sign-in/[[...sign-in]]/page.tsx
  • app/sitemap.ts
  • components/CenterDrawer.tsx
  • components/Navbar.tsx
  • components/QueryProvider.tsx
  • components/SelfMap.tsx
  • components/SelfMapLogo.tsx
  • components/ThemeProvider.tsx
  • components/ThemeToggle.tsx
  • components/humanDesign/BirthFormModal.tsx
  • components/humanDesign/BirthProfileManager.tsx
  • components/humanDesign/BodyGraph.tsx
  • components/humanDesign/ChartView.tsx
  • components/humanDesign/CompositeTab.tsx
  • components/humanDesign/CompositeView.tsx
  • components/humanDesign/DateSelect.tsx
  • components/humanDesign/DetailDrawer.tsx
  • components/humanDesign/HdContentFilter.tsx
  • components/humanDesign/HdMarkdown.tsx
  • components/humanDesign/HdSubNav.tsx
  • components/humanDesign/LocationPicker.tsx
  • components/humanDesign/PersonalTab.tsx
  • components/humanDesign/PlanetIcon.tsx
  • components/humanDesign/TimeSelect.tsx
  • components/humanDesign/TimezonePickerModal.tsx
  • components/humanDesign/TransitTab.tsx
  • components/humanDesign/TransitView.tsx
  • components/humanDesign/useChartDisplayData.ts
  • components/humanDesign/useChartExportActions.ts
  • components/humanDesign/useChartSelection.ts
  • components/ui/calendar.tsx
  • lib/chartPayloads.ts
  • lib/chartRecompute.ts
  • lib/computeTransit.ts
  • lib/dbUser.ts
  • lib/getBirthProfiles.ts
  • lib/humanDesign/constants.ts
  • lib/humanDesign/engine.ts
  • lib/notificationsAdmin.ts
  • lib/saveChart.ts
  • lib/swissEph.ts
  • lib/swissEphServer.ts
  • lib/transitImpact.ts
  • lib/useBirthProfiles.ts
  • lib/useCharts.ts
  • lib/useNotifications.ts
  • mobile/app/(auth)/_layout.tsx
  • mobile/app/(auth)/sign-in.tsx
  • mobile/app/(tabs)/_layout.tsx
  • mobile/app/(tabs)/create.tsx
  • mobile/app/(tabs)/index.tsx
  • mobile/app/(tabs)/learn.tsx
  • mobile/app/(tabs)/profile.tsx
  • mobile/app/_layout.tsx
  • mobile/app/chart/[id].tsx
  • mobile/app/chart/preview.tsx
  • mobile/app/learn/[topic].tsx
  • mobile/app/oauth-native-callback.tsx
  • mobile/components/AppliedProfileCard.tsx
  • mobile/components/BirthDataForm.tsx
  • mobile/components/BirthProfilePickerModal.tsx
  • mobile/components/BirthProfileSheet.tsx
  • mobile/components/BodyGraph.tsx
  • mobile/components/ChartListView.tsx
  • mobile/components/CitySearchField.tsx
  • mobile/components/CompositeView.tsx
  • mobile/components/DateTimePicker.tsx
  • mobile/components/DetailBottomSheet.tsx
  • mobile/components/ErrorBoundary.tsx
  • mobile/components/InputModal.tsx
  • mobile/components/NavBackHeader.tsx
  • mobile/components/NotificationsView.tsx
  • mobile/components/StateViews.tsx
  • mobile/components/SubTabBar.tsx
  • mobile/components/TimezonePickerModal.tsx
  • mobile/components/TransitView.tsx
  • mobile/components/WheelPicker.tsx
  • mobile/components/chart/ChartPrimitives.tsx
  • mobile/components/chart/CompositeInfo.tsx
  • mobile/components/chart/PersonalChartDetails.tsx
  • mobile/components/chart/TransitAnalysis.tsx
  • mobile/components/composite/compositeText.ts
  • mobile/components/composite/useCompositeForm.ts
  • mobile/components/icons/IconBolt.tsx
  • mobile/components/icons/IconCheckCircle.tsx
  • mobile/components/icons/IconWarningTriangle.tsx
  • mobile/components/learn/CenterList.tsx
  • mobile/components/learn/ChannelList.tsx
  • mobile/components/learn/CompositeLearn.tsx
  • mobile/components/learn/GateList.tsx
  • mobile/components/learn/SummaryList.tsx
  • mobile/components/learn/TransitLearn.tsx
  • mobile/components/transit/GateChip.tsx
  • mobile/components/transit/ImpactCard.tsx
  • mobile/components/transit/icons.tsx
  • mobile/components/transit/useTransitForm.ts
  • mobile/contexts/ScrollLockContext.tsx
  • mobile/contexts/ThemeContext.tsx
  • mobile/hooks/useAccountSettings.ts
  • mobile/hooks/useBirthProfileManager.ts
  • mobile/hooks/useBirthProfiles.ts
  • mobile/hooks/useGoogleSignIn.ts
  • mobile/hooks/useKeyboardHeight.ts
  • mobile/hooks/useLineSignIn.ts
  • mobile/hooks/useOAuthSignIn.ts
  • mobile/lib/api.ts
  • mobile/lib/birthFormUtils.ts
  • mobile/lib/birthProfileMigration.ts
  • mobile/lib/birthProfiles.ts
  • mobile/lib/chartPdf.ts
  • mobile/lib/cities.ts
  • mobile/lib/hd-bodygraph-utils.ts
  • mobile/lib/hd-normalizers.ts
  • mobile/lib/hd-sheet-builders.ts
  • mobile/lib/hd-type-meta.ts
  • mobile/lib/pdf/actions.ts
  • mobile/lib/pdf/aiPrompts.ts
  • mobile/lib/pdf/bodyGraphSvg.ts
  • mobile/lib/pdf/compositeHtml.ts
  • mobile/lib/pdf/htmlHelpers.ts
  • mobile/lib/pdf/palette.ts
  • mobile/lib/pdf/personalChartHtml.ts
  • mobile/lib/pdf/transitHtml.ts
  • mobile/lib/pdf/types.ts
  • mobile/lib/useChartDetail.ts
  • shared/humanDesign/hd-chart-data.ts
  • shared/humanDesign/timezones.ts
  • utils/ephemeris.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant