タグ一覧ページの作成(#61) (#298)

#61

#61

Merge remote-tracking branch 'origin/main' into feature/061

#61

#61

#61

#61

#61

#61

#61

#61

#61

#61

日づけ不詳の表示修正

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #298
This commit was merged in pull request #298.
This commit is contained in:
2026-03-21 19:58:02 +09:00
parent 8cf7107445
commit ee93ff8ea0
26 changed files with 1135 additions and 283 deletions
+16 -3
View File
@@ -11,7 +11,8 @@ import Pagination from '@/components/common/Pagination'
import MainArea from '@/components/layout/MainArea'
import { SITE_TITLE } from '@/config'
import { fetchPostChanges } from '@/lib/posts'
import { postsKeys } from '@/lib/queryKeys'
import { postsKeys, tagsKeys } from '@/lib/queryKeys'
import { fetchTag } from '@/lib/tags'
import { cn, dateString } from '@/lib/utils'
import type { FC } from 'react'
@@ -21,15 +22,26 @@ export default (() => {
const location = useLocation ()
const query = new URLSearchParams (location.search)
const id = query.get ('id')
const tagId = query.get ('tag')
const page = Number (query.get ('page') ?? 1)
const limit = Number (query.get ('limit') ?? 20)
// 投稿列の結合で使用
let rowsCnt: number
const { data: tag } =
tagId
? useQuery ({ queryKey: tagsKeys.show (tagId),
queryFn: () => fetchTag (tagId) })
: { data: null }
const { data, isLoading: loading } = useQuery ({
queryKey: postsKeys.changes ({ ...(id && { id }), page, limit }),
queryFn: () => fetchPostChanges ({ ...(id && { id }), page, limit }) })
queryKey: postsKeys.changes ({ ...(id && { id }),
...(tagId && { tag: tagId }),
page, limit }),
queryFn: () => fetchPostChanges ({ ...(id && { id }),
...(tagId && { tag: tagId }),
page, limit }) })
const changes = data?.changes ?? []
const totalPages = data ? Math.ceil (data.count / limit) : 0
@@ -48,6 +60,7 @@ export default (() => {
<PageTitle>
{id && <>: 稿 {<PrefetchLink to={`/posts/${ id }`}>#{id}</PrefetchLink>}</>}
{tag && <><TagLink tag={tag} withWiki={false} withCount={false}/></>}
</PageTitle>
{loading ? 'Loading...' : (