import type { FC } from 'react' import { useEffect, useState } from 'react' import { Helmet } from 'react-helmet-async' import { useLocation } from 'react-router-dom' import PrefetchLink from '@/components/PrefetchLink' import PageTitle from '@/components/common/PageTitle' import MainArea from '@/components/layout/MainArea' import { SITE_TITLE } from '@/config' import { apiGet } from '@/lib/api' import { dateString } from '@/lib/utils' import type { WikiPageChange } from '@/types' const WikiHistoryPage: FC = () => { const [changes, setChanges] = useState ([]) const location = useLocation () const query = new URLSearchParams (location.search) const id = query.get ('id') useEffect (() => { void (async () => { setChanges (await apiGet ('/wiki/changes', { params: id ? { id } : { } })) }) () }, [id, location.search]) return ( {`Wiki 変更履歴 | ${ SITE_TITLE }`} Wiki 履歴 {changes.map (change => ( ))}
タイトル 変更 日時
{change.pred != null && ( 差分 )} {change.wikiPage.title} {change.wikiPage.deprecatedAt != null && (廃止)} {change.pred == null ? '新規' : '更新'} {change.user.name}
{dateString (change.timestamp)}
) } export default WikiHistoryPage