Skip to content

Create not-found.tsx#40

Merged
naheel0 merged 5 commits intomainfrom
not-found-page
Feb 21, 2026
Merged

Create not-found.tsx#40
naheel0 merged 5 commits intomainfrom
not-found-page

Conversation

@naheel0
Copy link
Member

@naheel0 naheel0 commented Feb 21, 2026

🚀 BΞYTΞFLʘW | Pull Request Protocol

PR Type: (Choose one: feat | fix | refactor | docs | perf)
Issue Link: Fixes #


📝 System Summary

Provide a concise brief of the changes introduced to the stream.

🛠️ Technical Changes

  • Logic change in ...
  • New UI component added: ...
  • Database schema updated: ...

🧪 Quality Assurance (QA)

  • Linting: Code style matches the BeyteFlow grid.
  • Build: npm run build executed without errors.
  • Testing: New logic has been verified and tested.
  • Dark Mode: UI is high-contrast and neon-optimized.

🖼️ Visual Evidence

If this PR affects the UI, drop a screenshot or GIF below:


📡 Developer Authorization

  • I have performed a self-review of my code.
  • My changes generate no new warnings in the console.
  • I have updated the documentation (if applicable).

Authorized by: @Yourusername
Timestamp: {{ date }}


@naheel0 naheel0 requested a review from adithyanmkd as a code owner February 21, 2026 10:27
@vercel
Copy link
Contributor

vercel bot commented Feb 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
readme-gen-ai Ready Ready Preview, Comment Feb 21, 2026 10:56am

@coderabbitai
Copy link

coderabbitai bot commented Feb 21, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added an enhanced full-page 404 Not Found experience with a dark-themed layout, animated blue glow, status badge, prominent headline and description, two clear CTAs ("Back to Safety" and "Go Back"), and a stylized diagnostic panel resembling a console for contextual info.

Walkthrough

Adds a new client-side Next.js React component NotFound that renders a styled 404 page with CTAs, a faux diagnostic console panel, and visual effects; also pins the devDependency typescript to version 5.9.3 in package.json.

Changes

Cohort / File(s) Summary
404 Not Found Page
src/app/not-found.tsx
New client-side React component exporting default NotFound; renders full-page 404 UI with hero layout, status badge, two CTAs (home link and history.back), faux console diagnostic panel, uses shared Button, lucide-react icons, and Tailwind classes.
Package manifest
package.json
Updated devDependency typescript from ^5 to exact 5.9.3 (pins TypeScript version).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • update home page #16: Adds UI primitives (shared Button and icon usage) that the new NotFound component depends on.

Suggested labels

area: frontend

Suggested reviewers

  • adithyanmkd

Poem

🐰 I hopped in with a 404 cheer,
A glowing page when routes disappear,
Two buttons to guide, a faux console light,
Back to safety or back in flight—
Happy hops for the devs tonight! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Create not-found.tsx' directly describes the main change—introducing a new 404 error page component file.
Description check ✅ Passed The description uses a template with mostly unfilled placeholders and checkboxes; however, it does reference the PR type as a BeyteFlow protocol and relates to the changeset (creating a new component).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch not-found-page

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/app/not-found.tsx (1)

1-6: "use client" prevents exporting metadata for the 404 page

The directive is only needed for window.history.back() on line 53. Making the entire page a client component means you cannot export a metadata object, so the 404 page will have no custom title or description — a missed SEO opportunity.

Consider extracting just the "Go Back" button into a small client component, keeping not-found.tsx as a server component:

♻️ Proposed refactor (illustrative)
// src/components/ui/GoBackButton.tsx  (new file)
+"use client";
+import { Button } from "@/components/ui/Button";
+import { MoveLeft } from "lucide-react";
+
+export function GoBackButton({ className }: { className?: string }) {
+  return (
+    <Button
+      variant="outline"
+      onClick={() => window.history.back()}
+      className={className}
+    >
+      <MoveLeft size={20} />
+      Go Back
+    </Button>
+  );
+}
// src/app/not-found.tsx
-"use client";
-
 import React from "react";
 import Link from "next/link";
-import { Home, MoveLeft } from "lucide-react";
+import { Home } from "lucide-react";
 import { Button } from "@/components/ui/Button";
