このコミットが含まれているのは:
2026-05-11 03:32:47 +09:00
コミット add60cb413
72個のファイルの変更1659行の追加247行の削除
+5 -1
ファイルの表示
@@ -1,3 +1,5 @@
import type { FC } from 'react'
import { useQuery } from '@tanstack/react-query'
import { useEffect, useMemo } from 'react'
import { Helmet } from 'react-helmet-async'
@@ -19,7 +21,7 @@ import { fetchWikiPage, fetchWikiPageByTitle } from '@/lib/wiki'
import type { Tag } from '@/types'
export default () => {
const WikiDetailPage: FC = () => {
const params = useParams ()
const title = params.title ?? ''
@@ -126,3 +128,5 @@ export default () => {
</article>
</MainArea>)
}
export default WikiDetailPage
+6 -2
ファイルの表示
@@ -1,3 +1,5 @@
import type { FC } from 'react'
import { useEffect, useState } from 'react'
import { Helmet } from 'react-helmet-async'
import { useLocation, useParams } from 'react-router-dom'
@@ -11,7 +13,7 @@ import { cn } from '@/lib/utils'
import type { WikiPageDiff } from '@/types'
export default () => {
const WikiDiffPage: FC = () => {
const { id } = useParams ()
const location = useLocation ()
@@ -26,7 +28,7 @@ export default () => {
void (async () => {
setDiff (await apiGet<WikiPageDiff> (`/wiki/${ id }/diff`, { params: { from, to } }))
}) ()
}, [])
}, [from, id, to])
return (
<MainArea>
@@ -46,3 +48,5 @@ export default () => {
</div>
</MainArea>)
}
export default WikiDiffPage
+12 -5
ファイルの表示
@@ -23,9 +23,8 @@ const mdParser = new MarkdownIt
type Props = { user: User | null }
export default (({ user }: Props) => {
if (!(['admin', 'member'].some (r => user?.role === r)))
return <Forbidden/>
const WikiEditPage: FC<Props> = ({ user }) => {
const editable = ['admin', 'member'].some (r => user?.role === r)
const { id } = useParams ()
@@ -59,6 +58,9 @@ export default (({ user }: Props) => {
}
useEffect (() => {
if (!(editable))
return
void (async () => {
setLoading (true)
const data = await apiGet<WikiPage> (`/wiki/${ id }`)
@@ -66,7 +68,10 @@ export default (({ user }: Props) => {
setBody (data.body)
setLoading (false)
}) ()
}, [id])
}, [editable, id])
if (!(editable))
return <Forbidden/>
return (
<MainArea>
@@ -105,4 +110,6 @@ export default (({ user }: Props) => {
</>)}
</div>
</MainArea>)
}) satisfies FC<Props>
}
export default WikiEditPage
+6 -2
ファイルの表示
@@ -1,3 +1,5 @@
import type { FC } from 'react'
import { useEffect, useState } from 'react'
import { Helmet } from 'react-helmet-async'
import { useLocation } from 'react-router-dom'
@@ -12,7 +14,7 @@ import { dateString } from '@/lib/utils'
import type { WikiPageChange } from '@/types'
export default () => {
const WikiHistoryPage: FC = () => {
const [changes, setChanges] = useState<WikiPageChange[]> ([])
const location = useLocation ()
@@ -23,7 +25,7 @@ export default () => {
void (async () => {
setChanges (await apiGet<WikiPageChange[]> ('/wiki/changes', { params: id ? { id } : { } }))
}) ()
}, [location.search])
}, [id, location.search])
return (
<MainArea>
@@ -73,3 +75,5 @@ export default () => {
</table>
</MainArea>)
}
export default WikiHistoryPage
+9 -3
ファイルの表示
@@ -1,3 +1,5 @@
import type { FC } from 'react'
import MarkdownIt from 'markdown-it'
import { useState } from 'react'
import { Helmet } from 'react-helmet-async'
@@ -19,9 +21,8 @@ const mdParser = new MarkdownIt
type Props = { user: User | null }
export default ({ user }: Props) => {
if (!(['admin', 'member'].some (r => user?.role === r)))
return <Forbidden/>
const WikiNewPage: FC<Props> = ({ user }) => {
const editable = ['admin', 'member'].some (r => user?.role === r)
const location = useLocation ()
const navigate = useNavigate ()
@@ -50,6 +51,9 @@ export default ({ user }: Props) => {
}
}
if (!(editable))
return <Forbidden/>
return (
<MainArea>
<Helmet>
@@ -85,3 +89,5 @@ export default ({ user }: Props) => {
</div>
</MainArea>)
}
export default WikiNewPage
+7 -3
ファイルの表示
@@ -8,12 +8,12 @@ import { SITE_TITLE } from '@/config'
import { apiGet } from '@/lib/api'
import { dateString } from '@/lib/utils'
import type { FormEvent } from 'react'
import type { FormEvent , FC } from 'react'
import type { WikiPage } from '@/types'
export default () => {
const WikiSearchPage: FC = () => {
const [title, setTitle] = useState ('')
const [text, setText] = useState ('')
const [results, setResults] = useState<WikiPage[]> ([])
@@ -28,7 +28,9 @@ export default () => {
}
useEffect (() => {
search ()
void (async () => {
setResults (await apiGet ('/wiki', { params: { title: '' } }))
}) ()
}, [])
return (
@@ -93,3 +95,5 @@ export default () => {
</div>
</MainArea>)
}
export default WikiSearchPage