Skip to content

Latest commit

 

History

History
102 lines (92 loc) · 5.36 KB

brain.md

File metadata and controls

102 lines (92 loc) · 5.36 KB

TrueWeb — Project Brain

Last updated: 2026-08-19

What this is

A single-page SIM recommendation quiz for True/Dtac travel SIM packages. User answers 5 questions about their trip → app recommends one of 5 SIM products via a fixed decision matrix, with personalized behavior badges. Built as a plain static site (no framework, no build step) so it deploys to Vercel with zero config.

Source spec: sim_recommendation_quiz.md (product matrix + quiz logic, in Thai). This is the source of truth for the decision rules.

Repo

  • GitHub: https://github.com/teerapatwork-code/TrueWeb.git
  • Branch: main
  • Deploy target: Vercel (static site, framework preset "Other", no build command, output = repo root). Not yet deployed as of this writing — user was about to import the repo into Vercel.

File structure

  • index.html — all markup: navbar, hero/start screen, quiz screen, result screen. Text nodes have IDs so JS can swap language.
  • style.css — "Aura gradient red" theme: dark crimson background, animated blurred red/gold blobs, glassmorphic cards, Prompt font (+ Noto Sans SC/Myanmar/Khmer for non-Thai scripts). Navbar is position: sticky; .app height is calc(100vh - var(--nav-h)) to account for it.
  • script.js — app logic: quiz state machine, decision logic (computeResult), badge logic (computeBadgeKeys), rendering, language-switcher wiring. QUESTIONS/PRODUCT_IMAGES hold only structural data (ids, image paths) — all copy comes from i18n.js.
  • i18n.js — full translation dictionary for 5 languages (th default, en, zh, my, km) plus LANGUAGES metadata (flag/native name/English label) used to render the dropdown.
  • assets/ — working copies of product images, renamed cleanly (sim-mm.png, sim-kh.jpg, tourist-8d.png, tourist-15d.png, tourist-30d.png, hero.png).

Note: the original source images (Hero.png, True 1.png, True 2.jpg, Dtac 1.png, Dtac 2.jpg, 3.png, 4.png, 6.png) still sit at the repo root, unused by the site — they're just the raw files the user dropped in. Left in place since removing them wasn't asked for. sim_recommendation_quiz.md is also at repo root and will be publicly readable once deployed (not linked from the site, but not private either).

Decision logic (from the spec, implemented in computeResult)

  • Q1 = Myanmar or Cambodia AND Q2 = 1–5 days → the matching 49฿ neighbor SIM (SIM-MM-49 / SIM-KH-49)
  • Everything else (other region, or neighbor-country traveler staying longer than 5 days) routes by Q2 alone:
    • 1–8 days → TOURIST-8D (499฿)
    • 9–15 days → TOURIST-15D (699฿)
    • 16–30+ days → TOURIST-30D (1,199฿)

Badges (from Q3/Q4/Q5, can combine): heavy streamer/social badge, hotspot/multi-device badge, best-budget-value badge (neighbor SIMs only).

What we built today, in order

  1. Base quiz app — 5-question flow, red aura gradient design, glassmorphism, product images pulled from the user's own True/Dtac screenshots (matched to the exact 5 SKUs in the spec).
  2. Renamed the order CTA — "สั่งซื้อเลย" → "ต้องการซื้อสินค้าตัวนี้". It's still a placeholder (shows a 2.2s "Order received ✓" confirmation, no real link/backend) — deliberately not guessing a purchase URL.
  3. Hero section — added the user's Hero.png (travel/globe image) as a two-column hero visual with a pulsing glow and floating chips; stacks to single-column on mobile.
  4. Responsiveness pass — verified 0px horizontal overflow across 6 device sizes (360px phone → 1920px desktop) using Playwright/CDP with the real Edge browser, after discovering plain msedge --headless --window-size=... ignores the requested viewport on this machine (fixed ~492px regardless of flag) — don't trust that flag for viewport testing here again; use Playwright's newPage({ viewport }) instead.
  5. 5-language i18n system — top navbar with a language-switcher dropdown (flag + native name + English label + checkmark), default Thai, 4 more languages (EN/ZH/MY/KM). Every string in the app is translated (hero, all 5 questions + options, result screen, product specs, badges) via i18n.js. Switching language mid-quiz preserves progress. Selection persists via localStorage (sim-quiz-lang). Added Google Fonts for Chinese/Burmese/Khmer script rendering.
  6. Git setup — initialized repo, committed everything, pushed to the user's GitHub repo (main branch, was empty before this).

Known caveats / things to revisit

  • MY (Burmese) and KM (Khmer) translations are AI-drafted, not reviewed by a native speaker. Told the user to get a native review before real launch, especially telecom terms. Convention followed: kept tech loanwords (5G, WiFi, SIM, Hotspot, TikTok) in Latin script, matching how the user's own product images do it.
  • Order button has no real destination — needs a purchase link, contact form, or LINE/backend hookup before this goes live for real customers.
  • ZH translations are Simplified Chinese (assumed mainland/general audience default) — flag if the target audience is more Traditional-Chinese-reading (Taiwan/HK tourists).
  • Repo has some unused raw image files + the internal spec doc sitting at root (see File structure note above) — cosmetic only, not a bug.