+import { GoBackButton } from "@/components/ui/GoBackButton";
+import type { Metadata } from "next";
+
+export const metadata: Metadata = {
+  title: "404 – Page Not Found",
+};
-          <Button
-            variant="outline"
-            onClick={() => window.history.back()}
-            className="w-full sm:w-auto px-10 py-4 text-lg"
-          >
-            <MoveLeft size={20} />
-            Go Back
-          </Button>
+          <GoBackButton className="w-full sm:w-auto px-10 py-4 text-lg" />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/not-found.tsx` around lines 1 - 6, Remove the top-level "use client"
from not-found.tsx so the file remains a server component and add an exported
metadata object (title/description) there; extract the back-navigation UI into a
small client-only component (e.g., GoBackButton) that contains the
window.history.back() call and the MoveLeft/Button usage, import that client
component into not-found.tsx, and keep the rest of the markup (Home icon, links,
Button styles) in the server component so SEO metadata can be exported.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/not-found.tsx`:
- Around line 41-49: The current markup nests a semantic <button> (Button
component) inside a Next.js <Link> which renders an <a>, producing invalid HTML;
fix it by using Button's asChild prop and moving the Link to be the Button's
child so Button forwards its styles/props onto the Link's anchor element (i.e.,
change to <Button asChild ...><Link href="/">…</Link></Button>), preserving all
existing Button props (variant, className, icons/text) and keeping the same
visual layout and accessibility.

---

Nitpick comments:
In `@src/app/not-found.tsx`:
- Around line 1-6: Remove the top-level "use client" from not-found.tsx so the
file remains a server component and add an exported metadata object
(title/description) there; extract the back-navigation UI into a small
client-only component (e.g., GoBackButton) that contains the
window.history.back() call and the MoveLeft/Button usage, import that client
component into not-found.tsx, and keep the rest of the markup (Home icon, links,
Button styles) in the server component so SEO metadata can be exported.

@naheel0
Copy link
Member Author

naheel0 commented Feb 21, 2026

@copilot fix ithis
Verify each finding against the current code and only fix it if needed.

In @src/app/not-found.tsx around lines 41 - 49, The current markup nests a
semantic (Button component) inside a Next.js which renders an
, producing invalid HTML; fix it by using Button's asChild prop and moving
the Link to be the Button's child so Button forwards its styles/props onto the
Link's anchor element (i.e., change to <Button asChild ...>…), preserving all existing Button props (variant,
className, icons/text) and keeping the same visual layout and accessibility.

Copy link
Contributor

Copilot AI commented Feb 21, 2026

@naheel0 I've opened a new pull request, #41, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits February 21, 2026 10:45
…found.tsx

Co-authored-by: naheel0 <191262736+naheel0@users.noreply.github.com>
Fix invalid semantic HTML: `<button>` nested inside `<a>` in not-found.tsx
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/app/not-found.tsx (1)

3-3: import React is unnecessary with the new JSX transform.

React 19 + Next.js with the modern JSX transform (enabled by default since Next.js 10) no longer requires importing React for JSX. This import can be safely removed.

♻️ Proposed fix
-import React from "react";
 import Link from "next/link";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/not-found.tsx` at line 3, Remove the unnecessary top-level import
statement `import React from "react";` from the not-found component file (the
import line shown in the diff) since the modern JSX transform in Next.js/React
handles JSX without an explicit React import; simply delete that import
statement so the file relies on the automatic JSX runtime.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/not-found.tsx`:
- Around line 10-11: The inline comment above the section in
src/app/not-found.tsx is stale (mentions pt-32) while the section's className
uses pt-8; either update the comment to reflect "pt-8" or change the section's
padding class to "pt-32" so it matches the Hero layout. Locate the section
element with className="... pt-8 ..." in not-found.tsx and decide which fix you
want: (a) change the comment text to "pt-8, pb-20, background black" if the
smaller spacing is intentional, or (b) change the className token from pt-8 to
pt-32 to match the Hero spacing; ensure the comment and the className remain
consistent after the change.
- Around line 52-59: The "Go Back" Button uses window.history.back() which is a
no-op with an empty history; update the Button in not-found.tsx to guard and
provide a fallback: detect whether a back navigation is possible (e.g., check
window.history.length > 1 or document.referrer) before calling
window.history.back(), and if not available use a fallback navigation (e.g.,
router.push('/') or window.location.replace('/')) or disable/hide the Button;
modify the onClick handler for the Button component and/or conditionally
render/disable it so that MoveLeft + "Go Back" always either navigates back or
reliably redirects to a safe page.
- Line 18: The Tailwind animation utilities used in not-found.tsx (classes like
"animate-in", "fade-in", "slide-in-from-bottom-3", "zoom-in") won't work because
the tailwindcss-animate plugin needs to be explicitly imported; open
src/app/globals.css and add the import for the plugin immediately after the
existing `@import` "tailwindcss" statement (i.e., insert the tailwindcss-animate
import so the plugin-provided utility classes are available).

