Repository navigation
feat: dynamic hero backgrounds per indigenous language - #21
Conversation
Greptile SummaryThis PR adds per-language dynamic hero backgrounds to the landing page by mapping each of the 8 supported indigenous languages to a country-specific background image (learner + elder variants). It also tightens the hero overlay with a
Confidence Score: 5/5Safe to merge — the change swaps two static image imports for a glob-based lookup; TypeScript enforces that every All 8 supported languages have matching PNG files committed for both roles, the z-index layering in the CSS overlay is correct, and the No files require special attention.
|
| Filename | Overview |
|---|---|
| src/lib/learningLanguages.ts | Adds import.meta.glob eager bundle for background PNGs and the LANGUAGE_BG lookup map; fallback returns an empty string on key miss (already flagged in a prior thread). LEARNING_LANGUAGE_METADATA already stores country names making the language→country mapping a second source of truth. |
| src/pages/LandingPage.tsx | Removes static background imports, narrows learningLanguage prop type to LearningLanguage, and threads it into ElderLanding; LANGUAGE_BG lookup is always valid because the type system guarantees a key exists. |
| src/pages/LandingPage.css | Adds ::after dark overlay (z-index 1) inside the hero stacking context; greeting (z-index 2) and badge (z-index 3) remain correctly above it. Greeting color updated to #ffedd6 with text-shadow removed. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[LandingPage mounts] --> B[resolveLearningLanguage\nfrom user profile]
B --> C{isElder?}
C -- Yes --> D[ElderLanding\nlearningLanguage prop]
C -- No --> E[LearnerLanding\nlearningLanguage prop]
D --> F[LANGUAGE_BG\nlanguage .elder]
E --> G[LANGUAGE_BG\nlanguage .learner]
F --> H[import.meta.glob\neager bundle lookup]
G --> H
H --> I[Resolved PNG URL\nfrom assets/landing/background/]
I --> J[img src rendered\nin .landing-hero]
J --> K[::after overlay\nrgba 0,0,0,0.32 z-index 1]
K --> L[Greeting span\nz-index 2]
K --> M[LearningLanguageBadge\nz-index 3]
Reviews (2): Last reviewed commit: "feat: switch landing backgrounds by lang..." | Re-trigger Greptile
21e833c to
a05c2bb
Compare
Summary
LANGUAGE_COUNTRYandLANGUAGE_BGmaps tolearningLanguages.ts;LANGUAGE_BGusesimport.meta.globto eagerly bundle 20 per-country background images (learner + elder variants) and resolves the correct one from the user's chosen indigenous languagebackground-learner.png/background-elder.pngimports inLandingPage.tsxwith aLANGUAGE_BG[learningLanguage]lookup;learningLanguageprop now flows intoElderLandingas wellassets/landing/background/(Indonesia, Malaysia, Thailand, Cambodia, Philippines, Vietnam, Singapore, Myanmar + Brunei, Laos for future languages)::afterdark overlay (rgba(0,0,0,0.32)) on.landing-heroso text and badges remain legible against brighter backgroundsTest plan
npm run test:run)🤖 Generated with Claude Code