This commit is contained in:
2026-04-07 00:45:40 +09:00
parent c0d52077b9
commit ff4b0eecf5
12 changed files with 55 additions and 63 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ export default (() => {
<>
<RouteBlockerOverlay/>
<BrowserRouter>
<div className="flex flex-col h-screen w-screen">
<div className="flex flex-col h-dvh w-screen">
<TopNav user={user}/>
<RouteTransitionWrapper user={user} setUser={setUser}/>
</div>
+19 -41
View File
@@ -1,8 +1,5 @@
import { useEffect, useState } from 'react'
import PrefetchLink from '@/components/PrefetchLink'
import { LIGHT_COLOUR_SHADE, DARK_COLOUR_SHADE, TAG_COLOUR } from '@/consts'
import { apiGet } from '@/lib/api'
import { cn } from '@/lib/utils'
import type { ComponentProps, FC, HTMLAttributes } from 'react'
@@ -36,35 +33,6 @@ export default (({ tag,
withWiki = true,
withCount = true,
...props }: Props) => {
const [havingWiki, setHavingWiki] = useState (true)
const wikiExists = async (tag: Tag) => {
if ('hasWiki' in tag)
{
setHavingWiki (tag.hasWiki)
return
}
const tagName = (tag as Tag).name
try
{
await apiGet (`/wiki/title/${ encodeURIComponent (tagName) }/exists`)
setHavingWiki (true)
}
catch
{
setHavingWiki (false)
}
}
useEffect (() => {
if (!(linkFlg) || !(withWiki))
return
wikiExists (tag)
}, [tag.name, linkFlg, withWiki])
const spanClass = cn (
`text-${ TAG_COLOUR[tag.category] }-${ LIGHT_COLOUR_SHADE }`,
`dark:text-${ TAG_COLOUR[tag.category] }-${ DARK_COLOUR_SHADE }`)
@@ -77,17 +45,27 @@ export default (({ tag,
<>
{(linkFlg && withWiki) && (
<span className="mr-1">
{havingWiki
{(tag.materialId != null || tag.hasWiki)
? (
<PrefetchLink to={`/wiki/${ encodeURIComponent (tag.name) }`}
className={linkClass}>
?
</PrefetchLink>)
tag.materialId == null
? (
<PrefetchLink
to={`/wiki/${ encodeURIComponent (tag.name) }`}
className={linkClass}>
?
</PrefetchLink>)
: (
<PrefetchLink
to={`/materials/${ tag.materialId }`}
className={linkClass}>
?
</PrefetchLink>))
: (
<PrefetchLink to={`/wiki/${ encodeURIComponent (tag.name) }`}
className="animate-[wiki-blink_.25s_steps(2,end)_infinite]
dark:animate-[wiki-blink-dark_.25s_steps(2,end)_infinite]"
title={`${ tag.name } Wiki が存在しません.`}>
<PrefetchLink
to={`/wiki/${ encodeURIComponent (tag.name) }`}
className="animate-[wiki-blink_.25s_steps(2,end)_infinite]
dark:animate-[wiki-blink-dark_.25s_steps(2,end)_infinite]"
title={`${ tag.name } Wiki が存在しません.`}>
!
</PrefetchLink>)}
</span>)}
@@ -6,7 +6,7 @@ import type { FC } from 'react'
export default (() => (
<div className="md:flex md:flex-1">
<div className="md:flex md:flex-1 md:h-[calc(100dvh-88px)]">
<MaterialSidebar/>
<Outlet/>
</div>)) satisfies FC
@@ -3,6 +3,7 @@ import { Helmet } from 'react-helmet-async'
import { useParams } from 'react-router-dom'
import TagLink from '@/components/TagLink'
import WikiBody from '@/components/WikiBody'
import Label from '@/components/common/Label'
import PageTitle from '@/components/common/PageTitle'
import TabGroup, { Tab } from '@/components/common/TabGroup'
@@ -109,6 +110,12 @@ export default (() => {
<audio src={material.file} controls/>)))}
<TabGroup>
<Tab name="Wiki">
<WikiBody
title={material.tag.name}
body={material.wikiPageBody ?? undefined}/>
</Tab>
<Tab name="編輯">
<div className="max-w-wl pt-2 space-y-4">
{/* タグ */}
+1 -1
View File
@@ -93,7 +93,7 @@ export default (({ user }: Props) => {
: 'bg-gray-500 hover:bg-gray-600')
return (
<div className="md:flex md:flex-1">
<div className="md:flex md:flex-1 md:h-[calc(100dvh-88px)]">
<Helmet>
{(post?.thumbnail || post?.thumbnailBase) && (
<meta name="thumbnail" content={post.thumbnail || post.thumbnailBase}/>)}
+1 -1
View File
@@ -69,7 +69,7 @@ export default (() => {
}, [location.search])
return (
<div className="md:flex md:flex-1" ref={containerRef}>
<div className="md:flex md:flex-1 md:h-[calc(100dvh-88px)]" ref={containerRef}>
<Helmet>
<title>
{tags.length
+2
View File
@@ -54,6 +54,7 @@ export type Material = {
tag: Tag
file: string | null
url: string | null
wikiPageBody?: string | null
contentType: string | null
createdAt: string
createdByUser: { id: number; name: string }
@@ -140,6 +141,7 @@ export type Tag = {
createdAt: string
updatedAt: string
hasWiki: boolean
materialId: number
children?: Tag[]
matchedAlias?: string | null }