---

Duplicate comments:
In `@src/app/not-found.tsx`:
- Around line 41-50: The current implementation correctly uses the Radix
"asChild" pattern by rendering <Link> inside Button (see Button asChild and
Link), so no code changes are required; keep the Button asChild wrapping Link to
ensure props/classes merge onto the rendered anchor and leave the JSX as shown.

---

Nitpick comments:
In `@src/app/not-found.tsx`:
- Line 3: Remove the unnecessary top-level import statement `import React from
"react";` from the not-found component file (the import line shown in the diff)
since the modern JSX transform in Next.js/React handles JSX without an explicit
React import; simply delete that import statement so the file relies on the
automatic JSX runtime.

Comment on lines +10 to +11
/* Layout synced with Hero: pt-32, pb-20, background black */
<section className="relative min-h-screen pt-8 pb-20 overflow-hidden bg-black flex flex-col items-center justify-center">
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Stale comment: pt-32 doesn't match the applied pt-8.

The comment claims the padding-top is synced to pt-32 (matching the Hero section), but the actual class is pt-8. Update the comment or the class to be consistent.

✏️ Proposed fix
-    /* Layout synced with Hero: pt-32, pb-20, background black */
-    <section className="relative min-h-screen pt-8 pb-20 overflow-hidden bg-black flex flex-col items-center justify-center">
+    /* Layout synced with Hero: pt-8, pb-20, background black */
+    <section className="relative min-h-screen pt-8 pb-20 overflow-hidden bg-black flex flex-col items-center justify-center">
📝 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
/* Layout synced with Hero: pt-32, pb-20, background black */
<section className="relative min-h-screen pt-8 pb-20 overflow-hidden bg-black flex flex-col items-center justify-center">
/* Layout synced with Hero: pt-8, pb-20, background black */
<section className="relative min-h-screen pt-8 pb-20 overflow-hidden bg-black flex flex-col items-center justify-center">
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/not-found.tsx` around lines 10 - 11, The inline comment above the
section in src/app/not-found.tsx is stale (mentions pt-32) while the section's
className uses pt-8; either update the comment to reflect "pt-8" or change the
section's padding class to "pt-32" so it matches the Hero layout. Locate the
section element with className="... pt-8 ..." in not-found.tsx and decide which
fix you want: (a) change the comment text to "pt-8, pb-20, background black" if
the smaller spacing is intentional, or (b) change the className token from pt-8
to pt-32 to match the Hero spacing; ensure the comment and the className remain
consistent after the change.

{/* Constraints matched to Hero: max-w-5xl, px-4 */}
<div className="max-w-5xl mx-auto px-4 text-center relative z-10 w-full flex flex-col items-center">
{/* Status Badge - Hero style animation */}
<div className="mb-8 inline-flex items-center gap-2 px-3 py-1 rounded-full border border-blue-500/20 bg-blue-500/5 text-blue-400 text-xs font-semibold uppercase tracking-wider animate-in fade-in slide-in-from-bottom-3 duration-700">
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for tailwindcss-animate or tw-animate-css in package.json
echo "=== package.json dep check ==="
grep -E "tailwindcss-animate|tw-animate-css" package.json 2>/dev/null || echo "NOT FOUND in package.json"

# List all dependencies to see what animation-related packages exist
echo "=== All dependencies in package.json ==="
cat package.json | grep -A 50 '"dependencies"' | head -30

# Check for the plugin import in CSS globals
echo "=== CSS globals import check ==="
find . -type f \( -name "*.css" -o -name "*.scss" \) | head -10 | xargs grep -l "tailwindcss-animate\|tw-animate-css\|@tailwind" 2>/dev/null | head -5

# Check tailwind config for plugin registration
echo "=== tailwind config files ==="
find . -type f -name "tailwind.config.*" -o -name "tailwind.config.js" | xargs cat 2>/dev/null

# Search for animation class usage in the file mentioned
echo "=== Animation classes in src/app/not-found.tsx ==="
grep -n "animate-in\|fade-in\|slide-in\|zoom-in" src/app/not-found.tsx 2>/dev/null

Repository: BeyteFlow/ReadmeGenAI

Length of output: 1936


🏁 Script executed:

npm install -D tailwindcss-animate

Repository: BeyteFlow/ReadmeGenAI

Length of output: 409


🏁 Script executed:

#!/bin/bash
# Find tailwind config file
echo "=== Tailwind config files ==="
find . -type f \( -name "tailwind.config.*" -o -name "tailwind.config.ts" -o -name "tailwind.config.js" \) 2>/dev/null

# Find globals/global CSS
echo "=== Global CSS files ==="
find . -type f \( -name "globals.css" -o -name "global.css" -o -name "globals.scss" \) 2>/dev/null

# Check app directory structure
echo "=== App directory structure ==="
find ./src/app -type f -name "*.css" 2>/dev/null | head -10

# Check if tailwind config exists in postcss or next config
echo "=== PostCSS config ==="
find . -type f \( -name "postcss.config.*" -o -name "next.config.*" \) 2>/dev/null | head -5 | xargs cat 2>/dev/null

Repository: BeyteFlow/ReadmeGenAI

Length of output: 445


🏁 Script executed:

cat -n ./src/app/globals.css

Repository: BeyteFlow/ReadmeGenAI

Length of output: 734


Add tailwindcss-animate import to globals.css.

The tailwindcss-animate plugin has been installed, but Tailwind v4 with @tailwindcss/postcss requires explicit import. Add this line to ./src/app/globals.css after the existing @import "tailwindcss":

`@import` "tailwindcss-animate";

Without this, the animation utility classes (animate-in, fade-in, slide-in-from-*, zoom-in) on lines 18, 27, 34, 40, and 62 will not render.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/not-found.tsx` at line 18, The Tailwind animation utilities used in
not-found.tsx (classes like "animate-in", "fade-in", "slide-in-from-bottom-3",
"zoom-in") won't work because the tailwindcss-animate plugin needs to be
explicitly imported; open src/app/globals.css and add the import for the plugin
immediately after the existing `@import` "tailwindcss" statement (i.e., insert the
tailwindcss-animate import so the plugin-provided utility classes are
available).

