diff --git a/frontend/src/components/TagDetailSidebar.tsx b/frontend/src/components/TagDetailSidebar.tsx
index 5d02358..a897fa8 100644
--- a/frontend/src/components/TagDetailSidebar.tsx
+++ b/frontend/src/components/TagDetailSidebar.tsx
@@ -1,5 +1,6 @@
import { AnimatePresence, motion } from 'framer-motion'
import { useEffect, useState } from 'react'
+import { Link } from 'react-router-dom'
import TagLink from '@/components/TagLink'
import TagSearch from '@/components/TagSearch'
@@ -128,6 +129,9 @@ export default (({ post }: Props) => {
&& `${ (new Date (post.originalCreatedBefore)).toLocaleString () } より前`}
>)}
+
+ 履歴
+
)}
diff --git a/frontend/src/pages/posts/PostHistoryPage.tsx b/frontend/src/pages/posts/PostHistoryPage.tsx
index e401b09..e194dbc 100644
--- a/frontend/src/pages/posts/PostHistoryPage.tsx
+++ b/frontend/src/pages/posts/PostHistoryPage.tsx
@@ -25,19 +25,20 @@ export default (() => {
const page = Number (query.get ('page') ?? 1)
const limit = Number (query.get ('limit') ?? 20)
+ // 投稿列の結合で使用
+ let rowsCnt: number
+
useEffect (() => {
void (async () => {
const res = await axios.get (`${ API_BASE_URL }/posts/changes`,
- { params: { ...(id && { id }),
- ...(page && { page }),
- ...(limit && { limit }) } })
+ { params: { ...(id && { id }), page, limit } })
const data = toCamel (res.data as any, { deep: true }) as {
changes: PostTagChange[]
count: number }
setChanges (data.changes)
- setTotalPages (Math.trunc ((data.count - 1) / limit))
+ setTotalPages (Math.ceil (data.count / limit))
}) ()
- }, [location.search])
+ }, [id, page, limit])
return (
@@ -47,7 +48,7 @@ export default (() => {
耕作履歴
- {Boolean (id) && <>: 投稿 {#{id}}>}
+ {id && <>: 投稿 {#{id}}>}
@@ -59,29 +60,42 @@ export default (() => {
- {changes.map (change => (
-
-
-
-
-
- |
-
-
- {`を${ change.changeType === 'add' ? '追加' : '削除' }`}
- |
-
- {change.user ? (
-
- {change.user.name}
- ) : 'bot 操作'}
-
- {change.timestamp}
- |
-
))}
+ {changes.map ((change, i) => {
+ let withPost = i === 0 || change.post.id !== changes[i - 1].post.id
+ if (withPost)
+ {
+ rowsCnt = 1
+ for (let j = i + 1;
+ (j < changes.length
+ && change.post.id === changes[j].post.id);
+ ++j)
+ ++rowsCnt
+ }
+ return (
+
+ {withPost && (
+
+
+
+
+ | )}
+
+
+ {`を${ change.changeType === 'add' ? '追加' : '削除' }`}
+ |
+
+ {change.user ? (
+
+ {change.user.name}
+ ) : 'bot 操作'}
+
+ {change.timestamp}
+ |
+
)
+ })}