From 1a965146dcdb16a4c6c469fcd6951f062d5619ce Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sat, 19 Jul 2025 23:26:18 +0900 Subject: [PATCH] #23 --- frontend/src/App.tsx | 46 +++++++++---------- frontend/src/components/TagSidebar.tsx | 2 +- frontend/src/components/TopNav.tsx | 3 +- .../components/layout/SidebarComponent.tsx | 2 +- frontend/src/pages/posts/PostDetailPage.tsx | 13 ++++-- frontend/src/pages/posts/PostListPage.tsx | 13 ++++-- 6 files changed, 43 insertions(+), 36 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index ea1e1d7..36c0282 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,7 +1,7 @@ import axios from 'axios' import toCamel from 'camelcase-keys' import { useEffect, useState } from 'react' -import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom' +import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom' import TopNav from '@/components/TopNav' import { Toaster } from '@/components/ui/toaster' @@ -70,29 +70,27 @@ export default () => { return ( <> - -
- -
- - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - -
-
-
+
+ + + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + +
) } diff --git a/frontend/src/components/TagSidebar.tsx b/frontend/src/components/TagSidebar.tsx index 3d4c470..d533693 100644 --- a/frontend/src/components/TagSidebar.tsx +++ b/frontend/src/components/TagSidebar.tsx @@ -64,7 +64,7 @@ export default ({ posts }: Props) => { ))) : [])} 関聯 - {posts.length && ( + {posts.length > 0 && ( { ev.preventDefault () diff --git a/frontend/src/components/TopNav.tsx b/frontend/src/components/TopNav.tsx index 70af9c2..bcd3ab2 100644 --- a/frontend/src/components/TopNav.tsx +++ b/frontend/src/components/TopNav.tsx @@ -166,8 +166,7 @@ export default ({ user }: Props) => { return (
一覧 - {['admin', 'member'].some (r => user?.role === r) && ( - 投稿追加)} + 投稿追加 ヘルプ
) case Menu.Tag: diff --git a/frontend/src/components/layout/SidebarComponent.tsx b/frontend/src/components/layout/SidebarComponent.tsx index f975612..cfe2c08 100644 --- a/frontend/src/components/layout/SidebarComponent.tsx +++ b/frontend/src/components/layout/SidebarComponent.tsx @@ -4,6 +4,6 @@ type Props = { children: React.ReactNode } export default ({ children }: Props) => ( -
+
{children}
) diff --git a/frontend/src/pages/posts/PostDetailPage.tsx b/frontend/src/pages/posts/PostDetailPage.tsx index 501a77a..e3efca5 100644 --- a/frontend/src/pages/posts/PostDetailPage.tsx +++ b/frontend/src/pages/posts/PostDetailPage.tsx @@ -24,8 +24,8 @@ type Props = { user: User | null } export default ({ user }: Props) => { const { id } = useParams () - const [post, setPost] = useState (null) const [editing, setEditing] = useState (true) + const [post, setPost] = useState (null) const [status, setStatus] = useState (200) const changeViewedFlg = async () => { @@ -92,13 +92,15 @@ export default ({ user }: Props) => { : 'bg-gray-500 hover:bg-gray-600') return ( - <> +
{(post?.thumbnail || post?.thumbnailBase) && ( )} {post && {`${ post.title || post.url } | ${ SITE_TITLE }`}} - +
+ +
{post ? ( @@ -126,5 +128,8 @@ export default ({ user }: Props) => { ) : 'Loading...'} - ) +
+ +
+
) } diff --git a/frontend/src/pages/posts/PostListPage.tsx b/frontend/src/pages/posts/PostListPage.tsx index 84d16e9..79a826f 100644 --- a/frontend/src/pages/posts/PostListPage.tsx +++ b/frontend/src/pages/posts/PostListPage.tsx @@ -77,7 +77,7 @@ export default () => { }, [location.search]) return ( - <> +
{tags.length @@ -85,13 +85,15 @@ export default () => { : `${ SITE_TITLE } 〜 ぼざろクリーチャーシリーズ綜合リンク集サイト`} - +
+ +
{posts.length ? ( -
+
{posts.map (post => ( { )} - ) +
+ +
+
) }