Skip to content

Commit 6b4ebba

Browse files
authored
feat(404): added 404 page (#1401)
* feat(404): added 404 page * use provided brand support email over default sim one
1 parent 708321d commit 6b4ebba

File tree

2 files changed

+93
-6
lines changed

2 files changed

+93
-6
lines changed

apps/sim/app/invite/components/status-card.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CheckCircle2, Mail, RotateCcw, ShieldX, UserPlus, Users2 } from 'lucide
55
import { useRouter } from 'next/navigation'
66
import { Button } from '@/components/ui/button'
77
import { LoadingAgent } from '@/components/ui/loading-agent'
8+
import { useBrandConfig } from '@/lib/branding/branding'
89
import { inter } from '@/app/fonts/inter'
910
import { soehne } from '@/app/fonts/soehne/soehne'
1011

@@ -57,6 +58,7 @@ export function InviteStatusCard({
5758
}: InviteStatusCardProps) {
5859
const router = useRouter()
5960
const [buttonClass, setButtonClass] = useState('auth-button-gradient')
61+
const brandConfig = useBrandConfig()
6062

6163
useEffect(() => {
6264
const checkCustomBrand = () => {
@@ -116,11 +118,6 @@ export function InviteStatusCard({
116118
return (
117119
<div className={`${soehne.className} space-y-6`}>
118120
<div className='space-y-1 text-center'>
119-
{IconComponent && (
120-
<div className={`mx-auto mb-4 w-fit rounded-full p-3 ${iconBg}`}>
121-
<IconComponent className={`h-8 w-8 ${iconColor}`} />
122-
</div>
123-
)}
124121
<h1 className='font-medium text-[32px] text-black tracking-tight'>{title}</h1>
125122
<p className={`${inter.className} font-[380] text-[16px] text-muted-foreground`}>
126123
{description}
@@ -172,7 +169,7 @@ export function InviteStatusCard({
172169
>
173170
Need help?{' '}
174171
<a
175-
href='mailto:[email protected]'
172+
href={`mailto:${brandConfig.supportEmail}`}
176173
className='auth-link underline-offset-4 transition hover:underline'
177174
>
178175
Contact support

apps/sim/app/not-found.tsx

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
'use client'
2+
3+
import { useEffect, useState } from 'react'
4+
import Link from 'next/link'
5+
import { Button } from '@/components/ui/button'
6+
import { useBrandConfig } from '@/lib/branding/branding'
7+
import AuthBackground from '@/app/(auth)/components/auth-background'
8+
import Nav from '@/app/(landing)/components/nav/nav'
9+
10+
function isColorDark(hexColor: string): boolean {
11+
const hex = hexColor.replace('#', '')
12+
const r = Number.parseInt(hex.substring(0, 2), 16)
13+
const g = Number.parseInt(hex.substring(2, 4), 16)
14+
const b = Number.parseInt(hex.substring(4, 6), 16)
15+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255
16+
return luminance < 0.5
17+
}
18+
19+
export default function NotFound() {
20+
const [buttonClass, setButtonClass] = useState('auth-button-gradient')
21+
const brandConfig = useBrandConfig()
22+
23+
useEffect(() => {
24+
const rootStyle = getComputedStyle(document.documentElement)
25+
const brandBackground = rootStyle.getPropertyValue('--brand-background-hex').trim()
26+
27+
if (brandBackground && isColorDark(brandBackground)) {
28+
document.body.classList.add('auth-dark-bg')
29+
} else {
30+
document.body.classList.remove('auth-dark-bg')
31+
}
32+
}, [])
33+
34+
useEffect(() => {
35+
const checkCustomBrand = () => {
36+
const computedStyle = getComputedStyle(document.documentElement)
37+
const brandAccent = computedStyle.getPropertyValue('--brand-accent-hex').trim()
38+
if (brandAccent && brandAccent !== '#6f3dfa') {
39+
setButtonClass('auth-button-custom')
40+
} else {
41+
setButtonClass('auth-button-gradient')
42+
}
43+
}
44+
checkCustomBrand()
45+
window.addEventListener('resize', checkCustomBrand)
46+
const observer = new MutationObserver(checkCustomBrand)
47+
observer.observe(document.documentElement, {
48+
attributes: true,
49+
attributeFilter: ['style', 'class'],
50+
})
51+
return () => {
52+
window.removeEventListener('resize', checkCustomBrand)
53+
observer.disconnect()
54+
}
55+
}, [])
56+
57+
return (
58+
<AuthBackground>
59+
<main className='relative flex min-h-screen flex-col font-geist-sans text-foreground'>
60+
{/* Header */}
61+
<Nav hideAuthButtons={true} variant='auth' />
62+
63+
{/* Content */}
64+
<div className='relative z-30 flex flex-1 items-center justify-center px-4 pb-24'>
65+
<div className='text-center'>
66+
<div className='mb-4 font-bold text-8xl text-foreground'>404</div>
67+
<div className='mb-8'>
68+
<Button
69+
asChild
70+
className={`${buttonClass} flex w-full items-center justify-center gap-2 rounded-[10px] border font-medium text-[15px] text-white transition-all duration-200`}
71+
>
72+
<Link href='/'>Back to Workspace</Link>
73+
</Button>
74+
</div>
75+
76+
<div className='text-center text-muted-foreground text-sm'>
77+
Need help?{' '}
78+
<a
79+
href={`mailto:${brandConfig.supportEmail}`}
80+
className='underline-offset-4 transition hover:underline'
81+
>
82+
Contact support
83+
</a>
84+
</div>
85+
</div>
86+
</div>
87+
</main>
88+
</AuthBackground>
89+
)
90+
}

0 commit comments

Comments
 (0)