Skip to content

Comments

Add Phonics Vocabulary practice component and update CSP configuration.#581

Open
suresh6602 wants to merge 1 commit intoSunbird-ALL:all-2.5.1from
all-telangana:all-2.5.1
Open

Add Phonics Vocabulary practice component and update CSP configuration.#581
suresh6602 wants to merge 1 commit intoSunbird-ALL:all-2.5.1from
all-telangana:all-2.5.1

Conversation

@suresh6602
Copy link
Collaborator

@suresh6602 suresh6602 commented Jan 2, 2026

This PR introduces a new Phonics Vocabulary practice component, adds supporting asset structure for images, and updates the Content Security Policy (CSP) configuration in both runtime and static entry points. The Practice view is updated to include the new component, with existing Level 1 logic temporarily commented for testing purposes.

🗂️ Folder Structure Updates

Added:
assets/Phonics_Vocabulary_images/
→ Used to store all Phonics Vocabulary–related images.

Added:
src/components/Practice/Phonics_Vocabulary/
→ Contains all logic and helper functions related to the Phonics Vocabulary practice flow.

🧩 Practice View Integration

→Imported the new Phonics_Vocabulary component in:
src/views/Practice/practice.jsx
→Temporarily commented the existing Level 1 extension logic around line ~5841 for testing and validation purposes.

🔐 Security (CSP Updates)

→Updated Content Security Policy (CSP) configuration in:
src/index.js
public/index.html

Summary by CodeRabbit

Release Notes

  • New Features

    • Added interactive phonics and vocabulary practice module with alphabet and word learning modes
    • Integrated text-to-speech pronunciation support for English and Tamil languages
    • Added celebratory animation upon completing learning milestones
    • Introduced scrollable alphabet reference strip for category navigation
  • Style

    • Enhanced global typography with new font families and color palette
    • Updated visual styling for interactive learning components
  • Chores

    • Updated security headers for improved content protection
    • Modernized React rendering architecture

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 2, 2026

Walkthrough

This pull request introduces a comprehensive phonics and vocabulary practice module with multilingual support (English and Tamil), interactive learning components, speech synthesis integration, and a celebration overlay. The implementation adds new UI components, data structures, hooks, styling updates, and configuration adjustments while integrating the module into the existing Practice view.

Changes

