Browse Source

#295

feature/295
みてるぞ 1 week ago
parent
commit
207781355a
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      frontend/src/pages/posts/PostDetailPage.tsx

+ 8
- 3
frontend/src/pages/posts/PostDetailPage.tsx View File

@@ -1,6 +1,6 @@
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { motion } from 'framer-motion' import { motion } from 'framer-motion'
import { useEffect, useState } from 'react'
import { useEffect, useRef, useState } from 'react'
import { Helmet } from 'react-helmet-async' import { Helmet } from 'react-helmet-async'
import { useParams } from 'react-router-dom' import { useParams } from 'react-router-dom'


@@ -21,7 +21,7 @@ import ServiceUnavailable from '@/pages/ServiceUnavailable'


import type { FC } from 'react' import type { FC } from 'react'


import type { User } from '@/types'
import type { NiconicoViewerHandle, User } from '@/types'


type Props = { user: User | null } type Props = { user: User | null }


@@ -38,6 +38,8 @@ export default (({ user }: Props) => {


const qc = useQueryClient () const qc = useQueryClient ()


const embedRef = useRef<NiconicoViewerHandle> (null)

const [status, setStatus] = useState (200) const [status, setStatus] = useState (200)


const changeViewedFlg = useMutation ({ const changeViewedFlg = useMutation ({
@@ -120,7 +122,10 @@ export default (({ user }: Props) => {
className="object-cover w-full h-full"/> className="object-cover w-full h-full"/>
</motion.div>)} </motion.div>)}


<PostEmbed post={post}/>
<PostEmbed
ref={embedRef}
post={post}
onLoadComplete={() => embedRef.current?.play ()}/>
<Button onClick={() => changeViewedFlg.mutate ()} <Button onClick={() => changeViewedFlg.mutate ()}
disabled={changeViewedFlg.isPending} disabled={changeViewedFlg.isPending}
className={cn ('text-white', viewedClass)}> className={cn ('text-white', viewedClass)}>


Loading…
Cancel
Save