Skip to content

heroyik/redgold

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

114 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Redgold Logo

โœจ REDGOLD 1.0.3 โ€” Lesson Deep Links โœจ

Textbooks are mid. Master the bridge from HSK 4 to real-world talk.
The perfect fusion of academic precision and colloquial soul.

Version Status Stack Design


๐Ÿฎ The Philosophy: Red Meets Gold

In traditional Chinese learning, there has always been a disconnect.

  • The Red: Represents the formal, structured HSK curriculumโ€”essential for exams but often sounding "robotic" in real life.
  • The Gold: Represents the colloquial, native rhythmโ€”the way people actually talk in the streets of Beijing or Shanghai.

RedGold bridges this gap. We transform the HSK 4 Standard Course into a premium, interactive experience that teaches you not just what to say, but how to say it like a native.


๐Ÿš€ Core Features

๐ŸŽฌ Karaoke-Style Scroll Sync

Our intelligent Scroll Engine in the TextSection component provides a seamless reading experience.

  • Forward-Only Logic: The viewport only moves forward with the audio, preventing distracting "snaps" back to previous lines.
  • Timing Heuristics: Calculates line changes based on character weight and audio duration for frame-perfect synchronization.

๐Ÿท๏ธ Proper Nouns Support

Unlike standard HSK tools, RedGold explicitly identifies and styles Proper Nouns โ€” names, places, brands โ€” with pinyin AND English meaning right there, no lookup needed. Styled in the signature Modern Han Elegant gold theme.

โšก Smart Prefetching

Zero-latency transitions. The app predicts your learning path and pre-warms audio assets and lesson data as you browse, ensuring the next chapter is ready before you even click.

๐ŸŽจ Modern Han Elegant UI

A premium "glassmorphic" interface designed for focus:

  • Responsive Layout: Tailored for high-aspect-ratio mobile displays (Galaxy S26 / iPhone Pro Max).
  • Sticky Navigation: Smooth tab switching between Vocab, Grammar, and Texts.
  • Visual Selection: Browse lessons via high-resolution 3D-styled textbook covers.

๐Ÿ”ข Live Version Badge

The app header now shows the current version and last build date in real time โ€” no more guessing what's deployed.

๐Ÿ”— Lesson Deep Links

Every lesson can now be opened directly with https://heroyik.github.io/redgold/?lesson=N, so external apps can send learners straight to the right chapter.

๐Ÿงฑ Auto JSON Rule Pack

Lesson data generation now uses a compact plan/auto_json rule pack:

  • Execution Context: Load only 0.rules_common.md through 3.rules_mastery.md for lesson work.
  • Schema Alignment: Use data/lesson1.json as the practical data-shape baseline, with plan/lesson-schema-canonical.md as a reference.
  • Locale Safety: Keep source fields such as proper_nouns and key_sentences aligned with translation-pack fields such as properNouns and keySentences.
  • Translation Matching: Require texts, grammar, and keySentences translations to match source array counts and order.

๐Ÿ›  Tech Stack & Architecture

Built for performance, scalability, and the Google Cloud ecosystem:

  • Frontend: Vite + TypeScript
  • Architecture: Vanilla Web Components (Shadow DOM, 0-dependency runtime)
  • Styling: Vanilla CSS with a centralized token system (Modern Han Elegant)
  • Backend: Firebase (Hosting, Auth, Firestore ready)
  • CI/CD: GitHub Actions deploys main to GitHub Pages. Local git hooks bump the patch version (+0.0.1) before each commit and stamp that version into the commit message.

๐Ÿ“‚ Project Structure

redgold/
โ”œโ”€โ”€ data/               # HSK 4 Lesson JSONs (Vocab, Grammar, Texts)
โ”œโ”€โ”€ plan/               # Technical specs, auto JSON rules, and design documentation
โ”œโ”€โ”€ public/             # Assets (Audio, Images, Logos)
โ”œโ”€โ”€ scripts/            # Python automation for data processing
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ components/     # Custom Web Components (TextSection, VocabCard, etc.)
    โ”œโ”€โ”€ styles/         # Global design tokens and CSS
    โ”œโ”€โ”€ utils/          # Security (XSS Sanitizer) and Helpers
    โ””โ”€โ”€ web/            # Main App container and routing

๐Ÿ›  Installation & Development

1. Setup

# Clone the repo
git clone https://github.com/heroyik/redgold.git

# Install dependencies
npm install

2. Local Development

# Start the dev server
npm run dev

3. Production Build

# Build for deployment
npm run build

๐Ÿ—บ Roadmap

Phase Milestone Status
UI/UX Landing Page Refresh (Book Covers + Hip Tagline) โœ… Done
Logic Forward-only Scroll Sync Engine โœ… Done
Pedagogy Proper Nouns with Pinyin + English Meaning โœ… Done
Versioning Pre-commit patch bump + versioned commit messages + header badge โœ… Done
Auth Firebase Authentication Implementation โœ… Done
Data Lesson 5 Textbook Data Build-Out โœ… Done
Data Lesson 11 Textbook Data Build-Out โœ… Done
Data Lesson 12 Textbook Data Build-Out โœ… Done
Data Lesson 1-20 Complete Textbook JSON Coverage โœ… Done
Pipeline Auto JSON Rule Pack Optimization โœ… Done
Data Mastery Quiz System & Progress Tracking โณ Next

๐Ÿ“‹ Changelog

Every local commit bumps the patch version by 0.0.1, and the commit message is auto-stamped with that exact version. Here's the human-readable tea:


v1.0.3 โ€” 2026-06-06

Lesson deep links. RedGold now supports direct lesson URLs for cross-app navigation from QingVoca and other tools.

  • ๐Ÿ”— Lesson URL Routing โ€” Added ?lesson=N support so https://heroyik.github.io/redgold/?lesson=7 opens Lesson 7 directly instead of landing on the chapter picker.
  • ๐Ÿงญ History-Aware Navigation โ€” Internal lesson changes now update the address bar, home navigation clears the lesson parameter, and browser back/forward follows the URL state.
  • ๐Ÿงฉ Shadow DOM Compatible โ€” Deep links route through the existing app state and lesson loading flow instead of depending on clickable DOM cards.
  • ๐Ÿ–ผ๏ธ Favicon 404 Fixed โ€” Added an explicit favicon link using the existing RedGold logo asset, eliminating the browser's default /favicon.ico 404.
  • โœ… Validation โ€” Confirmed production build, direct ?lesson=7 entry, lesson switching URL updates, home URL cleanup, and zero 4xx favicon responses.

v1.0.0 โ€” 2026-06-04

Full textbook run complete. RedGold now has complete HSK 4 textbook JSON coverage from Lesson 1 through Lesson 20.

  • ๐Ÿ“š Lessons 1-20 Complete โ€” Completed and validated all lesson JSON data across textbook texts, vocabulary, grammar/notes, mastery sentences, and locale translation packs.
  • ๐Ÿ† Lesson 20 Finalized โ€” Added Lesson 20 notes and mastery sentences, including repeated-progressive verb patterns, immediate-sequence structures, emphasis adverbs, directional complements, and same-character vocab notes.
  • ๐ŸŒ Locale Packs Completed โ€” Backfilled missing translations.vocabulary, properNouns, lessonTitle, textTitles, grammar examples, and mastery fields where needed.
  • ๐Ÿงฑ Auto JSON Rules Hardened โ€” Updated plan/auto_json rules to prevent recurring schema gaps around optional proper_nouns, grammar translation wrappers, and mastery base fields.
  • โœ… Full Validation Pass โ€” Revalidated Lessons 1-20 with optional proper nouns excluded correctly: checked: 20, passed: 20, failed: 0.

v0.9.86 โ€” 2026-06-03

