Merge remote-tracking branch 'origin/main' into feature/046 #46 #46 #46 #46 #46 #46 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #339
This commit was merged in pull request #339.
This commit is contained in:
@@ -21,7 +21,7 @@ import ServiceUnavailable from '@/pages/ServiceUnavailable'
|
||||
|
||||
import type { FC } from 'react'
|
||||
|
||||
import type { NiconicoViewerHandle, User } from '@/types'
|
||||
import type { NiconicoViewerHandle, Post, User } from '@/types'
|
||||
|
||||
type Props = { user: User | null }
|
||||
|
||||
@@ -108,6 +108,34 @@ export default (({ user }: Props) => {
|
||||
{post
|
||||
? (
|
||||
<>
|
||||
{(post.childPosts ?? []).length > 0 && (
|
||||
<div className="mb-4 bg-green-200 dark:bg-green-800 text-sm p-2 rounded-md">
|
||||
<p>この投稿には {post.childPosts!.length} 件の子投稿があります.</p>
|
||||
<PostList posts={[{ ...post, childPosts: [{ } as Post] },
|
||||
...post.childPosts!.map (p => ({
|
||||
...p, parentPosts: [{ } as Post] }))]}/>
|
||||
</div>
|
||||
)}
|
||||
{(post.parentPosts ?? []).map (pp => {
|
||||
const siblings = post.siblingPosts?.[String (pp.id) as `${ number }`]
|
||||
if (!(siblings))
|
||||
return
|
||||
|
||||
return (
|
||||
<div
|
||||
key={pp.id}
|
||||
className="mb-4 bg-yellow-200 dark:bg-yellow-800 text-sm p-2 rounded-md">
|
||||
<p>
|
||||
この投稿には 1 件の親投稿{
|
||||
siblings.length > 1
|
||||
&& `と ${ siblings.length - 1 } 件の姉妹投稿`}があります.
|
||||
</p>
|
||||
<PostList posts={[{ ...pp, childPosts: [{ } as Post] },
|
||||
...siblings.map (p => ({
|
||||
...p, parentPosts: [{ } as Post] }))]}/>
|
||||
</div>)
|
||||
})}
|
||||
|
||||
{(post.thumbnail || post.thumbnailBase) && (
|
||||
<motion.div
|
||||
layoutId={`page-${ id }`}
|
||||
@@ -146,7 +174,6 @@ export default (({ user }: Props) => {
|
||||
(prev: any) => newPost ?? prev)
|
||||
qc.invalidateQueries ({ queryKey: postsKeys.root })
|
||||
qc.invalidateQueries ({ queryKey: tagsKeys.root })
|
||||
toast ({ description: '更新しました.' })
|
||||
}}/>
|
||||
</Tab>)}
|
||||
</TabGroup>
|
||||
|
||||
Reference in New Issue
Block a user