Moved later/gitgram-ai/gitgram/ to apps/ritgram/ (fresh history; full history stays in caelum0x/gitgram). AITimeMachine stays separate in later/gitgram-ai per the Rithub master plan. Logs, pid files and env files are ignored; GPL-3.0 mobile/proximity noted in THIRD_PARTY_NOTICES. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
'use client'
|
|
import { useEffect, useState } from 'react'
|
|
import { useParams, useRouter } from 'next/navigation'
|
|
import { useAuthStore } from '@/store/authStore'
|
|
import { postService } from '@/services/postService'
|
|
import PostCard from '@/components/PostCard'
|
|
import MuteThreadButton from '@/components/MuteThreadButton'
|
|
|
|
export default function PostDetailPage() {
|
|
const params = useParams()
|
|
const router = useRouter()
|
|
const { isAuthenticated } = useAuthStore()
|
|
const [post, setPost] = useState<any>(null)
|
|
|
|
useEffect(() => {
|
|
if (!isAuthenticated) { router.push('/login'); return }
|
|
postService.getPost(params.id as string).then(setPost).catch(() => router.push('/feed'))
|
|
}, [isAuthenticated, params.id])
|
|
|
|
if (!isAuthenticated || !post) return null
|
|
|
|
return (
|
|
<div className="max-w-4xl mx-auto py-8 px-4">
|
|
<PostCard
|
|
post={post}
|
|
onLike={(id: string) => { postService.likePost(id).then(() => setPost({...post, isLiked: true, likesCount: post.likesCount + 1})) }}
|
|
/>
|
|
<div className="mt-3 flex justify-end">
|
|
<MuteThreadButton postId={params.id as string} />
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|