Repository navigation
refactor(ui): extract modular components from HomePage - #53
Merged
Merged
Conversation
1. Extract HeroHeader, HomeModuleList, AnnouncementBar, HomeHeader, and HomeBody into src/components/home. 2. Reduce HomePage.tsx from 776 lines to 210 lines for better maintainability. 3. Preserve all Easter Egg, CTF challenge, and announcement interactions.
Reviewer's GuideThis refactor preserves HomePage behavior while moving its hero, announcements, module cards, header, and body composition into typed, reusable components under src/components/home; HomePage now primarily coordinates state, effects, callbacks, and modal flows. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/components/home/HeroHeader.tsx" line_range="4-16" />
<code_context>
+import React from "react";
+import type { ParticleData } from "./types";
+
+export const CTF_CONFIG = {
+ activeUrl: "https://im2026ctf.duckdns.org/",
+ scoreboardUrl: "https://im2026ctf.duckdns.org/scoreboard",
+ endTime: "2026-09-10T10:00:00+08:00",
+} as const;
+
+export const isCtfEnded = (): boolean => {
+ try {
+ return Date.now() > new Date(CTF_CONFIG.endTime).getTime();
+ } catch {
+ return false;
+ }
+};
+
+export const getStageIcon = (stage: number): string => {
</code_context>
<issue_to_address>
**CTF rules live in hero UI**
When CTF configuration or challenge logic needs to change independently of the hero, `HomePage` imports `CTF_CONFIG` and `isCtfEnded` from `HeroHeader`, coupling challenge orchestration and configuration to a presentational component. Updating or reusing the hero therefore also pulls CTF policy through the UI module.
Move the CTF configuration and challenge helpers into a domain/config module and import them from both the page and UI as needed.
Also at `src/pages/HomePage.tsx:14-16`.
</issue_to_address>Sourcery assessment
Approved.
1. Move CTF_CONFIG and isCtfEnded from HeroHeader to src/services/ctf-challenge.ts. 2. Decouple challenge orchestration and date checks from UI components. 3. Resolve Sourcery review recommendation on PR #53.
1. Check for unescaped leading or trailing backslashes in checklist items. 2. Add regression tests covering escaped newline artifacts in verification section. 3. Prevent malformed Markdown from passing commit policy gates.
1. Intercept corrupted escaped inline code artifacts in PR descriptions. 2. Validate balanced backtick count across PR body. 3. Add self-test cases verifying backtick and artifact detection.
1. Replace test and match calls on escapedArtifactPattern with single exec call. 2. Resolve SonarCloud maintainability rule S6594 on commit-policy.mjs. 3. Keep test policy behavior and parity checks identical.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Modularize HomePage by decomposing large inline subcomponents and styles into dedicated component files under src/components/home.
Key Changes
Verification
Notes
Part of Scheme A refactoring roadmap (Phase 3: modularize large pages).
Summary by Sourcery
Modularize the home page and harden pull-request body validation against malformed formatting.
Bug Fixes:
Enhancements:
Tests: