timmy
08b456a96e
UI 新增資料更新時間 badge
...
在地圖右下角顯示後端 /scan response 新增的 generated_at 欄位,
以中文相對時間呈現(剛剛 / N 分鐘前 / N 小時前 / 絕對日期),
每 10 秒自動重算顯示,資料空或缺欄位時保留上次值。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-04-20 11:17:36 +08:00
timmy
0ad7f0fba5
前端空資料自動重試,改善 Redis 冷啟動 UX
...
後端 Redis key 過期時會先回空陣列、背景 fetcher 約 30-60 秒
填回資料。過去前端只要拿到空 items 就直接顯示紅色錯誤框,
使用者第一次開頁面撞上這個暫態會誤以為服務壞了。
這次把「空資料」視為暫態而非錯誤:顯示中性的 loading banner
並每 8 秒自動重試,最多 10 次(總 80 秒)。拿到資料立即停止
polling 並渲染;超過上限仍空則改顯示中性的稍後重試提示,
不再使用紅色錯誤框。真正的 network / HTTP / JSON 錯誤維持
原本的紅框行為。
新增:showStatus / clearStatus / scheduleRetry / clearRetry、
retryCount / retryTimer 狀態變數、renderItems 抽出 marker 渲染、
loadScan 包裝整個 fetch 流程,beforeunload 清 timer 防 leak。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-04-20 11:13:27 +08:00
timmy
3489b4ffa1
將 API_URL 改為 HTTPS 端點,透過 NPM 反代解決 Mixed Content
...
前端透過 HTTPS 提供時,瀏覽器會阻擋對 HTTP 後端的請求。
改走 https://poke-api.lotimmy.com/scan(由 NPM 反向代理到內網 8008 port)
即可避免 Mixed Content 錯誤。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-04-20 10:25:10 +08:00
timmy
9868116043
修正 API 端點 IP:88.108 改為 42.108
...
前一版誤植為 192.168.88.108,實際後端主機位址為 192.168.42.108,
port 8008 維持不變。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-04-20 10:05:50 +08:00
timmy
473211c86c
將資料來源從 spots.json 切換到後端 /scan API
...
- 於檔頭新增 API_URL / SCAN_CENTER 常數,方便之後切換 IP / port
- fetch 改 POST,body 帶 lat/lng(後端要求的 schema,值本身會被忽略)
- 空 items 改顯示「目前無資料」提示,處理 API stale-while-revalidate
快取剛過期時首打會回空陣列的情境
- 保留 toList() 對頂層陣列的相容、保留座標欄位三種別名 fallback
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-04-20 10:01:55 +08:00
timmy
aa89c77d52
Initial commit: Leaflet map showing Pokémon GO spots in Taiwan
...
Features:
- Static single-page Leaflet map with pokémon markers
- LINE Seed TW font, custom-styled popups
- Blue glow for normal pokémon, gold glow for 100% IV
- Custom zoom + locate control bar
- Live remaining-time calculation from expire_time
2026-04-20 08:41:26 +08:00