Skip to content

feat: add custom 404 not found page - #47

Merged
krishkhinchi merged 1 commit into
7-Blocks:mainfrom
SankeerthNara:feat/custom-404-page
Jul 16, 2026
Merged

krishkhinchi merged 1 commit into
7-Blocks:mainfrom
SankeerthNara:feat/custom-404-page

Conversation

@SankeerthNara

@SankeerthNara SankeerthNara commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

User description

Closes #44

Description

Adds a custom 404 Not Found page matching Kepler's existing dashboard design system, replacing the default framework 404 page.

  • New frontend/src/pages/NotFound.tsx — deep-space background with technical grid, glass panel, animated orbital debris field SVG, Space Grotesk/IBM Plex Sans typography, and cyan glow accents consistent with the rest of the app
  • Displays a clear "Object Not Found In Orbit" message and error code
  • "Return to Dashboard" button navigates back to /dashboard
  • Added catch-all <Route path="*" element={<NotFound />} /> in App.tsx so any invalid route renders this page
  • Fully responsive — verified at 375px, 768px, and 1440px widths
  • Respects prefers-reduced-motion for the animated orbit paths

Related Issue

Closes #44

Checklist

  • I have read the contributing guidelines
  • My code follows the project guidelines
  • I have completed testing of my changes
  • Documentation has been updated (if applicable)

Screenshots / Screen Recordings

Breaking Changes

None. This only adds a new route for previously-unmatched paths; no existing routes or components are modified.


CodeAnt-AI Description

Add a custom 404 page for unknown routes

What Changed

  • Unknown URLs now open a branded 404 page instead of the default framework error page
  • The new page shows a clear “Object Not Found In Orbit” message, error code, and a button that takes users back to the dashboard
  • Motion on the page respects reduced-motion settings for users who prefer less animation

Impact

✅ Clearer error pages
✅ Easier recovery from bad links
✅ Fewer confusing dead-end routes

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • New Features
    • Added a dedicated 404 page for unmatched routes.
    • Included a clear button to return to the dashboard.
    • Added a responsive visual design with animations that respect reduced-motion preferences.

Greptile Summary

This PR adds a custom 404 page (NotFound.tsx) styled to match Kepler's dashboard design system, and wires it into the router as a top-level catch-all route. The page includes an animated SVG debris field, prefers-reduced-motion support, and a "Return to Dashboard" button.

  • The top-level <Route path=\"*\"> only catches paths that have no matching parent route. Paths nested under /dashboard (e.g., /dashboard/nonexistent) silently match the /dashboard parent and render MainLayout with an empty outlet instead of the 404 page — a nested wildcard child is needed to cover this case.
  • The SVG animateTransform rotates the debris dot in a circle of radius rx rather than following the underlying ellipse (semi-axes rx/ry); the dot diverges visibly from the orbital path at all angles except 0° and 180°.

Confidence Score: 3/5

The new 404 page itself is safe, but the routing gap means an entire class of invalid URLs displays a broken-looking empty dashboard shell instead of the intended error page.

The catch-all route does not cover invalid paths nested under /dashboard/. Any URL like /dashboard/anything-invalid matches the parent route, and MainLayout renders with a blank content area — the sidebar, header, and all their side-effects run normally, but users see no content and receive no error feedback. This is an observable, reproducible gap in the feature as described by the PR.

frontend/src/App.tsx needs a <Route path="*" element={} /> added as a child of the /dashboard route to close the gap.

Important Files Changed

Filename Overview
frontend/src/App.tsx Adds the NotFound import and top-level catch-all route, but the route doesn't cover unmatched paths under the nested /dashboard parent, leaving those paths blank rather than showing 404.
frontend/src/pages/NotFound.tsx New 404 page that matches the app design system; well-structured with reduced-motion support, though the animated orbital dots trace circles rather than the ellipse paths they overlay.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant BrowserRouter
    participant Routes
    participant MainLayout
    participant NotFound

    User->>BrowserRouter: Navigate to /unknown-path
    BrowserRouter->>Routes: Match /unknown-path
    Routes->>NotFound: "path="*" matches"
    NotFound-->>User: Renders 404 page

    User->>BrowserRouter: Navigate to /dashboard/nonexistent
    BrowserRouter->>Routes: Match /dashboard/nonexistent
    Routes->>MainLayout: "path="/dashboard" matches (parent)"
    MainLayout->>MainLayout: No child route matches nonexistent
    MainLayout-->>User: Renders shell with empty Outlet (NotFound not shown)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant BrowserRouter
    participant Routes
    participant MainLayout
    participant NotFound

    User->>BrowserRouter: Navigate to /unknown-path
    BrowserRouter->>Routes: Match /unknown-path
    Routes->>NotFound: "path="*" matches"
    NotFound-->>User: Renders 404 page

    User->>BrowserRouter: Navigate to /dashboard/nonexistent
    BrowserRouter->>Routes: Match /dashboard/nonexistent
    Routes->>MainLayout: "path="/dashboard" matches (parent)"
    MainLayout->>MainLayout: No child route matches nonexistent
    MainLayout-->>User: Renders shell with empty Outlet (NotFound not shown)