Auto JSON Rules Hardened. The lesson-generation prompts are now smaller, stricter, and safer for locale data.

  • ๐Ÿงฑ Auto JSON Rule Pack โ€” Added plan/auto_json as the execution-ready rule set for Lesson JSON generation, split into common, Kewen, Notes, and Mastery files.
  • ๐Ÿšซ Spec Excluded from Runtime Context โ€” Marked rules-optimization-spec.md as design/history only, so future Lesson work loads only 0~3.rules_*.md.
  • ๐ŸŒ Locale Mapping Guardrails โ€” Documented the source-vs-translation naming split for proper_nouns/properNouns and key_sentences/keySentences.
  • โœ… Translation Count Checks โ€” Required text-line, grammar-example, and mastery-sentence translations to match the source arrays by count and order.

v0.9.84 โ€” 2026-06-03

Lesson 12 Complete. The textbook data pipeline now covers the careful-observation and methods chapter.

  • ๐Ÿ“š Lesson 12 Textbook Data Complete โ€” Added data/lesson12.json for the attentive-world-discovery chapter, covering Text 1-5, 33 vocabulary items, 6 grammar/notes entries, 5 mastery sentences, and 3 same-character word examples.
  • ๐Ÿงฉ Grammar Notes Preserved โ€” Added the full set of Lesson 12 conjunction, comparison, noun-measure reduplication, and contrast notes with complete formal examples.
  • ๐Ÿ† Mastery Expansion โ€” Added 5 Golden Sentences with Living Language equivalents for problem solving, praise, education methods, giving advice, and choosing methods.
  • ๐ŸŒ Locale Sync โ€” Filled KO/JA/EN translations for vocabulary, proper nouns, text titles, text lines, grammar explanations/examples, same-character examples, and mastery sentences.
  • โœ… Validation โ€” Confirmed Lesson 12 JSON parses successfully, locale mapping reports zero missing fields, and text line indexes are 0-based.

v0.9.82 โ€” 2026-06-03

Lesson 11 Complete. The textbook data pipeline now covers the reading-methods chapter.

  • ๐Ÿ“š Lesson 11 Textbook Data Complete โ€” Added data/lesson11.json for the self-study-methods chapter, covering Text 1-5, 30 vocabulary items, 7 grammar/notes entries, 5 mastery sentences, and complete locale data.
  • ๐Ÿงฉ Grammar Notes Preserved โ€” Added the full set of Lesson 11 emphasis, condition, no-matter, contrast, simultaneity, and same-character notes with full formal and colloquial examples.
  • ๐ŸŒ Locale Sync โ€” Filled KO/JA/EN translations for vocabulary, proper nouns, text titles, text lines, grammar explanations/examples, and mastery sentences.
  • โœ… Validation โ€” Confirmed Lesson 11 JSON parses successfully and locale mapping reports zero issues.

v0.9.80 โ€” 2026-06-02

Lessons 1-5 Grammar Image Review Complete. The textbook grammar notes were rechecked against the source images.

  • ๐Ÿ“š Lesson 1-5 Grammar Review โ€” Rechecked grammar sections in data/lesson1.json through data/lesson5.json against the provided textbook images.
  • ๐Ÿงฉ Compare & Expansion Notes Preserved โ€” Stored comparison pages as explicit grammar items and preserved same-character expansion pages as dedicated notes.
  • ๐Ÿˆถ Chinese Examples Complete โ€” Ensured every Chinese example shown in the grammar images is represented in the JSON data.
  • ๐ŸŒ Locale Sync โ€” Aligned translations.grammar keys and example counts with the updated grammar entries, including Korean, Japanese, and English translations.
  • ๐Ÿ› ๏ธ Recognition Rules Hardened โ€” Updated plan/image_recognition/2.rules_notes.md so future grammar image passes preserve comparison/expansion pages instead of collapsing or inventing structure.
  • โœ… Validation โ€” Verified lesson 1-5 grammar translation keys/counts and ran npm run build successfully.

v0.9.78 โ€” 2026-06-02

