feat: move visit creation to modal with fab and geocoding updates

This commit is contained in:
2025-09-30 16:22:34 +08:00
parent cf266880bb
commit ac298047dd
11 changed files with 277 additions and 104 deletions

View File

@@ -20,7 +20,7 @@ traveling-around-the-world/
### 技術與工具
- Vite + React 18 + TypeScript
- React Router 規劃 SPA 路由
- Zustand 追蹤 UI 狀態(表單抽屜開關與初始座標)
- Zustand 追蹤 UI 狀態(訪問表單 Modal 與初始座標)
- React Query 統一處理資料讀寫與快取
- React Hook Form + Zod 表單驗證
- react-leaflet + OpenStreetMap 圖資,支援地圖點擊新增足跡
@@ -30,7 +30,8 @@ traveling-around-the-world/
- `features/map`Leaflet 地圖、點擊事件、旅遊標記
- `features/visits`資料型別、LocalStorage Repository、React Query hooks、統計卡片與表單元件
- `components/layout`:頁面主框架、側邊欄
- `state`Zustand store 控制表單抽屜
- `state`Zustand store 控制訪問建立/編輯的 Modal
- `components/overlay/VisitModal`:以 Modal 呈現足跡表單,地圖右下角的 `+` 漂浮按鈕或點擊地圖即可開啟
### LocalStorage → API 的切換
- 預設 `VisitProvider mode="local"` 會載入 `localVisitRepository`
@@ -82,7 +83,7 @@ RESTful 端點:
## 開發流程建議
1. **LocalStorage MVP**:僅啟動前端即可使用,點擊地圖開啟表單、資料存在瀏覽器。
2. **串接 API**:建立 MongoDB啟動 `npm run dev` 後將前端 `VisitProvider` 切換到 API 模式。
3. **Geocoding**`features/visits/utils/geocoding.ts` 預留反向地理編碼函式,可透過自建 API Proxy 存取 Nominatim
3. **Geocoding**前端已透過 Nominatim 反向地理編碼在點擊地圖時預填國家 / 城市;若需更高配額可在後端建立 Proxy
4. **照片/檔案**:後端可擴增 S3/Cloudinary 上傳,再於前端 `VisitCreateInput` 增加檔案欄位。
## 待辦與下一步