From b47667f918415946461561f0bb1a73584769bdc2 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Thu, 20 Aug 2026 21:34:45 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20look=20a?= =?UTF-8?q?nd=20feel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/plans/web-portal-redesign.md | 188 ++++++++++++ web/app/app.vue | 63 ++-- web/app/assets/css/tailwind.css | 157 ++++++++++ web/app/components/AlertBox.vue | 8 +- web/app/components/AuthGate.vue | 19 +- web/app/pages/auth/callback.vue | 21 +- web/app/pages/documents/[documentId].vue | 271 +++++++++++------- .../pages/documents/create/[templateId].vue | 82 +++--- web/app/pages/index.vue | 44 +-- web/app/pages/templates/[id]/documents.vue | 133 +++++---- web/app/pages/templates/[id]/edit.vue | 140 ++++----- web/app/pages/templates/index.vue | 189 ++++++------ web/app/pages/templates/new.vue | 63 ++-- web/nuxt.config.ts | 18 ++ web/tailwind.config.ts | 42 +++ 15 files changed, 915 insertions(+), 523 deletions(-) create mode 100644 docs/plans/web-portal-redesign.md diff --git a/docs/plans/web-portal-redesign.md b/docs/plans/web-portal-redesign.md new file mode 100644 index 0000000..4b48955 --- /dev/null +++ b/docs/plans/web-portal-redesign.md @@ -0,0 +1,188 @@ +# Re-skin + Layout Modernization ของ Web Portal (design system จาก admincourt.go.th) + +## Context + +Web portal (`/web` — Nuxt 4 + Tailwind v3) ปัจจุบันใช้ default palette ตรงๆ ใน markup (~400 จุด: slate/sky/red/emerald/amber) กระจายใน 12 ไฟล์ .vue โดยไม่มี design token layer (`tailwind.config.ts` มีแค่ `darkMode: 'class''`, ไม่มีฟอนต์ไทย — ใช้ system font) และ layout เป็นแบบเก่า: header ไม่ sticky, container แคบ, ตารางทุกหน้ากินพื้นที่ overflow บนมือถือ, ไม่มีรูปแบบ page header ที่ consistent + +งานนี้ทำ 2 อย่างพร้อมกัน: +1. **Re-skin** ตาม scheme ของ admincourt.go.th: primary `#0000EE`, accent gold `#8F7226`, surface ขาว, elevated ครีม `#FBF7EC`, radius 8px, ปุ่ม pill, shadow นุ่ม, ฟอนต์ sukhumvit — ผ่านการ**สร้าง token layer ที่เหมาะสม** (ไม่ใช่ find-replace สี) +2. **Layout modernization + responsive**: sticky header, รูปแบบ page header มาตรฐาน, ตารางเปลี่ยนเป็น card list บนจอเล็ก (responsive table pattern สมัยใหม่), ฟอร์มจัด width และ action row ตามแนวปฏิบัติปัจจุบัน + +**ข้อตกลงกับผู้ใช้ (fixed):** +1. **เก็บ dark mode ต่อ** — derive dark palette จาก scheme (ครีม → warm near-black, `#0000EE` → indigo สว่าง) ใช้ CSS variables + `.dark` ต่อจาก useTheme/FOUC guard เดิม, `useTheme.spec.ts` ต้องเขียว +2. **ฟอนต์ผ่าน Google Fonts CDN** — Sarabun (ใกล้ Sukhumvit ที่สุด) น้ำหนัก 400/500/600/700 + stack `'Sukhumvit Set', 'Sarabun', ...` +3. Scope = `/web` เท่านั้น ห้ามแตะ `/addin`, `/backend` +4. (เพิ่มจาก feedback) Layout ต้องเป็น modern standard + responsive เต็มรูปแบบ + +## ขั้นตอนที่ 0 — บันทึกแผนลง repo + +เขียนแผนฉบับนี้ไว้ที่ `docs/plans/web-portal-redesign.md` (ทำเป็น action แรกหลังอนุมัติแผน) เพื่อให้ session ถัดไปหยิบไป implement ต่อได้ — สอดคล้องกับธรรมเนียม `docs/plans/officejs-implementation-plan.md` ของ repo + +## ส่วนที่ 1 — Token layer (re-skin) + +### สถาปัตยกรรม + +- **CSS custom properties** (`:root` + `.dark`) เป็น source of truth ของสี, expose ผ่าน `theme.extend.colors` ด้วย `rgb(var(--c-x) / )` — `bg-primary/10` ฯลฯ ใช้ได้ และ **`dark:` variants ~209 จุดหายเกือบหมด** (สีพลิกผ่านตัวแปร) + - ⚠️ ตัวแปรต้องเป็น RGB triplet เว้นวรรค (`0 0 238`) — hex จะ break slash-opacity แบบเงียบ +- **`@layer components` + `@apply`** สำหรับ pattern ที่ repeat — ไม่สร้าง Vue component (ปุ่มเป็น mix ของ `