Lesson 5 Complete. The textbook data pipeline now covers Lesson 5.

  • ๐Ÿ“š Lesson 5 Textbook Data Complete โ€” Added data/lesson5.json for the furniture-store sofa-buying chapter, covering Text 1-5, vocabulary, grammar notes, comparison content, same-character word notes, mastery sentences, and locale data.
  • โœ… Validation โ€” Confirmed data/lesson5.json parses as valid JSON.

v0.9.75 โ€” 2026-06-01

Lesson 4 Image Recognition Pass, Canonical Schema Rules & Fixed Lesson Header. Today's work tightened the data pipeline and made lesson navigation stay put.

  • ๐Ÿ“Œ Always-Fixed Lesson Selector Header โ€” The top lesson chip bar (Home, L1..., language picker, pinyin toggle) now uses viewport-level fixed positioning, so it remains visible while scrolling anywhere inside a lesson page.
  • ๐Ÿงญ Sticky Lesson Toolbar โ€” The lesson title and tab row are grouped into a dedicated sticky toolbar below the fixed lesson selector. This keeps the current lesson context and tab controls accessible without covering the content.
  • ๐Ÿ“š Lesson 4 Textbook Data Build-Out โ€” Expanded data/lesson4.json from the provided textbook images: 5 text sections, 36 vocabulary items, 6 grammar points, 5 mastery sentences, and complete text-line translations.
  • ๐ŸŒ Missing Translation Fixes โ€” Filled the previously missing translations for Lesson 4 text 1 line 0, text 4, and text 5. The translation map now covers all 20 Lesson 4 text lines with KO, JA, and EN entries.
  • ๐Ÿงฉ 0-Based Text Translation Rule โ€” Updated localization rules so translations.texts[{textId}].lines must use JavaScript array indices (0, 1, 2...) instead of textbook-style line numbers. This prevents app-visible โ€œmissing translationโ€ cases for one-line monologues.
  • ๐Ÿงฑ Canonical Lesson Schema Added โ€” Added plan/lesson-schema-canonical.md as the official schema reference based on the current lesson1.json structure, including formal_examples[], colloquial_examples[], lessonTitle, textTitles, and KO/JA/EN translation objects.
  • ๐Ÿ“ธ Image Recognition Pipeline v2 Docs โ€” Added plan/image-recognition-spec.md and plan/image_recognition_status.md to document the textbook-image-to-JSON workflow, current lesson progress, and schema expectations.
  • ๐Ÿ› ๏ธ Rule Files Hardened โ€” Updated 1.rules_kewen.md, 2.rules_notes.md, 3.rules_mastery.md, and 4.rules_locale.md to reference the canonical schema, require complete locale data, preserve proper pinyin such as รผ, and use array-based grammar examples.
  • โœ… Validation โ€” Ran npm run build successfully after the data and UI changes.

v0.9.74 โ€” 2026-06-01

Textbook-Sourced Vocab, Lesson Title i18n & Pinyin Toggle Polish. Precision over assumptions.

  • ๐Ÿ“ Pinyin Toggle Fix for Text Titles โ€” Extracted pinyin from text titles into a separate .pinyin div via the titlePinyin field in lessonTranslations.ts, so the global pinyin toggle CSS properly hides/shows it.
  • ๐ŸŽฏ Vocab & Review Tabs Now Sourced from Textbook New-Words Sections โ€” Both tabs now collect unique vocabulary items from each text's new-words section instead of the top-level lesson.vocabulary array. This ensures only words actually introduced in the textbook pages appear.
  • ๐Ÿ”ง getTextVocab() Extracted โ€” Deduplicated vocab collection logic into a reusable exported function in lessonTranslations.ts, used by both the vocab tab and review tab.
  • ๐Ÿ›ก๏ธ Meaning Fallback Fix โ€” Added pickLocalized(...) || item.meaning so text vocabulary items without a translation pack entry still display their original English meaning.
  • ๐ŸŒ Lesson Title Korean/Japanese i18n โ€” Filled in lessonTitle and textTitles translations (ko/ja) for Lessons 1โ€“4. Now the lesson header properly displays the locale-specific subtitle below the pinyin line.

v0.9.49 โ€” 2026-05-05

Firebase Authentication & User Profile. Identity is now live.

  • ๐Ÿ” Firebase Authentication โ€” Implemented Google Sign-In with a custom UserMenu Web Component.
  • ๐Ÿ‘ค User Profile UI โ€” Added a sleek, glassmorphic profile menu to both the landing page and lesson view header, showing user name, email, and photo.
  • ๐Ÿ›  Auth Utility โ€” Created a centralized auth.ts utility for handling user state and authentication logic.
  • ๐Ÿ”ข Version Bump โ€” Updated to v0.9.49 as part of the automated versioning workflow.

v0.9.46 โ€” 2026-05-03

Mobile-First UX Optimization & Cloud Sync. The Review Tab gets a massive glow-up.

  • โ˜๏ธ Firestore Integration โ€” Migrated local lesson1.json data to Firebase Firestore, laying the groundwork for a true backend architecture.
  • ๐Ÿ“ฑ Mobile UI/UX Polish โ€” Complete overhaul of the Review tab for modern, high-aspect-ratio screens (Galaxy S26 / iPhone Pro). Eliminated rogue left-margins and packed the top header icons perfectly into a single responsive row.
  • ๐Ÿ”„ Click-to-Flip Refined โ€” Resolved PC vs Mobile interaction conflicts. Cards now flip flawlessly on a simple click or tap through a centralized InteractionManager.
  • ๐Ÿ“ Perfect Card Boundaries โ€” Leveraged dvh calculations (calc(100dvh - 380px)) to aggressively subtract header real estate. Flashcard outlines now fit perfectly on-screen without clipping, and long texts (like complex meanings or examples) are neatly scrollable inside the card itself.
  • ๐ŸŽฏ Absolute Center Alignment โ€” Chinese characters on the front face are perfectly centered vertically and horizontally. Fixed descender drifts by applying line-height: 1 alongside precise flexbox layouts.
  • ๐ŸŽง Visual Audio Triggers โ€” Replaced text-based audio buttons with sleek, static PNG icons for better intuition.
  • ๐Ÿ“ App Manifesto Update โ€” Rewrote the intro messaging to sound more colloquial and explicitly highlight the "HSK4 learners" target audience, while strictly preserving the GitHub footer link.
  • โฌ…๏ธ Navigation Enhancements โ€” Added tactile left/right arrows flanking the progress counter (< 1/31 >) for immediate visual navigation cues.
  • ๐Ÿงน Layout Compaction โ€” Reduced unnecessary padding between the version badge and the logo to grant more breathing room to core content.

v0.9.0 โ€” 2026-05-01

The version system drops. Things just got official.

  • ๐Ÿ”ข Version badge is live โ€” header now shows vX.X.X + last build date on both the landing page and the lesson view
  • โš™๏ธ Automatic patch bump โ€” local git hooks patch 0.0.1 before every commit and make sure the commit message includes the bumped version
  • ๐Ÿท๏ธ Proper Nouns Overhaul โ€” corrected all proper noun entries to match the actual textbook pages (images > assumptions, always)
  • ๐Ÿ“– Dialogue 2 Data Fix โ€” cleaned up the proper noun list so it follows the textbook instead of guesswork.
  • โž• Missing Vocab Added โ€” added the missing "happy" vocab item from Dialogue 2 because the textbook had it and the data needed to catch up.
  • ๐Ÿ“ Vocabulary meanings tightened up โ€” part-of-speech labels (adj., v., adv.) now match the textbook format exactly

๐Ÿค Reference & Credits

Redgold is an educational tool designed to complement the HSK Standard Course 4 textbook series authorized by Hanban and published by BLCUP.

Built with โค๏ธ by the RedGold Team.
Speak the Language, Not Just the Grammar.

About

Level up your HSK 4 with the colloquial soul itโ€™s been missing. RedGold is where formal grammar meets native rhythm. Premium UI, zero fluff. ๐Ÿš€๐ŸฎA trendy Chinese language learning app focusing on formal and colloquial patterns.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors