Refactor Components #29

Merged
an.di merged 12 commits from adilallo/maintenance/RefactorComponents into main 2026-01-30 03:59:41 +00:00
Owner

Migrate components to container/presentation pattern

Overview

This PR migrates all remaining components to the container/presentation pattern, separating logic (containers) from presentation (views). This improves testability, reusability, and maintainability. The migration includes 50+ components, with special attention to restoring QuoteBlock and LogoWall to match their original implementations exactly.

Changes

Component Migrations

  • High Priority Components: RelatedArticles, RuleStack, RuleCard, Header, RadioGroup, ToggleGroup
  • Medium Priority Components: SelectOption, ContextMenuItem, ContentContainer, ContentThumbnailTemplate
  • Additional Components: NavigationItem, ContentLockup, MenuBarItem, MiniCard
  • Homepage Components: HomeHeader, LogoWall, QuoteBlock (restored to original implementations)

Component Structure

Each migrated component now follows the pattern:

  • [ComponentName]/index.tsx - Re-exports container for backward compatibility
  • [ComponentName].container.tsx - Contains logic, hooks, state management
  • [ComponentName].view.tsx - Pure presentation component
  • [ComponentName].types.ts - TypeScript interfaces

Key Restorations

  • QuoteBlock: Restored to original implementation with correct variant system ("compact" | "standard" | "extended"), proper prop names (source instead of authorRole), hanging quotes styling, and error handling with fallback avatars
  • LogoWall: Restored to original implementation with correct logo sizes, ordering, responsive grid layout, and proper image optimization settings
  • HomeHeader: Restored to original implementation matching main branch structure exactly

Bug Fixes

  • Fixed build errors in MiniCard (type compatibility for wrapper props)
  • Fixed unused imports in Header and HomeHeader view components
  • Fixed unused props in Checkbox, Input, TextArea, Select, and ToggleGroup components
  • Fixed prop filtering in Input component to prevent DOM attribute warnings

Documentation

  • Pattern documented in docs/guides/container-presentation-pattern.md
  • Updated docs/README.md and docs/CUSTOM_HOOKS.md to reference new pattern

Screenshots

How to Test

  1. Run all test suites:
    npm test # Unit tests (305 passed)
    npm run e2e # E2E tests (124 passed)
    npm run e2e:performance # Performance tests (8 passed)
    npm run visual:test # Visual regression (20 passed)
