-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(404): added 404 page #1401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| 'use client' | ||
|
|
||
| import { useEffect, useState } from 'react' | ||
| import Link from 'next/link' | ||
| import { Button } from '@/components/ui/button' | ||
| import { useBrandConfig } from '@/lib/branding/branding' | ||
| import AuthBackground from '@/app/(auth)/components/auth-background' | ||
| import Nav from '@/app/(landing)/components/nav/nav' | ||
|
|
||
| function isColorDark(hexColor: string): boolean { | ||
| const hex = hexColor.replace('#', '') | ||
| const r = Number.parseInt(hex.substring(0, 2), 16) | ||
| const g = Number.parseInt(hex.substring(2, 4), 16) | ||
| const b = Number.parseInt(hex.substring(4, 6), 16) | ||
| const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255 | ||
| return luminance < 0.5 | ||
| } | ||
|
|
||
| export default function NotFound() { | ||
| const [buttonClass, setButtonClass] = useState('auth-button-gradient') | ||
| const brandConfig = useBrandConfig() | ||
|
|
||
| useEffect(() => { | ||
| const rootStyle = getComputedStyle(document.documentElement) | ||
| const brandBackground = rootStyle.getPropertyValue('--brand-background-hex').trim() | ||
|
|
||
| if (brandBackground && isColorDark(brandBackground)) { | ||
| document.body.classList.add('auth-dark-bg') | ||
| } else { | ||
| document.body.classList.remove('auth-dark-bg') | ||
| } | ||
| }, []) | ||
|
|
||
| useEffect(() => { | ||
| const checkCustomBrand = () => { | ||
| const computedStyle = getComputedStyle(document.documentElement) | ||
| const brandAccent = computedStyle.getPropertyValue('--brand-accent-hex').trim() | ||
| if (brandAccent && brandAccent !== '#6f3dfa') { | ||
| setButtonClass('auth-button-custom') | ||
| } else { | ||
| setButtonClass('auth-button-gradient') | ||
| } | ||
| } | ||
| checkCustomBrand() | ||
| window.addEventListener('resize', checkCustomBrand) | ||
| const observer = new MutationObserver(checkCustomBrand) | ||
| observer.observe(document.documentElement, { | ||
| attributes: true, | ||
| attributeFilter: ['style', 'class'], | ||
| }) | ||
| return () => { | ||
| window.removeEventListener('resize', checkCustomBrand) | ||
| observer.disconnect() | ||
| } | ||
| }, []) | ||
|
|
||
| return ( | ||
| <AuthBackground> | ||
| <main className='relative flex min-h-screen flex-col font-geist-sans text-foreground'> | ||
| {/* Header */} | ||
| <Nav hideAuthButtons={true} variant='auth' /> | ||
|
|
||
| {/* Content */} | ||
| <div className='relative z-30 flex flex-1 items-center justify-center px-4 pb-24'> | ||
| <div className='text-center'> | ||
| <div className='mb-4 font-bold text-8xl text-foreground'>404</div> | ||
| <div className='mb-8'> | ||
| <Button | ||
| asChild | ||
| className={`${buttonClass} flex w-full items-center justify-center gap-2 rounded-[10px] border font-medium text-[15px] text-white transition-all duration-200`} | ||
| > | ||
| <Link href='/'>Back to Workspace</Link> | ||
| </Button> | ||
| </div> | ||
|
|
||
| <div className='text-center text-muted-foreground text-sm'> | ||
| Need help?{' '} | ||
| <a | ||
| href={`mailto:${brandConfig.supportEmail}`} | ||
| className='underline-offset-4 transition hover:underline' | ||
| > | ||
| Contact support | ||
| </a> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </main> | ||
| </AuthBackground> | ||
| ) | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Resize event listener seems unnecessary for brand color detection - brand colors don't typically change on window resize