Store images as single zip; add setup.sh and README workflow

- Compress resource/images/ (~31MB) into resource/images.zip and untrack
  the 62 individual binaries so future image changes do not bloat git history
- Add setup.sh to unpack the zip after clone (idempotent)
- gitignore resource/images/ and .DS_Store
- Document run + image-management steps in README.md
This commit is contained in:
phattaranun.a committed 2026-09-12 12:20:33 +07:00
1 parent b2383ca7d0
commit ebcae74f3c
66 files changed
+50 -236

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
# รูปทั้งหมดถูกบีบไว้ใน resource/images.zip — อย่า commit ไฟล์ที่แตกออกมา
resource/images/
# ไฟล์ขยะ macOS
.DS_Store
+22 -6
View File
@@ -17,14 +17,16 @@ web-at-transit-mock/
│ └── partials/ view ละ 1 ไฟล์ (router fetch + inject)
└── resource/
├── data/ ← ข้อมูล mock: routes.json, schedules.json, stations.json, ...
└── images/ ← รูปทั้งหมด
├── images.zip ← ★ รูปทั้งหมด (บีบไว้ — แตกด้วย setup.sh)
└── images/ ← (เกิดหลังรัน setup.sh — ไม่ commit)
```
## วิธี run
```bash
cd web-at-transit-mock
python3 -m http.server 8090
./setup.sh # 1. แตก resource/images.zip → resource/images/ (ครั้งเดียว)
python3 -m http.server 8090 # 2. รัน static server
```
แล้วเปิดเบราว์เซอร์ที่:
@@ -35,10 +37,24 @@ http://localhost:8090/ui/index.html
### เงื่อนไขสำคัญ
1. **ต้อง serve จาก root ของ repo** (ไม่ใช่จาก `ui/`) — รูปและข้อมูลอ้างอิงด้วย
relative path `../resource/...` ถ้า serve ผิดตำแหน่ง path จะพัง
2. **ห้ามเปิด `file://`** — fetch JSON + relative path จะใช้ไม่ได้ ต้องผ่าน static server เสมอ
3. เปลี่ยน port ได้โดยแก้เลข `8090` (เช่น `python3 -m http.server 8080`)
1. **ต้องรัน `./setup.sh` ก่อน** — ไม่งั้นรูปพังทั้งหน้า (relative path `../resource/images/...` หาไฟล์ไม่เจอ)
2. **ต้อง serve จาก root ของ repo** (ไม่ใช่จาก `ui/`) — รูปและข้อมูลอ้างอิงด้วย relative path
3. **ห้ามเปิด `file://`** — fetch JSON + relative path จะใช้ไม่ได้ ต้องผ่าน static server เสมอ
4. เปลี่ยน port ได้โดยแก้เลข `8090` (เช่น `python3 -m http.server 8080`)
## การจัดการรูปภาพ (images)
รูปทั้งหมด (~31MB) ถูกบีบเป็นไฟล์เดียว `resource/images.zip` เพื่อไม่ให้ git พองจาก binary:
- **แตกไฟล์**: `./setup.sh` (idempotent — ถ้ามี `resource/images/` แล้วจะข้าม)
- **เพิ่ม/เปลี่ยนรูป**: แก้ที่ `resource/images/` แล้ว re-zip:
```bash
cd resource && zip -r -X images.zip images -x "*.DS_Store"
```
แล้ว commit `resource/images.zip`
- **ห้าม commit ไฟล์ใน `resource/images/`** — อยู่ใน `.gitignore` แล้ว
## หมายเหตุ (ไม่ต้องแก้)
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 KiB

@@ -1,18 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="13" r="8" />
<path d="M12 9v4l2 2" />
<path d="M5 3 2 6" />
<path d="m22 6-3-3" />
<path d="M6.38 18.7 4 21" />
<path d="M17.64 18.67 20 21" />
</svg>

Before

Width:  |  Height:  |  Size: 384 B

@@ -1,14 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M5 12h14" />
<path d="m12 5 7 7-7 7" />
</svg>

Before

Width:  |  Height:  |  Size: 261 B

@@ -1,21 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M4 6 2 7" />
<path d="M10 6h4" />
<path d="m22 7-2-1" />
<rect width="16" height="16" x="4" y="3" rx="2" />
<path d="M4 11h16" />
<path d="M8 15h.01" />
<path d="M16 15h.01" />
<path d="M6 19v2" />
<path d="M18 21v-2" />
</svg>

Before

Width:  |  Height:  |  Size: 456 B

-19
View File
@@ -1,19 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 6v6" />
<path d="M15 6v6" />
<path d="M2 12h19.6" />
<path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3" />
<circle cx="7" cy="18" r="2" />
<path d="M9 18h5" />
<circle cx="16" cy="18" r="2" />
</svg>

Before

Width:  |  Height:  |  Size: 492 B

-13
View File
@@ -1,13 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M20 6 9 17l-5-5" />
</svg>

Before

Width:  |  Height:  |  Size: 239 B

-14
View File
@@ -1,14 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="10" />
<path d="M12 6v6l4 2" />
</svg>

Before

Width:  |  Height:  |  Size: 271 B

-15
View File
@@ -1,15 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="12" cy="12" r="10" />
<path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" />
<path d="M2 12h20" />
</svg>

Before

Width:  |  Height:  |  Size: 331 B

@@ -1,16 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M5 22h14" />
<path d="M5 2h14" />
<path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22" />
<path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2" />
</svg>

Before

Width:  |  Height:  |  Size: 432 B

-14
View File
@@ -1,14 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" />
<circle cx="12" cy="10" r="3" />
</svg>

Before

Width:  |  Height:  |  Size: 359 B

-15
View File
@@ -1,15 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z" />
<path d="M15 5.764v15" />
<path d="M9 3.236v15" />
</svg>

Before

Width:  |  Height:  |  Size: 516 B

@@ -1,13 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" />
</svg>

Before

Width:  |  Height:  |  Size: 347 B

-13
View File
@@ -1,13 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384" />
</svg>

Before

Width:  |  Height:  |  Size: 437 B

@@ -1,16 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
<path d="M21 3v5h-5" />
<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
<path d="M8 16H3v5" />
</svg>

Before

Width:  |  Height:  |  Size: 392 B

-14
View File
@@ -1,14 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m21 21-4.34-4.34" />
<circle cx="11" cy="11" r="8" />
</svg>

Before

Width:  |  Height:  |  Size: 275 B

@@ -1,15 +0,0 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" />
<path d="M12 9v4" />
<path d="M12 17h.01" />
</svg>

Before

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

Executable
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# ============================================================
# AT Transit mockup — แตกไฟล์รูปภาพ
# รันครั้งเดียวหลัง clone เพื่อแตก resource/images.zip → resource/images/
# (idempotent: ถ้ามี resource/images/ อยู่แล้วจะข้าม)
# ============================================================
set -euo pipefail
cd "$(dirname "$0")"
if [ -d resource/images ]; then
echo "✔ resource/images/ มีอยู่แล้ว — ข้ามการแตกไฟล์"
exit 0
fi
if ! command -v unzip >/dev/null 2>&1; then
echo "✘ ไม่พบคำสั่ง unzip — ติดตั้งก่อน (brew install unzip) หรือแตก resource/images.zip เอง" >&2
exit 1
fi
echo "→ กำลังแตก resource/images.zip ..."
unzip -q resource/images.zip -d resource/
echo "✔ เสร็จ — รูปทั้งหมดอยู่ที่ resource/images/"