Comment on lines +52 to +59
<Button
variant="outline"
onClick={() => window.history.back()}
className="w-full sm:w-auto px-10 py-4 text-lg"
>
<MoveLeft size={20} />
Go Back
</Button>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

window.history.back() is a no-op when there's no browser history.

If the user navigates directly to a 404 URL (e.g., via a bookmarked broken link), the history stack is empty and the "Go Back" button silently does nothing. Consider disabling it or hiding it when there's no previous entry, or replacing it with a fallback redirect.

💡 Suggested guard
  <Button
    variant="outline"
-   onClick={() => window.history.back()}
+   onClick={() => {
+     if (window.history.length > 1) {
+       window.history.back();
+     } else {
+       window.location.href = "/";
+     }
+   }}
    className="w-full sm:w-auto px-10 py-4 text-lg"
  >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/not-found.tsx` around lines 52 - 59, The "Go Back" Button uses
window.history.back() which is a no-op with an empty history; update the Button
in not-found.tsx to guard and provide a fallback: detect whether a back
navigation is possible (e.g., check window.history.length > 1 or
document.referrer) before calling window.history.back(), and if not available
use a fallback navigation (e.g., router.push('/') or
window.location.replace('/')) or disable/hide the Button; modify the onClick
handler for the Button component and/or conditionally render/disable it so that
MoveLeft + "Go Back" always either navigates back or reliably redirects to a
safe page.

@naheel0 naheel0 merged commit c77658a into main Feb 21, 2026
7 checks passed
@naheel0 naheel0 deleted the not-found-page branch February 21, 2026 11:03
@coderabbitai coderabbitai bot mentioned this pull request Feb 21, 2026
10 tasks
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.

2 participants