This commit is contained in:
2025-07-21 05:11:14 +09:00
parent 2570323e3a
commit 3f42eb6915
12 changed files with 210 additions and 143 deletions
+3 -2
View File
@@ -51,7 +51,7 @@ export default ({ user }: Props) => {
if (!(id))
return
void (async () => {
const fetchPost = async () => {
try
{
const res = await axios.get (`${ API_BASE_URL }/posts/${ id }`, { headers: {
@@ -63,7 +63,8 @@ export default ({ user }: Props) => {
if (axios.isAxiosError (err))
setStatus (err.status ?? 200)
}
}) ()
}
fetchPost ()
}, [id])
useEffect (() => {
+11 -11
View File
@@ -93,16 +93,16 @@ export default () => {
<Tab name="広場">
{posts.length
? (
<div className="flex flex-wrap gap-4 gap-y-8 p-4 justify-between">
{posts.map (post => (
<Link to={`/posts/${ post.id }`}
key={post.id}
className="w-40 h-40 overflow-hidden rounded-lg shadow-md hover:shadow-lg">
<img src={post.thumbnail || post.thumbnailBase || undefined}
alt={post.title || post.url}
title={post.title || post.url || undefined}
className="object-none w-full h-full" />
</Link>))}
<div className="flex flex-wrap gap-6 p-4">
{posts.map ((post, i) => (
<Link to={`/posts/${ post.id }`}
key={i}
className="w-40 h-40 overflow-hidden rounded-lg shadow-md hover:shadow-lg">
<img src={post.thumbnail || post.thumbnailBase || undefined}
alt={post.title || post.url}
title={post.title || post.url || undefined}
className="object-none w-full h-full" />
</Link>))}
</div>)
: !(loading) && '広場には何もありませんよ.'}
{loading && 'Loading...'}
@@ -112,7 +112,7 @@ export default () => {
<Tab name="Wiki" init={!(posts.length)}>
<WikiBody body={wikiPage.body} />
<div className="my-2">
<Link to={`/wiki/${ wikiPage.title }`}>Wiki </Link>
<Link to={`/wiki/${ encodeURIComponent (wikiPage.title) }`}>Wiki </Link>
</div>
</Tab>)}
</TabGroup>