Skip to content

Commit 5f12963

Browse files
committed
fix: path normalized
1 parent 47dd435 commit 5f12963

3 files changed

Lines changed: 47 additions & 9 deletions

File tree

packages/docs/contents/deployment/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ createdAt: 2025-07-20T22:35:03+08:00
55
lastModified: 2025-07-20T22:35:03+08:00
66
---
77

8-
# Deployment
8+
# Deployment
9+
10+
Deploying Afilmory in production involves

packages/docs/src/App.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AlignLeftIcon } from 'lucide-react'
1+
import { AlignLeftIcon, ArrowRight } from 'lucide-react'
22
import { useCallback, useRef, useState } from 'react'
33

44
import { MDX } from './components'
@@ -7,11 +7,22 @@ import { MobileTableOfContents } from './components/MobileTableOfContents'
77
import { Sidebar } from './components/Sidebar'
88
import { TableOfContents } from './components/TableOfContents'
99
import routes from './routes'
10+
import { getRandomKaomoji } from './utils/kaomoji'
1011

1112
function App({ url }: { url?: string }) {
1213
const [currentPath, setCurrentPath] = useState(url || '/')
1314
const [isSidebarOpen, setIsSidebarOpen] = useState(false)
14-
const matchedRoute = routes.find((route) => route.path === currentPath)
15+
const matchedRoute = routes.find((route) => {
16+
const normalizedCurrentPath =
17+
currentPath.endsWith('/') && currentPath !== '/'
18+
? currentPath.slice(0, -1)
19+
: currentPath
20+
const normalizedRoutePath =
21+
route.path.endsWith('/') && route.path !== '/'
22+
? route.path.slice(0, -1)
23+
: route.path
24+
return normalizedRoutePath === normalizedCurrentPath
25+
})
1526
const mainContentRef = useRef<HTMLDivElement>(null)
1627

1728
const handleScrollMainContent = (top: number) => {
@@ -93,17 +104,18 @@ function App({ url }: { url?: string }) {
93104
</div>
94105
</div>
95106

96-
<div className="bg-background-secondary border-separator-opaque mx-4 mt-16 rounded-xl border p-8 text-center shadow-sm lg:mt-0">
97-
<h1 className="text-text-primary mb-3 text-3xl font-semibold">
98-
404
99-
</h1>
107+
<div className="mx-4 mt-16 rounded-xl p-8 text-center lg:mt-0">
108+
<div className="mb-6 flex items-center justify-center text-4xl">
109+
{getRandomKaomoji()}
110+
</div>
111+
<h1 className="mb-1 text-3xl font-semibold">404</h1>
100112
<p className="text-text-secondary text-lg">Page not found</p>
101113
<button
102114
onClick={() => handleNavigate('/')}
103-
className="bg-accent mt-6 rounded-lg px-4 py-2 text-white transition-opacity hover:opacity-90"
115+
className="bg-accent mt-6 rounded-2xl px-4 py-2 text-white transition-opacity hover:opacity-90"
104116
type="button"
105117
>
106-
Return Home
118+
Return Home <ArrowRight className="inline-block h-4 w-4" />
107119
</button>
108120
</div>
109121

packages/docs/src/utils/kaomoji.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const kaomojiList = [
2+
'Σ(lliд゚ノ)ノ',
3+
'(((゚Д゚;)))',
4+
'。・゚・(つд`゚)・゚・',
5+
'(;へ:)',
6+
'(;´д`)ゞ',
7+
'(; ̄Д ̄)',
8+
'(;_;)',
9+
'(T_T)',
10+
'(╥﹏╥)',
11+
'(ノД`)・゜・。',
12+
'(つд⊂)',
13+
'(つω`。)',
14+
'(;д;)',
15+
'(;_;)',
16+
'(;ω;)',
17+
'(;д;)',
18+
'(;д;`)',
19+
]
20+
21+
export function getRandomKaomoji() {
22+
const index = Math.floor(Math.random() * kaomojiList.length)
23+
return kaomojiList[index]
24+
}

0 commit comments

Comments
 (0)