This commit is contained in:
2026-05-22 03:29:18 +09:00
parent dc54f9cbb5
commit 7b6b24b9c5
13 changed files with 255 additions and 25 deletions
+3 -2
View File
@@ -8,6 +8,7 @@ import { Button } from '@/components/ui/button'
import { toast } from '@/components/ui/use-toast'
import { isApiError } from '@/lib/api'
import { updatePost } from '@/lib/posts'
import { msToTime } from '@/lib/utils'
import type { FC, FormEvent } from 'react'
@@ -25,7 +26,7 @@ const tagsToStr = (tags: Tag[]): string => {
tags.filter (t => t.category !== 'nico').forEach (walk)
return [...(new Set (result.map (t => t.name)))].join (' ')
return [...(new Set (result.map (t => `${ t.name }${ t.sections.map (s => `[${ msToTime (s.beginMs) }-${ msToTime (s.endMs) }]`).join ('') }`)))].join (' ')
}
@@ -167,4 +168,4 @@ const PostEditForm: FC<Props> = ({ post, onSave }) => {
</form>)
}
export default PostEditForm
export default PostEditForm
+12
View File
@@ -71,3 +71,15 @@ export const originalCreatedAtString = (
.join (' '))
return rtn === '〜' ? '年月日不詳' : rtn
}
export const msToTime = (ms: number): string => {
const totalS = Math.trunc (ms / 1_000)
const s = String (totalS % 60)
const min = String (Math.trunc (totalS / 60) % 60)
const h = String (Math.trunc (totalS / 3_600))
return (h > 0
? `${ h }:${ min.padStart (2, '0') }:${ s.padStart (2, '0') }`
: `${ min }:${ s.padStart (2, '0') }`)
}
@@ -1,5 +1,6 @@
import { useQuery, useQueryClient } from '@tanstack/react-query'
import { useEffect, useMemo, useState } from 'react'
import { Helmet } from 'react-helmet-async'
import { useParams } from 'react-router-dom'
import TagLink from '@/components/TagLink'
@@ -69,6 +70,11 @@ const DeerjikistDetailPage: FC = () => {
return (
<MainArea>
<Helmet>
<meta name="robots" content="noindex"/>
{tag && <title>{tag.name} | </title>}
</Helmet>
{(loading || !(tag)) ? 'Loading...' : (
<div className="max-w-xl">
<PageTitle>
+5 -2
View File
@@ -126,7 +126,7 @@ export type Post = {
title: string | null
thumbnail: string | null
thumbnailBase: string | null
tags: Tag[]
tags: TagWithSections[]
parentPosts?: Post[]
childPosts?: Post[]
siblingPosts?: Record<`${ number }`, Post[]>
@@ -187,7 +187,6 @@ export type Tag = {
hasWiki: boolean
materialId: number | null
hasDeerjikists: boolean
children?: Tag[]
matchedAlias?: string | null }
export type TagVersion = {
@@ -201,6 +200,10 @@ export type TagVersion = {
createdAt: string
createdByUser: { id: number; name: string | null } | null }
export type TagWithSections = Tag & { sections: { beginMs: number
endMs: number }[]
children: TagWithSections[] }
export type Theatre = {
id: number
name: string | null