feat: 店家頁新增記錄改用記錄類型選擇視窗#54
Open
sean2249 wants to merge 2 commits into
Open
Conversation
店家詳情頁的「新增記錄」原本直接跳品鑑表單,改成彈出視窗讓使用者 先選杯測或品鑑,兩個選項都帶 ?shop= 預填店家連結。 抽出共用 newModePickerOptions(shopId),讓 #/new 選擇頁與店家 modal 吃同一份選項來源,避免兩處複製貼上各自漂移。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
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.
新增 vitest 測試,驗證有/無 shopId 兩種情況下杯測與品鑑的 href,以及 shopId 的 url-encode,避免日後改記錄類型時兩個 呼叫點(#/new 頁與店家 modal)默默漂移。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
變更
店家詳情頁(
#/shops/<id>)的「新增記錄」按鈕,原本直接跳到品鑑表單,現在改成彈出選擇視窗,讓使用者先選記錄類型(杯測 / 品鑑)。?shop=<id>,所以無論選哪種,表單的店家下拉都會自動預填這家店(透過既有的prefillShopId→applyShopPrefill)。modal-backdrop-custom/modal-shell結構(與 Google 補完視窗同款)和.new-mode-picker樣式。<a href="#/new/...">走原本的 hash router 導頁。為什麼
杯測記錄也可連結店家(刪店家時杯測記錄保留但失去連結),原本直接跳品鑑等於默默替使用者做了選擇。改成彈窗讓兩種類型都能從店家頁建立。
重構
抽出共用函式
newModePickerOptions(shopId),讓#/new選擇頁與店家 modal 吃同一份選項來源,避免兩處 HTML 複製貼上後各自漂移;以後加記錄類型只動一處。給 reviewer
npm run lint(eslint)通過。#/new、以及進某家店點「新增記錄」,確認兩個入口選項一致、且從店家進去後表單店家欄位已預填。🤖 Generated with Claude Code