Loading

Comments Outside Diff (1)

  1. frontend/src/App.tsx, line 19-28 (link)

    P1 Invalid dashboard sub-paths silently render an empty shell

    The top-level <Route path="*"> only catches paths with no parent match. Because /dashboard already matches as a parent route, any URL like /dashboard/nonexistent causes MainLayout to render with <Outlet> returning null — the sidebar and header appear, but the content area is empty. The NotFound page is never shown for these cases. A nested wildcard is needed as the last child of the /dashboard route to cover this gap.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: frontend/src/App.tsx
    Line: 19-28
    
    Comment:
    **Invalid dashboard sub-paths silently render an empty shell**
    
    The top-level `<Route path="*">` only catches paths with no parent match. Because `/dashboard` already matches as a parent route, any URL like `/dashboard/nonexistent` causes `MainLayout` to render with `<Outlet>` returning `null` — the sidebar and header appear, but the content area is empty. The `NotFound` page is never shown for these cases. A nested wildcard is needed as the last child of the `/dashboard` route to cover this gap.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
frontend/src/App.tsx:19-28
**Invalid dashboard sub-paths silently render an empty shell**

The top-level `<Route path="*">` only catches paths with no parent match. Because `/dashboard` already matches as a parent route, any URL like `/dashboard/nonexistent` causes `MainLayout` to render with `<Outlet>` returning `null` — the sidebar and header appear, but the content area is empty. The `NotFound` page is never shown for these cases. A nested wildcard is needed as the last child of the `/dashboard` route to cover this gap.

### Issue 2 of 2
frontend/src/pages/NotFound.tsx:43-65
**Animated dot traces a circle, not the ellipse orbital path**

The `animateTransform` rotates the inner `<g>` around `(0, 0)`, so the dot at `cx={o.rx} cy=0` traces a perfect circle of radius `rx`. The ellipse it's supposed to follow has semi-axes `rx` and `ry` (e.g., 220 × 80 for the first orbit). After a 90° rotation the dot sits at `(0, 220)` in the tilted coordinate space, far outside the `ry=80` ellipse path. If this divergence is intentional as an approximate visual effect, a brief comment would clarify intent for future maintainers.

Reviews (1): Last reviewed commit: "feat: add custom 404 not found page" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

ScreenShots

desktop

Desktop View

mobile

Mobile View

tablet

Tablet View

@codeant-ai

codeant-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@github-actions github-actions Bot added ECSoC26 Official label for ECSoC26 event contributions. ECSoC26-L1 Level 1 contribution for the ECSoC26 event. bug Something isn't working documentation Improvements or additions to documentation frontend Frontend development size/M Medium-sized contribution. size:M This PR changes 30-99 lines, ignoring generated files type:bug Fixes an existing bug or unexpected behavior. type:documentation Improves project documentation. type:frontend Changes frontend or client-side code. labels Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a custom, space-themed NotFound page with reduced-motion support and connects it to the router as the fallback for unmatched paths.

Changes

Custom 404 experience

Layer / File(s) Summary
NotFound page and illustration
frontend/src/pages/NotFound.tsx
Adds the styled 404 layout, animated debris-field SVG, dashboard navigation button, and page export.
Reduced-motion behavior
frontend/src/pages/NotFound.tsx
Detects prefers-reduced-motion changes and omits orbit animation when enabled.
Catch-all route integration
frontend/src/App.tsx
Imports NotFound and renders it for unmatched routes through path="*".

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • 7-Blocks/Kepler#43: Also modifies the application routing configuration in frontend/src/App.tsx.

Suggested labels: enhancement, type:feature

Suggested reviewers: ronaksarda

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy the issue's core requirements with a custom 404 fallback, space-themed graphic, clear message, dashboard button, and responsive behavior.
Out of Scope Changes check ✅ Passed The diff stays focused on the 404 page and catch-all route, with no unrelated changes.
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding a custom 404 page.
Description check ✅ Passed The PR description covers the required template sections and includes issue linkage, checklist, screenshots, and breaking changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@codeant-ai codeant-ai Bot added size:L Large size and removed size:M This PR changes 30-99 lines, ignoring generated files labels Jul 16, 2026
@github-actions github-actions Bot added AI Artificial Intelligence and Machine Learning enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files type:feature Introduces a new feature or enhancement. labels Jul 16, 2026
@codeant-ai