Cohort / File(s) Summary
Package & Build Configuration
package.json
Added dependencies: react-icons (^5.5.0); added dev dependencies: @babel/eslint-parser (^7.28.5), eslint-config-react-app (^7.0.1).
Security & HTML Configuration
public/index.html, src/csp.js
Expanded Content-Security-Policy meta tag with granular directives (script-src-elem, style-src-elem, font-src, img-src, media-src, connect-src, form-action, object-src, base-uri, manifest-src, frame-src, worker-src); refactored CSP generator function from named getCSP to default export GetCsp with updated policy content.
React Initialization & Styling
src/index.js, src/index.css
Updated React 18 render method to use createRoot API; changed CSP import to default export pattern; added global CSS with box-sizing, font imports, CSS variables, animations (flash, pulse-button), and interactive element styling.
Phonics Vocabulary Module: Components
src/components/Practice/Phonics_Vocabulary/AlphabetStrip.jsx, src/components/Practice/Phonics_Vocabulary/Card.jsx, src/components/Practice/Phonics_Vocabulary/Celebration.jsx, src/components/Practice/Phonics_Vocabulary/Footer.jsx, src/components/Practice/Phonics_Vocabulary/Header.jsx, src/components/Practice/Phonics_Vocabulary/Toggle.jsx
Six new reusable components: AlphabetStrip (horizontally scrollable letter circles with completion states), Card (learning card with speech toggle and reset), Celebration (full-screen confetti overlay with success message), Footer (prev/next navigation buttons), Header (mode/category/language controls), Toggle (mode switcher knob).
Phonics Vocabulary Module: Core Logic
src/components/Practice/Phonics_Vocabulary/index.jsx, src/components/Practice/Phonics_Vocabulary/phonics.js, src/components/Practice/Phonics_Vocabulary/useSpeech.js
Main component PhonicsVocabulary orchestrates vocabulary practice with dual-mode (alphabet/word), pagination, category filtering, language switching; phonics.js provides 26 English entries and 216+ dynamically generated Tamil entries across categories; useSpeech hook wraps Web Speech API with voice selection, speech control, and state management.
Integration
src/views/Practice/Practice.jsx
Replaced Mechanics7 component with new PhonicsVocabulary component in the formAWord2 mechanism branch; adjusted props to include level computation, vocabCount, and wordCount.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PhonicsVocabulary as PhonicsVocabulary<br/>(Main Component)
    participant Header
    participant Card
    participant AlphabetStrip
    participant useSpeech as useSpeech Hook
    participant Celebration

    User->>PhonicsVocabulary: Load with lang/category
    PhonicsVocabulary->>Header: Render with mode/category
    PhonicsVocabulary->>AlphabetStrip: Render available letters
    PhonicsVocabulary->>PhonicsVocabulary: Load phonics data (en/ta)
    PhonicsVocabulary->>Card: Render visible items (grid)
    
    User->>Card: Click to interact
    Card->>useSpeech: playSpeech(text, language)
    useSpeech->>useSpeech: Select voice (ta-IN/en-IN)
    useSpeech-->>Card: isSpeaking=true
    Card->>Card: onComplete triggered
    PhonicsVocabulary->>PhonicsVocabulary: Add to completedLetters
    PhonicsVocabulary->>AlphabetStrip: Update completion state
    
    User->>Header: Toggle mode or category
    PhonicsVocabulary->>PhonicsVocabulary: Reset state, reload data
    PhonicsVocabulary->>Card: Re-render with new data
    
    User->>Card: Complete last item
    PhonicsVocabulary->>PhonicsVocabulary: Check all completed
    PhonicsVocabulary->>Celebration: Render overlay
    Celebration->>Celebration: Start confetti animation
    User->>Celebration: Click "Play Again"
    Celebration->>PhonicsVocabulary: onReset callback
    PhonicsVocabulary->>PhonicsVocabulary: Reset completedLetters
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes


📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between abdf939 and 90f1202.

⛔ Files ignored due to path filters (28)
  • package-lock.json is excluded by !**/package-lock.json
  • src/assets/Phonics_Vocabulary_images/apple.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/ball.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/cat.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/dog.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/egg.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/fish.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/goat.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/hat.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/igloo.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/jam.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/kite.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/lion.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/monkey.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/nest.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/orange.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/parrot.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/queen.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/rabbit.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/sun.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/tiger.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/umbrella.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/van.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/watch.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/xylophone.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/yak.png is excluded by !**/*.png
  • src/assets/Phonics_Vocabulary_images/zebra.png is excluded by !**/*.png
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (15)
  • package.json
  • public/index.html
  • src/components/Practice/Phonics_Vocabulary/AlphabetStrip.jsx
  • src/components/Practice/Phonics_Vocabulary/Card.jsx
  • src/components/Practice/Phonics_Vocabulary/Celebration.jsx
  • src/components/Practice/Phonics_Vocabulary/Footer.jsx
  • src/components/Practice/Phonics_Vocabulary/Header.jsx
  • src/components/Practice/Phonics_Vocabulary/Toggle.jsx
  • src/components/Practice/Phonics_Vocabulary/index.jsx
  • src/components/Practice/Phonics_Vocabulary/phonics.js
  • src/components/Practice/Phonics_Vocabulary/useSpeech.js
  • src/csp.js
  • src/index.css
  • src/index.js
  • src/views/Practice/Practice.jsx

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@suresh6602 suresh6602 requested a review from gouravmore January 2, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant