Skip to content

Commit f4c7c78

Browse files
feat: add click-to-copy functionality to 404 terminal
1 parent 3b13b71 commit f4c7c78

1 file changed

Lines changed: 30 additions & 8 deletions

File tree

app/not-found.tsx

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
'use client';
12
import Link from 'next/link';
23

4+
import { toast } from 'sonner';
35
export default function NotFound() {
6+
const terminalContent = `git checkout this-page
7+
8+
The page you're looking for has been rebased out of existence. No stash. No reflog. Just vibes.
9+
10+
hint: Did you mean some other username?`;
11+
12+
const handleCopy = async () => {
13+
try {
14+
await navigator.clipboard.writeText(terminalContent);
15+
toast.success('Terminal output copied!');
16+
} catch {
17+
toast.error('Failed to copy terminal output');
18+
}
19+
};
20+
421
return (
5-
<main className="relative min-h-screen text-white overflow-hidden flex flex-col items-center font-sans ">
22+
<main className="relative min-h-screen text-white overflow-hidden flex flex-col items-center font-sans">
623
<div
724
aria-hidden="true"
825
className="pointer-events-none fixed inset-0"
@@ -14,8 +31,8 @@ export default function NotFound() {
1431
/>
1532

1633
<div aria-hidden="true" className="pointer-events-none absolute inset-0 overflow-hidden">
17-
<div className="absolute top-[-10%] left-[20%] h-screen w-screen rounded-full blur-[140px]" />
18-
<div className="absolute bottom-[-10%] right-[15%] h-screen w-screen rounded-full blur-[120px]" />
34+
<div className="absolute top-[-10%] left-[20%] h-screen w-screen rounded-full blur-[140px]" />
35+
<div className="absolute bottom-[-10%] right-[15%] h-screen w-screen rounded-full blur-[120px]" />
1936
</div>
2037

2138
<div className="relative z-10 flex flex-col items-center justify-start gap-8 max-w-lg w-full text-center">
@@ -38,12 +55,16 @@ export default function NotFound() {
3855
</h1>
3956
</div>
4057

41-
<div className="w-full rounded-2xl border border-white/10 bg-white/3 backdrop-blur-md overflow-hidden ">
58+
<div
59+
onClick={handleCopy}
60+
className="w-full rounded-2xl border border-white/10 bg-white/3 backdrop-blur-md overflow-hidden cursor-pointer hover:bg-white/5 transition-all duration-200"
61+
>
4262
<div className="flex items-center gap-2 border-b border-white/10 bg-white/4 px-4 py-3">
4363
<span className="h-3 w-3 rounded-full bg-red-500/70" />
4464
<span className="h-3 w-3 rounded-full bg-yellow-500/70" />
4565
<span className="h-3 w-3 rounded-full bg-green-500/70" />
4666
<span className="ml-3 text-xs font-mono text-white/30">commitpulse — bash</span>
67+
<span className="ml-auto text-xs text-white/40">Click to copy</span>
4768
</div>
4869

4970
<div className="px-6 py-5 font-mono text-sm text-left space-y-2">
@@ -54,12 +75,14 @@ export default function NotFound() {
5475
git checkout <span className="text-cyan-400">this-page</span>
5576
</span>
5677
</p>
57-
<p className="text-red-400/80 ">
58-
{' '}
78+
79+
<p className="text-red-400/80">
5980
The page you&apos;re looking for has been rebased out of existence. No stash. No
6081
reflog. Just vibes.
6182
</p>
83+
6284
<p className="text-white/30 text-xs mt-1">hint: Did you mean some other username?</p>
85+
6386
<p className="flex items-center gap-1 pt-1">
6487
<span className="text-violet-400">~</span>
6588
<span className="text-white/40"> $ </span>
@@ -79,15 +102,14 @@ export default function NotFound() {
79102
>
80103
git checkout main
81104
</Link>
105+
82106
<Link
83107
href="/"
84108
className="flex-1 py-3 rounded-xl font-semibold text-sm text-white/60 text-center border border-white/10 hover:bg-white/5 hover:text-white transition-all"
85109
>
86110
Go back home
87111
</Link>
88112
</div>
89-
90-
{/* <p className="text-white/20 text-xs font-mono">exit code 404 · no such file or directory</p> */}
91113
</div>
92114
</main>
93115
);

0 commit comments

Comments
 (0)