@@ -7,14 +7,16 @@ import { formatDistanceToNow } from 'date-fns';
77import { PrimaryButton } from '@servicestack/react' ;
88import { useAuthorization } from '@/lib/hooks/useAuthorization' ;
99import { useAppStore } from '@/lib/stores/useAppStore' ;
10+ import { appAuth } from '@/lib/auth' ;
1011import routes from '@/lib/utils/routes' ;
1112import * as gateway from '@/lib/api/gateway' ;
1213import { TechnologyTags } from '@/components/TechnologyTags' ;
1314import { Avatar } from '@/components/ui/Avatar' ;
1415
1516export default function PostDetailClient ( ) {
1617 const { canEditPost, canDeleteComment } = useAuthorization ( ) ;
17- const { sessionInfo, isAuthenticated } = useAppStore ( ) ;
18+ const { isAuthenticated } = appAuth ( ) ;
19+ const { sessionInfo } = useAppStore ( ) ;
1820 const [ post , setPost ] = useState < any > ( null ) ;
1921 const [ comments , setComments ] = useState < any [ ] > ( [ ] ) ;
2022 const [ loading , setLoading ] = useState ( true ) ;
@@ -48,7 +50,7 @@ export default function PostDetailClient() {
4850 setComments ( response . comments || [ ] ) ;
4951
5052 // Load user's comment votes if authenticated
51- if ( isAuthenticated ( ) ) {
53+ if ( isAuthenticated ) {
5254 try {
5355 const votes = await gateway . getUserPostCommentVotes ( postId ) ;
5456 setUpVotedCommentIds ( votes . upVotedCommentIds || [ ] ) ;
@@ -71,7 +73,7 @@ export default function PostDetailClient() {
7173 const handleCommentVote = async ( commentId : number , weight : number , e : React . MouseEvent ) => {
7274 e . stopPropagation ( ) ;
7375
74- if ( ! isAuthenticated ( ) ) {
76+ if ( ! isAuthenticated ) {
7577 return ;
7678 }
7779
@@ -120,7 +122,7 @@ export default function PostDetailClient() {
120122 const handleSubmitComment = async ( e : React . FormEvent ) => {
121123 e . preventDefault ( ) ;
122124
123- if ( ! isAuthenticated ( ) || ! newComment . trim ( ) ) {
125+ if ( ! isAuthenticated || ! newComment . trim ( ) ) {
124126 return ;
125127 }
126128
@@ -227,7 +229,7 @@ export default function PostDetailClient() {
227229 : 'hover:text-green-600'
228230 } `}
229231 title = { isUpVoted ? 'Remove upvote' : 'Upvote' }
230- disabled = { ! isAuthenticated ( ) }
232+ disabled = { ! isAuthenticated }
231233 >
232234 ▲
233235 </ button >
@@ -240,7 +242,7 @@ export default function PostDetailClient() {
240242 : 'hover:text-red-600'
241243 } `}
242244 title = { isDownVoted ? 'Remove downvote' : 'Downvote' }
243- disabled = { ! isAuthenticated ( ) }
245+ disabled = { ! isAuthenticated }
244246 >
245247 ▼
246248 </ button >
@@ -296,7 +298,7 @@ export default function PostDetailClient() {
296298 dangerouslySetInnerHTML = { { __html : comment . contentHtml || comment . content } }
297299 />
298300 < div className = "flex gap-3 text-sm text-gray-600" >
299- { isAuthenticated ( ) && (
301+ { isAuthenticated && (
300302 < button
301303 onClick = { ( ) => setReplyToId ( comment . id ) }
302304 className = "hover:text-blue-600"
@@ -327,7 +329,7 @@ export default function PostDetailClient() {
327329 </ div >
328330
329331 { /* Reply Form */ }
330- { isReplyingTo && isAuthenticated ( ) && (
332+ { isReplyingTo && isAuthenticated && (
331333 < div className = "ml-12 mt-3" >
332334 < form onSubmit = { handleSubmitComment } >
333335 < div className = "mb-2" >
@@ -460,7 +462,7 @@ export default function PostDetailClient() {
460462 </ h2 >
461463
462464 { /* Add Top-Level Comment Form */ }
463- { isAuthenticated ( ) && ! replyToId && (
465+ { isAuthenticated && ! replyToId && (
464466 < form onSubmit = { handleSubmitComment } className = "mb-6" >
465467 < div className = "mb-2" >
466468 < textarea
0 commit comments