codeant-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/pages/NotFound.tsx`:
- Around line 75-82: Initialize prefersReducedMotion in the NotFound component’s
useState call from window.matchMedia("(prefers-reduced-motion: reduce)").matches
instead of false, so the initial render respects the user’s preference before
effects run. Keep the existing useEffect listener and cleanup for preference
changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bb752e0e-e28b-4418-903f-be98d8a999c6

📥 Commits

Reviewing files that changed from the base of the PR and between dc50185 and eaa8a2c.

📒 Files selected for processing (2)
  • frontend/src/App.tsx
  • frontend/src/pages/NotFound.tsx

Comment on lines +75 to +82
const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);

useEffect(() => {
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
setPrefersReducedMotion(mediaQuery.matches);
const listener = (e: MediaQueryListEvent) => setPrefersReducedMotion(e.matches);
mediaQuery.addEventListener("change", listener);
return () => mediaQuery.removeEventListener("change", listener);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Initialize the motion preference before the first paint.

false initially mounts the SVG animations for users who prefer reduced motion; useEffect corrects it only after commit. Initialize from matchMedia so those animations never mount for those users.

Proposed fix
-  const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);
+  const [prefersReducedMotion, setPrefersReducedMotion] = useState(
+    () =>
+      typeof window !== "undefined" &&
+      window.matchMedia("(prefers-reduced-motion: reduce)").matches,
+  );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);
useEffect(() => {
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
setPrefersReducedMotion(mediaQuery.matches);
const listener = (e: MediaQueryListEvent) => setPrefersReducedMotion(e.matches);
mediaQuery.addEventListener("change", listener);
return () => mediaQuery.removeEventListener("change", listener);
const [prefersReducedMotion, setPrefersReducedMotion] = useState(
() =>
typeof window !== "undefined" &&
window.matchMedia("(prefers-reduced-motion: reduce)").matches,
);
useEffect(() => {
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
setPrefersReducedMotion(mediaQuery.matches);
const listener = (e: MediaQueryListEvent) => setPrefersReducedMotion(e.matches);
mediaQuery.addEventListener("change", listener);
return () => mediaQuery.removeEventListener("change", listener);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/NotFound.tsx` around lines 75 - 82, Initialize
prefersReducedMotion in the NotFound component’s useState call from
window.matchMedia("(prefers-reduced-motion: reduce)").matches instead of false,
so the initial render respects the user’s preference before effects run. Keep
the existing useEffect listener and cleanup for preference changes.

Comment on lines +43 to +65
<g>
{!prefersReducedMotion && (
<animateTransform
attributeName="transform"
type="rotate"
from="0 0 0"
to="360 0 0"
dur={`${o.dur}s`}
repeatCount="indefinite"
/>
)}
<circle cx={o.rx} cy="0" r="3" fill={o.dot} />
<text
x={o.rx + 8}
y="4"
fontFamily="IBM Plex Sans, monospace"
fontSize="9"
fill={o.dot}
opacity="0.85"
>
{o.label}
</text>
</g>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Animated dot traces a circle, not the ellipse orbital path

The animateTransform rotates the inner <g> around (0, 0), so the dot at cx={o.rx} cy=0 traces a perfect circle of radius rx. The ellipse it's supposed to follow has semi-axes rx and ry (e.g., 220 × 80 for the first orbit). After a 90° rotation the dot sits at (0, 220) in the tilted coordinate space, far outside the ry=80 ellipse path. If this divergence is intentional as an approximate visual effect, a brief comment would clarify intent for future maintainers.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/pages/NotFound.tsx
Line: 43-65

Comment:
**Animated dot traces a circle, not the ellipse orbital path**

The `animateTransform` rotates the inner `<g>` around `(0, 0)`, so the dot at `cx={o.rx} cy=0` traces a perfect circle of radius `rx`. The ellipse it's supposed to follow has semi-axes `rx` and `ry` (e.g., 220 × 80 for the first orbit). After a 90° rotation the dot sits at `(0, 220)` in the tilted coordinate space, far outside the `ry=80` ellipse path. If this divergence is intentional as an approximate visual effect, a brief comment would clarify intent for future maintainers.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@krishkhinchi krishkhinchi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SankeerthNara, Please attach screenshots of the 404 Page along with your PR.

@SankeerthNara

Copy link
Copy Markdown
Contributor Author

Hey @krishkhinchi , I've attached the screenshots as requested , please go through them

@krishkhinchi
krishkhinchi merged commit e40ae13 into 7-Blocks:main Jul 16, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Artificial Intelligence and Machine Learning bug Something isn't working documentation Improvements or additions to documentation ECSoC26-L1 Level 1 contribution for the ECSoC26 event. ECSoC26 Official label for ECSoC26 event contributions. enhancement New feature or request frontend Frontend development size:L Large size size/M Medium-sized contribution. size:M This PR changes 30-99 lines, ignoring generated files type:bug Fixes an existing bug or unexpected behavior. type:documentation Improves project documentation. type:feature Introduces a new feature or enhancement. type:frontend Changes frontend or client-side code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a Custom 404 Not Found Page 🌐

2 participants