# Migrate components to container/presentation pattern ## Overview This PR migrates all remaining components to the container/presentation pattern, separating logic (containers) from presentation (views). This improves testability, reusability, and maintainability. The migration includes 50+ components, with special attention to restoring QuoteBlock and LogoWall to match their original implementations exactly. ## Changes ### Component Migrations - **High Priority Components**: RelatedArticles, RuleStack, RuleCard, Header, RadioGroup, ToggleGroup - **Medium Priority Components**: SelectOption, ContextMenuItem, ContentContainer, ContentThumbnailTemplate - **Additional Components**: NavigationItem, ContentLockup, MenuBarItem, MiniCard - **Homepage Components**: HomeHeader, LogoWall, QuoteBlock (restored to original implementations) ### Component Structure Each migrated component now follows the pattern: - `[ComponentName]/index.tsx` - Re-exports container for backward compatibility - `[ComponentName].container.tsx` - Contains logic, hooks, state management - `[ComponentName].view.tsx` - Pure presentation component - `[ComponentName].types.ts` - TypeScript interfaces ### Key Restorations - **QuoteBlock**: Restored to original implementation with correct variant system ("compact" | "standard" | "extended"), proper prop names (`source` instead of `authorRole`), hanging quotes styling, and error handling with fallback avatars - **LogoWall**: Restored to original implementation with correct logo sizes, ordering, responsive grid layout, and proper image optimization settings - **HomeHeader**: Restored to original implementation matching main branch structure exactly ### Bug Fixes - Fixed build errors in MiniCard (type compatibility for wrapper props) - Fixed unused imports in Header and HomeHeader view components - Fixed unused props in Checkbox, Input, TextArea, Select, and ToggleGroup components - Fixed prop filtering in Input component to prevent DOM attribute warnings ### Documentation - Pattern documented in `docs/guides/container-presentation-pattern.md` - Updated `docs/README.md` and `docs/CUSTOM_HOOKS.md` to reference new pattern ## Screenshots <!-- Visual regression tests confirm all components match original snapshots --> ## How to Test 1. **Run all test suites**: npm test # Unit tests (305 passed) npm run e2e # E2E tests (124 passed) npm run e2e:performance # Performance tests (8 passed) npm run visual:test # Visual regression (20 passed)
an.di self-assigned this 2026-01-30 02:39:36 +00:00
an.di added 5 commits 2026-01-30 02:39:37 +00:00
Fix components based on failed tests
CI Pipeline / test (pull_request) Has been cancelled
CI Pipeline / e2e (chromium) (pull_request) Has been cancelled
CI Pipeline / e2e (firefox) (pull_request) Has been cancelled
CI Pipeline / e2e (webkit) (pull_request) Has been cancelled
CI Pipeline / visual-regression (pull_request) Has been cancelled
CI Pipeline / performance (pull_request) Has been cancelled
CI Pipeline / lint (pull_request) Has been cancelled
CI Pipeline / build (pull_request) Has been cancelled
ba3a15a7d2
an.di added 1 commit 2026-01-30 02:51:09 +00:00
Update gitea-runner.yaml
CI Pipeline / test (pull_request) Has been cancelled
CI Pipeline / e2e (chromium) (pull_request) Has been cancelled
CI Pipeline / e2e (firefox) (pull_request) Has been cancelled
CI Pipeline / e2e (webkit) (pull_request) Has been cancelled
CI Pipeline / visual-regression (pull_request) Has been cancelled
CI Pipeline / performance (pull_request) Has been cancelled
CI Pipeline / lint (pull_request) Has been cancelled
CI Pipeline / build (pull_request) Has been cancelled
1f249f92ff
an.di added 1 commit 2026-01-30 02:55:54 +00:00
Update gitea-runner.yaml
CI Pipeline / test (pull_request) Has been cancelled
CI Pipeline / e2e (chromium) (pull_request) Has been cancelled
CI Pipeline / e2e (firefox) (pull_request) Has been cancelled
CI Pipeline / e2e (webkit) (pull_request) Has been cancelled
CI Pipeline / visual-regression (pull_request) Has been cancelled
CI Pipeline / performance (pull_request) Has been cancelled
CI Pipeline / lint (pull_request) Has been cancelled
CI Pipeline / build (pull_request) Has been cancelled
89a2e7b1b7
an.di added 1 commit 2026-01-30 03:02:47 +00:00
Update gitea-runner.yaml
CI Pipeline / test (pull_request) Has been cancelled
CI Pipeline / e2e (chromium) (pull_request) Has been cancelled
CI Pipeline / e2e (firefox) (pull_request) Has been cancelled
CI Pipeline / e2e (webkit) (pull_request) Has been cancelled
CI Pipeline / visual-regression (pull_request) Has been cancelled
CI Pipeline / performance (pull_request) Has been cancelled
CI Pipeline / lint (pull_request) Has been cancelled
CI Pipeline / build (pull_request) Has been cancelled
44c0a53c0b
an.di added 1 commit 2026-01-30 03:08:33 +00:00
Adjust runner script
CI Pipeline / test (pull_request) Has been cancelled
CI Pipeline / e2e (chromium) (pull_request) Has been cancelled
CI Pipeline / e2e (firefox) (pull_request) Has been cancelled
CI Pipeline / e2e (webkit) (pull_request) Has been cancelled
CI Pipeline / visual-regression (pull_request) Has been cancelled
CI Pipeline / performance (pull_request) Has been cancelled
CI Pipeline / lint (pull_request) Has been cancelled
CI Pipeline / build (pull_request) Has been cancelled
5b77ed1c12
an.di added 1 commit 2026-01-30 03:18:06 +00:00
Additional runner support
CI Pipeline / test (pull_request) Has been cancelled
CI Pipeline / e2e (chromium) (pull_request) Has been cancelled
CI Pipeline / e2e (firefox) (pull_request) Has been cancelled
CI Pipeline / e2e (webkit) (pull_request) Has been cancelled
CI Pipeline / visual-regression (pull_request) Has been cancelled
CI Pipeline / performance (pull_request) Has been cancelled
CI Pipeline / lint (pull_request) Has been cancelled
CI Pipeline / build (pull_request) Has been cancelled
16166f5cc5
an.di added 1 commit 2026-01-30 03:32:37 +00:00
an.di added 1 commit 2026-01-30 03:57:49 +00:00
an.di merged commit 1714e7f930 into main 2026-01-30 03:59:41 +00:00
an.di deleted branch adilallo/maintenance/RefactorComponents 2026-01-30 03:59:41 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CommunityRule/community-rule#29