This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.9 MiB |
@@ -1,5 +1,6 @@
|
|||||||
import { Helmet } from 'react-helmet-async'
|
import { Helmet } from 'react-helmet-async'
|
||||||
|
|
||||||
|
import notFoundImg from '@/assets/images/not-found.gif'
|
||||||
import MainArea from '@/components/layout/MainArea'
|
import MainArea from '@/components/layout/MainArea'
|
||||||
import { SITE_TITLE } from '@/config'
|
import { SITE_TITLE } from '@/config'
|
||||||
|
|
||||||
@@ -7,12 +8,19 @@ import { SITE_TITLE } from '@/config'
|
|||||||
export default () => (
|
export default () => (
|
||||||
<MainArea>
|
<MainArea>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
<title>ページないよ (笑) | {SITE_TITLE}</title>
|
<title>ページないよ (笑) | {SITE_TITLE}</title>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<div className="text-6xl font-bold italic text-transparent whitespace-nowrap
|
<div className="text-6xl font-bold text-transparent whitespace-nowrap
|
||||||
bg-[linear-gradient(90deg,#ff0000,#ff8800,#ffff00,#00ff00,#00ffff,#0000ff,#ff00ff,#ff0000)]
|
bg-[linear-gradient(90deg,#ff0000,#ff8800,#ffff00,#00ff00,#00ffff,#0000ff,#ff00ff,#ff0000)]
|
||||||
bg-clip-text bg-[length:200%_100%] animate-rainbow-scroll drop-shadow-[0_0_6px_white]">
|
bg-clip-text bg-[length:200%_100%] animate-rainbow-scroll drop-shadow-[0_0_6px_black]
|
||||||
404<br />ページないよ(笑)
|
space-y-6 text-center flex flex-col justify-center items-center">
|
||||||
|
<p>404</p>
|
||||||
|
<div className="flex space-x-4">
|
||||||
|
<p style={{ writingMode: 'vertical-rl' }}>帰れ!</p>
|
||||||
|
<img src={notFoundImg} alt="404" />
|
||||||
|
<p style={{ writingMode: 'vertical-rl' }}>帰れ!</p>
|
||||||
|
</div>
|
||||||
|
<p className="mr-[-.5em]">ページないよ(笑)</p>
|
||||||
</div>
|
</div>
|
||||||
</MainArea>)
|
</MainArea>)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { Button } from '@/components/ui/button'
|
|||||||
import { toast } from '@/components/ui/use-toast'
|
import { toast } from '@/components/ui/use-toast'
|
||||||
import { API_BASE_URL, SITE_TITLE } from '@/config'
|
import { API_BASE_URL, SITE_TITLE } from '@/config'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
import NotFound from '@/pages/NotFound'
|
||||||
|
|
||||||
import type { Post, User } from '@/types'
|
import type { Post, User } from '@/types'
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ export default ({ user }: Props) => {
|
|||||||
|
|
||||||
const [post, setPost] = useState<Post | null> (null)
|
const [post, setPost] = useState<Post | null> (null)
|
||||||
const [editing, setEditing] = useState (true)
|
const [editing, setEditing] = useState (true)
|
||||||
|
const [found, setFound] = useState (true)
|
||||||
|
|
||||||
const changeViewedFlg = async () => {
|
const changeViewedFlg = async () => {
|
||||||
const url = `${ API_BASE_URL }/posts/${ id }/viewed`
|
const url = `${ API_BASE_URL }/posts/${ id }/viewed`
|
||||||
@@ -57,7 +59,8 @@ export default ({ user }: Props) => {
|
|||||||
}
|
}
|
||||||
catch (err)
|
catch (err)
|
||||||
{
|
{
|
||||||
console.error ('うんち!', err)
|
if (err.status === 404)
|
||||||
|
setFound (false)
|
||||||
}
|
}
|
||||||
}) ()
|
}) ()
|
||||||
}, [id])
|
}, [id])
|
||||||
@@ -71,6 +74,9 @@ export default ({ user }: Props) => {
|
|||||||
setEditing (true)
|
setEditing (true)
|
||||||
}, [editing])
|
}, [editing])
|
||||||
|
|
||||||
|
if (!(found))
|
||||||
|
return <NotFound />
|
||||||
|
|
||||||
const url = post ? new URL (post.url) : null
|
const url = post ? new URL (post.url) : null
|
||||||
const nicoFlg = url?.hostname.split ('.').slice (-2).join ('.') === 'nicovideo.jp'
|
const nicoFlg = url?.hostname.split ('.').slice (-2).join ('.') === 'nicovideo.jp'
|
||||||
const match = nicoFlg ? url.pathname.match (/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/) : null
|
const match = nicoFlg ? url.pathname.match (/(?<=\/watch\/)[a-zA-Z0-9]+?(?=\/|$)/) : null
|
||||||
|
|||||||
Reference in New Issue
Block a user