Skip to content

feat:Decompose MobileCourseViewer (943 lines) into focused sub-compon…#736

Merged
RUKAYAT-CODER merged 2 commits into
rinafcode:mainfrom
bibi-fay:feat/Decompose-MobileCourseViewer-lines-into-focused-sub-components
Jun 29, 2026
Merged

feat:Decompose MobileCourseViewer (943 lines) into focused sub-compon…#736
RUKAYAT-CODER merged 2 commits into
rinafcode:mainfrom
bibi-fay:feat/Decompose-MobileCourseViewer-lines-into-focused-sub-components

Conversation

@bibi-fay

Copy link
Copy Markdown
Contributor

Summary

This PR resolves two issues:

  1. Decompose MobileCourseViewer into focused sub-components (single responsibility, reviewable diffs, independent testability)
  2. Enforce structured logging by banning console.* across src/ at the ESLint and CI level

Type of Change

  • Refactor (no behaviour change)
  • Developer tooling / CI

Issue 1 — MobileCourseViewer decomposition

MobileCourseViewer.tsx was 943 lines handling course metadata, lesson rendering, progress tracking, note-taking, and tab navigation in a single file. It has been split into four focused sub-components under src/components/mobile/course/.

New files

File Responsibility
course/CourseHeader.tsx Title, back button, bookmark toggle, progress bar
course/CourseLessonList.tsx Scrollable lesson list with per-section completion indicators
course/CourseProgressSummary.tsx Overall %, lessons done count, time remaining estimate
course/CourseNotes.tsx Note-taking UI including Add/Edit modal (fully self-contained)
course/index.ts Barrel export

Changes to existing files

  • MobileCourseViewer.tsx — reduced to orchestration only; down to ≤200 lines
  • The note modal and Add Note button are now owned entirely by CourseNotes

Implementation notes

  • Every sub-component is wrapped with React.memo and has a displayName set for React DevTools
  • All props are typed with explicit interfaces — no implicit any
  • No behaviour changes; all existing course viewer functionality is preserved
  • Sub-components are independently importable and testable

Issue 2 — Structured logging enforcement

eslint.config.js

  • Added 'no-console': ['error', { allow: [] }]
  • scripts/ is already in ignores so build tooling is unaffected
  • Logger internals are excluded via the existing ignores block

.github/workflows/ci.yml

  • New Check for console. violations* step runs before lint
  • Uses grep with --exclude-path to skip src/utils/logger*
  • Prints each violating file and line number on failure
  • Exits non-zero, blocking the PR

CONTRIBUTING.md

  • New Structured Logging section added
  • Log level reference table (error / warn / info / debug / component)
  • Before/after code examples
  • Local audit command: grep -rn "console\." src/ --include='*.ts' --include='*.tsx'

Testing

  • Existing course viewer flows verified (lesson navigation, bookmarks, notes, quiz prompt)
  • npm run lint passes with zero no-console errors
  • npx tsc --noEmit passes
  • CI console violation step exits 0 on this branch
  • Introducing a console.log in a test branch confirms CI step exits 1 with file + line output

Security Considerations

No changes to data handling, authentication, or storage.

Performance Considerations

All new sub-components use React.memo to prevent unnecessary re-renders. useMemo and useCallback usage is unchanged from the original.

Checklist

  • No console.* calls introduced
  • All new components have displayName set
  • Barrel export added so import paths stay clean
  • CONTRIBUTING.md updated
  • ADR needed? No — this is a housekeeping refactor with no architectural decisions

Closes #648
Closes #649

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@bibi-fay Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER RUKAYAT-CODER merged commit 5b289cc into rinafcode:main Jun 29, 2026
2 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants