From 2e794cd36519ffd4fe38f1fc564080f0b1fe16ae Mon Sep 17 00:00:00 2001 From: Bkk1234 Date: Mon, 16 Nov 2026 00:20:11 +0700 Subject: [PATCH] =?UTF-8?q?feat(home):=20=E0=B8=9B=E0=B8=B8=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=20"=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B9=82?= =?UTF-8?q?=E0=B8=A3=E0=B8=87=E0=B8=AB=E0=B8=99=E0=B8=B1=E0=B8=87=E0=B9=80?= =?UTF-8?q?=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1=E0=B9=80=E0=B8=95=E0=B8=B4?= =?UTF-8?q?=E0=B8=A1"=20+=20=E0=B8=9B=E0=B8=B8=E0=B9=88=E0=B8=A1=20"?= =?UTF-8?q?=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B9=82=E0=B8=A3=E0=B8=87?= =?UTF-8?q?=E0=B8=AB=E0=B8=99=E0=B8=B1=E0=B8=87=E0=B8=99=E0=B9=89=E0=B8=AD?= =?UTF-8?q?=E0=B8=A2=E0=B8=A5=E0=B8=87"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - เปลี่ยนข้อความปุ่มจาก "แสดงเพิ่ม" → "แสดงโรงหนังเพิ่มเติม" (en: Show more cinemas) - เมื่อแสดงครบแล้วมีปุ่ม "แสดงโรงหนังน้อยลง" (en: Show fewer cinemas) ย่อกลับเหลือ 4 ใบ แล้วเลื่อนกลับไปที่หัวข้อผลลัพธ์ (เคารพ prefers-reduced-motion) - i18n: เพิ่ม list.showLess ทั้ง TH/EN · ปรับ list.showMore - อัปเดต term override ใน content.json (site.terms) ให้ตรงกัน — term ทับค่าใน messages.ts - DESIGN.md: บันทึกกฎ "term จากหลังบ้าน override messages" (เคสที่ทำให้แก้คำแล้วหน้าไม่เปลี่ยน) --- DESIGN.md | 1 + app/lib/i18n/messages.ts | 7 +++++-- app/routes/_index.tsx | 18 +++++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 934f290..1a85abb 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -156,6 +156,7 @@ Single source of truth per concern — do not duplicate these: - `app/lib/design-tokens.ts` — ค่าสีจาก Figma สำหรับ inline style (Tailwind class ยังเป็น literal เสมอ) - `app/lib/i18n/` — `messages.ts` (ข้อความ TH/EN ทั้งหมด คีย์หมวดหมู่/tag/ชำระเงิน/สิ่งอำนวยความสะดวก), `index.tsx` (`LocaleProvider`, `useI18n`, cookie `locale`) - ข้อความทุกคำใน UI ต้องมาจาก `messages` ไม่ hardcode ใน component · หมวดหมู่และ tag เก็บคีย์เป็นภาษาไทยเสมอ (ใช้กรองข้อมูล) แล้วแปลด้วย `messages.categories` / `messages.tags` +- **ระวัง: ข้อความอาจถูก override จากหลังบ้าน** — `data/content/content.json → site.terms[]` เก็บ `{ key, values: { th, en } }` (dot path เช่น `list.showMore`) และ **ทับค่าใน `messages.ts`** · แก้คำบนหน้าเว็บแล้วไม่เปลี่ยน → ตรวจ term ตัวนั้นก่อน (แท็บ "คำศัพท์หลายภาษา") · เวลาเปลี่ยนข้อความตั้งต้นให้แก้ทั้ง `messages.ts` และ term ที่มีอยู่ (หรือลบ term ทิ้งเพื่อให้ใช้ค่า defaults) - ข้อความอังกฤษของเนื้อหาโรงหนังเป็นฟิลด์เสริม `location_label_en` / `description_en` / `address_lines_en` / `value_en` — ไม่กรอกก็ fallback ไทย · ชื่อไทยใช้ `name_th` (+ helper `cinemaName(cinema, locale)`), ไม่กรอกก็แสดงชื่ออังกฤษ - `` ของหน้ารายละเอียดสร้างจาก loader ของ route เอง (`meta({ loaderData })` — เวอร์ชันนี้ส่ง `loaderData` ไม่ใช่ `data`) - `<head>` (title/description) ไม่เปลี่ยนตามภาษา; ภาษาเริ่มต้นเลือกตามลำดับ **?lang= → localStorage → cookie → ไทย** (`resolveInitialLocale`) — ตั้งใจไม่ใช้ `navigator.language` เพราะเว็บไทย-first diff --git a/app/lib/i18n/messages.ts b/app/lib/i18n/messages.ts index c3599f5..f0fdc03 100644 --- a/app/lib/i18n/messages.ts +++ b/app/lib/i18n/messages.ts @@ -99,6 +99,7 @@ export type Messages = { list: { title: string; showMore: string; + showLess: string; empty: string; }; card: { @@ -232,7 +233,8 @@ const TH: Messages = { }, list: { title: "รายชื่อโรงหนังทุกประเภทและกลุ่มคนฉายหนัง", - showMore: "แสดงเพิ่ม", + showMore: "แสดงโรงหนังเพิ่มเติม", + showLess: "แสดงโรงหนังน้อยลง", empty: "ไม่พบโรงหนังที่ตรงกับคำค้น ลองเปลี่ยนคำหรือหมวดหมู่ดู", }, card: { @@ -401,7 +403,8 @@ const EN: Messages = { }, list: { title: "Local cinemas, indie screens and film collectives", - showMore: "Show more", + showMore: "Show more cinemas", + showLess: "Show fewer cinemas", empty: "No cinema matches that search. Try another word or category.", }, card: { diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 4440454..705e218 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -185,12 +185,28 @@ export default function HomeRoute() { <button type="button" onClick={() => setShowAll(true)} - className="h-10 w-[200px] rounded-lg border border-[#8F0808] bg-[#8F0808] transition hover:bg-[#a30a0a]" + className="h-10 w-[220px] rounded-lg border border-[#8F0808] bg-[#8F0808] transition hover:bg-[#a30a0a]" > {messages.list.showMore} </button> </Reveal> ) : null} + + {showAll && ordered.length > INITIAL_VISIBLE ? ( + <Reveal kind="fade" className="flex justify-center pt-2"> + <button + type="button" + onClick={() => { + setShowAll(false); + // ย่อกลับแล้วพาผู้ใช้ขึ้นไปที่หัวข้อผลลัพธ์ ไม่ให้ค้างอยู่ท้ายหน้า + scrollIntoViewRespectMotion(resultsRef.current); + }} + className="h-10 w-[220px] rounded-lg border border-[#303030] px-4 text-sm transition hover:border-[#A92626] hover:text-[#D47272]" + > + {messages.list.showLess} + </button> + </Reveal> + ) : null} </section> </main> </SiteShell>