Skip to content

feat: 店家頁新增記錄改用記錄類型選擇視窗#54

Open
sean2249 wants to merge 2 commits into
mainfrom
claude/gallant-wilson-b8c8b9
Open

feat: 店家頁新增記錄改用記錄類型選擇視窗#54
sean2249 wants to merge 2 commits into
mainfrom
claude/gallant-wilson-b8c8b9

Conversation

@sean2249

Copy link
Copy Markdown
Owner

變更

店家詳情頁(#/shops/<id>)的「新增記錄」按鈕,原本直接跳到品鑑表單,現在改成彈出選擇視窗,讓使用者先選記錄類型(杯測 / 品鑑)。

  • 兩個選項都帶 ?shop=<id>,所以無論選哪種,表單的店家下拉都會自動預填這家店(透過既有的 prefillShopIdapplyShopPrefill)。
  • modal 沿用既有 modal-backdrop-custom / modal-shell 結構(與 Google 補完視窗同款)和 .new-mode-picker 樣式。
  • 點 X、點背景、或選任一類型都會關閉視窗;選項用 <a href="#/new/..."> 走原本的 hash router 導頁。

為什麼

杯測記錄也可連結店家(刪店家時杯測記錄保留但失去連結),原本直接跳品鑑等於默默替使用者做了選擇。改成彈窗讓兩種類型都能從店家頁建立。

重構

抽出共用函式 newModePickerOptions(shopId),讓 #/new 選擇頁與店家 modal 吃同一份選項來源,避免兩處 HTML 複製貼上後各自漂移;以後加記錄類型只動一處。

給 reviewer

  • 無 schema / 欄位變更,無需動 SQL 或 sw.js VERSION。
  • npm run lint(eslint)通過。
  • 無測試套件;建議手動驗證:側欄「+」進 #/new、以及進某家店點「新增記錄」,確認兩個入口選項一致、且從店家進去後表單店家欄位已預填。

🤖 Generated with Claude Code

店家詳情頁的「新增記錄」原本直接跳品鑑表單,改成彈出視窗讓使用者
先選杯測或品鑑,兩個選項都帶 ?shop= 預填店家連結。

抽出共用 newModePickerOptions(shopId),讓 #/new 選擇頁與店家 modal
吃同一份選項來源,避免兩處複製貼上各自漂移。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 13, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

此 PR 調整店家詳情頁(#/shops/<id>)的「新增記錄」入口:由原本直接導到品鑑表單,改為先彈出記錄類型選擇視窗,讓使用者明確選擇要新增「杯測 / 品鑑」,並在導頁時保留 ?shop=<id> 以延用既有預填店家邏輯。

Changes:

  • 新增共用的 newModePickerOptions(shopId),集中產生「杯測 / 品鑑」兩個選項的連結,避免 #/new 與店家彈窗重複 HTML。
  • 店家頁「新增記錄」按鈕改為開啟 modal,點選類型後用 hash router 導頁並自動關閉 modal。
  • #/new 選擇頁改用共用函式產生選項 UI。

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app.js
Comment thread app.js
新增 vitest 測試,驗證有/無 shopId 兩種情況下杯測與品鑑的
href,以及 shopId 的 url-encode,避免日後改記錄類型時兩個
呼叫點(#/new 頁與店家 modal)默默漂移。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants