Browse Source

feat: 投稿詳細のサイド・バーに投稿情報追加(#102) (#131)

Merge branch 'main' into #102

#102 サイドバーの投稿詳細

Merge branch '#102' of https://git.miteruzo.com/miteruzo/btrc-hub into #102

#102 サイドバーの投稿詳細,形だけ

#102 サイドバーの投稿詳細,形だけ

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: https://git.miteruzo.com/miteruzo/btrc-hub/pulls/131
pull/137/head
みてるぞ 2 weeks ago
parent
commit
a691df7b3f
1 changed files with 46 additions and 2 deletions
  1. +46
    -2
      frontend/src/components/TagDetailSidebar.tsx

+ 46
- 2
frontend/src/components/TagDetailSidebar.tsx View File

@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'


import TagLink from '@/components/TagLink' import TagLink from '@/components/TagLink'
import TagSearch from '@/components/TagSearch' import TagSearch from '@/components/TagSearch'
import SectionTitle from '@/components/common/SectionTitle'
import SubsectionTitle from '@/components/common/SubsectionTitle' import SubsectionTitle from '@/components/common/SubsectionTitle'
import SidebarComponent from '@/components/layout/SidebarComponent' import SidebarComponent from '@/components/layout/SidebarComponent'
import { CATEGORIES } from '@/consts' import { CATEGORIES } from '@/consts'
@@ -53,11 +54,54 @@ export default (({ post }: Props) => {
<div className="my-3" key={cat}> <div className="my-3" key={cat}>
<SubsectionTitle>{categoryNames[cat]}</SubsectionTitle> <SubsectionTitle>{categoryNames[cat]}</SubsectionTitle>
<ul> <ul>
{tags[cat].map ((tag, i) => (
<li key={i} className="mb-1">
{tags[cat].map (tag => (
<li key={tag.id} className="mb-1">
<TagLink tag={tag}/> <TagLink tag={tag}/>
</li>))} </li>))}
</ul> </ul>
</div>))} </div>))}
{post && (
<div>
<SectionTitle>情報</SectionTitle>
<ul>
<li>Id.: {post.id}</li>
{/* TODO: uploadedUser の取得を対応したらコメント外す */}
{/*
<li>
<>耕作者: </>
{post.uploadedUser
? (
<Link to={`/users/${ post.uploadedUser.id }`}>
{post.uploadedUser.name || '名もなきニジラー'}
</Link>)
: 'bot操作'}
</li>
*/}
<li>耕作日時: {(new Date (post.createdAt)).toLocaleString ()}</li>
<li>
<>リンク: </>
<a
className="break-all"
href={post.url}
target="_blank"
rel="noopener noreferrer nofollow">
{post.url}
</a>
</li>
<li>
{/* TODO: 表示形式きしょすぎるので何とかする */}
<>オリジナルの投稿日時: </>
{!(post.originalCreatedFrom) && !(post.originalCreatedBefore)
? '不明'
: (
<>
{post.originalCreatedFrom
&& `${ (new Date (post.originalCreatedFrom)).toLocaleString () } 以降 `}
{post.originalCreatedBefore
&& `${ (new Date (post.originalCreatedBefore)).toLocaleString () } より前`}
</>)}
</li>
</ul>
</div>)}
</SidebarComponent>) </SidebarComponent>)
}) satisfies FC<Props> }) satisfies FC<Props>

Loading…
Cancel
Save