พอร์ต UI จาก web-at-transit-mock เข้า Next.js + data sync เข้า Postgres/SeaweedFS
- 8 หน้า (home/stops/routes/stop/check/blog/about/credits) แปลง partials → React component ตรง mock
- ตรรกะพอร์ตเป็น src/lib/ui/*.ts (mount()) + runtime/PageRuntime
- CSS: base + pages/*.css import ต่อ route (คงลำดับ cascade ของ mock)
- asset/content: public/{image,resource/data,content,locales,vendor}
- แก้ path รูปไทล์พาร์ทเนอร์ (.image → /image) + fallback absolute
- ลบ UI เดิมที่ไม่ตรง mock (expanded/stops details/old components/globals.css)
- script/sync_data_to_postgres.mjs + sync_images_to_storage.mjs (dry-run/--apply, backup)
- docs/UI-PORT.md + DESIGN.md + README
This commit is contained in:
1 parent
24187fc3b7
commit
138a3d15d8
300 files changed
+20213
-1978
No files matched your search
@@ -0,0 +1,34 @@
|
||||
// @ts-nocheck
|
||||
/* Ported from web-at-transit-mock/ui/imageurl.js — logic unchanged. */
|
||||
/* ============================================================
|
||||
Atroute — ตัวช่วยเติมเวอร์ชันให้ URL รูป (cache busting)
|
||||
------------------------------------------------------------
|
||||
ปัญหา: SW ใช้ cache-first กับรูป → อัปรูปทับชื่อเดิมแล้วไม่เห็นรูปใหม่
|
||||
วิธีแก้ (แนวทาง B2): เติม ?v=<SW VERSION> ต่อท้าย URL รูปทุกตัว
|
||||
→ bump VERSION ใน sw.js = รูปทั้งหมดโหลดใหม่พร้อมกัน
|
||||
|
||||
ใช้: ImgURL.of(url) → '/image/x.jpg?v=2026.09.27.23'
|
||||
ImgURL.version() → '2026.09.27.23'
|
||||
============================================================ */
|
||||
(function () {
|
||||
'use strict';
|
||||
var V = null; /* cache ของเวอร์ชัน */
|
||||
|
||||
function version() {
|
||||
if (V) return V;
|
||||
/* อ่านเวอร์ชันจาก <meta name="app-version"> ถ้ามี (set ใน index.html) */
|
||||
var m = document.querySelector('meta[name="app-version"]');
|
||||
V = (m && m.content) ? m.content : '0';
|
||||
return V;
|
||||
}
|
||||
/* เติม ?v= ให้ URL รูป (ข้าม URL ภายนอก/ไฟล์ข้อมูล/ที่เติม ?v= แล้ว) */
|
||||
function of(url) {
|
||||
var u = String(url == null ? '' : url);
|
||||
if (!u || u.indexOf('data:') === 0 || u.indexOf('blob:') === 0) return u;
|
||||
if (u.indexOf('//') === 0 || /^https?:\/\//i.test(u)) return u; /* URL เต็ม/ภายนอก — ไม่แตะ */
|
||||
if (/[?&]v=/.test(u)) return u;
|
||||
return u + (u.indexOf('?') > -1 ? '&' : '?') + 'v=' + encodeURIComponent(version());
|
||||
}
|
||||
window.ImgURL = { of: of, version: version };
|
||||
})();
|
||||
export {};
|
||||
Reference in new issue
Block a user