diff --git a/src/ui/components/chat/message-card.tsx b/src/ui/components/chat/message-card.tsx index 22c89600..e60221ea 100644 --- a/src/ui/components/chat/message-card.tsx +++ b/src/ui/components/chat/message-card.tsx @@ -3,11 +3,11 @@ import type { UserInfo } from '@/dtos/team' import { client } from '@/ui/api/client' import { Button } from '@/ui/components/ui/button' import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, } from '@/ui/components/ui/dialog' import { Separator } from '@/ui/components/ui/separator' import { formatTimeAgo } from '@/ui/lib/time' diff --git a/src/ui/components/file-viewer-right-sidebar.tsx b/src/ui/components/file-viewer-right-sidebar.tsx index 157db8eb..bd9ec72f 100644 --- a/src/ui/components/file-viewer-right-sidebar.tsx +++ b/src/ui/components/file-viewer-right-sidebar.tsx @@ -29,6 +29,7 @@ interface FileViewerRightSidebarProps { shareId?: string currentTime?: number onTyping?: () => void + selectedCommentId?: string | null } export function FileViewerRightSidebar({ @@ -45,6 +46,7 @@ export function FileViewerRightSidebar({ shareId, currentTime, onTyping, + selectedCommentId, }: FileViewerRightSidebarProps) { const { fields, setFields } = useFieldStore() const queryClient = useQueryClient() @@ -52,7 +54,6 @@ export function FileViewerRightSidebar({ const [replyingTo, setReplyingTo] = useState(null) const [viewingAttachment, setViewingAttachment] = useState(null) const [isGuestPopupOpen, setIsGuestPopupOpen] = useState(false) - const [selectedCommentId, setSelectedCommentId] = useState(null) const [pendingComment, setPendingComment] = useState<{ text: string attachmentIds: string[] @@ -354,7 +355,6 @@ export function FileViewerRightSidebar({ frameRate={file?.media?.metadata?.frameRate || 30} isSelected={selectedCommentId === comment.id} onSelect={() => { - setSelectedCommentId(comment.id!) onCommentSelect?.(comment) }} /> @@ -372,7 +372,6 @@ export function FileViewerRightSidebar({ frameRate={file?.media?.metadata?.frameRate || 30} isSelected={selectedCommentId === reply.id} onSelect={() => { - setSelectedCommentId(reply.id!) onCommentSelect?.(reply) }} /> diff --git a/src/ui/components/public-share-manager.tsx b/src/ui/components/public-share-manager.tsx index 31060194..31d95d8d 100644 --- a/src/ui/components/public-share-manager.tsx +++ b/src/ui/components/public-share-manager.tsx @@ -90,6 +90,7 @@ export function PublicShareManager({ const videoRef = useRef(null) const [annotations, setAnnotations] = useState([]) const [currentTime, setCurrentTime] = useState(0) + const [selectedCommentId, setSelectedCommentId] = useState(null) const { data: foldersData, @@ -255,6 +256,7 @@ export function PublicShareManager({ } const handleCommentSelect = (comment: CommentInfo) => { + setSelectedCommentId(comment.id || null) const newAnnotations = comment.annotations as Annotation[] if (newAnnotations && newAnnotations.length > 0) { setAnnotations(newAnnotations) @@ -276,6 +278,7 @@ export function PublicShareManager({ const handlePlay = () => { setAnnotations([]) + setSelectedCommentId(null) } const { setProjectState, clearProjectState } = useTopNavStore() @@ -446,6 +449,7 @@ export function PublicShareManager({ videoRef.current.pause() } }} + selectedCommentId={selectedCommentId} /> diff --git a/src/ui/routes/projects/$projectId/files/$fileId.tsx b/src/ui/routes/projects/$projectId/files/$fileId.tsx index d1243b7c..ea8997a9 100644 --- a/src/ui/routes/projects/$projectId/files/$fileId.tsx +++ b/src/ui/routes/projects/$projectId/files/$fileId.tsx @@ -35,6 +35,7 @@ function FileViewPage() { const [rightSidebarWidth, setRightSidebarWidth] = useState(360) const [annotations, setAnnotations] = useState([]) const [currentTime, setCurrentTime] = useState(0) + const [selectedCommentId, setSelectedCommentId] = useState(null) const $patchMetadata = client.api.files[':fileId'].metadata.$patch const { mutate: patchMetadata } = useMutation< InferResponseType, @@ -195,6 +196,7 @@ function FileViewPage() { } const handleCommentSelect = (comment: CommentInfo) => { + setSelectedCommentId(comment.id || null) const newAnnotations = comment.annotations as Annotation[] if (newAnnotations && newAnnotations.length > 0) { setAnnotations(newAnnotations) @@ -216,6 +218,7 @@ function FileViewPage() { const handlePlay = () => { setAnnotations([]) + setSelectedCommentId(null) } return ( @@ -279,6 +282,7 @@ function FileViewPage() { videoRef.current.pause() } }} + selectedCommentId={selectedCommentId} />