mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 03:14:11 +00:00
feat(comment): unselect comment card when starting video playback
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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<CommentInfo | null>(null)
|
||||
const [viewingAttachment, setViewingAttachment] = useState<AttachmentInfo | null>(null)
|
||||
const [isGuestPopupOpen, setIsGuestPopupOpen] = useState(false)
|
||||
const [selectedCommentId, setSelectedCommentId] = useState<string | null>(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)
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -90,6 +90,7 @@ export function PublicShareManager({
|
||||
const videoRef = useRef<Player | null>(null)
|
||||
const [annotations, setAnnotations] = useState<Annotation[]>([])
|
||||
const [currentTime, setCurrentTime] = useState(0)
|
||||
const [selectedCommentId, setSelectedCommentId] = useState<string | null>(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}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -35,6 +35,7 @@ function FileViewPage() {
|
||||
const [rightSidebarWidth, setRightSidebarWidth] = useState(360)
|
||||
const [annotations, setAnnotations] = useState<Annotation[]>([])
|
||||
const [currentTime, setCurrentTime] = useState(0)
|
||||
const [selectedCommentId, setSelectedCommentId] = useState<string | null>(null)
|
||||
const $patchMetadata = client.api.files[':fileId'].metadata.$patch
|
||||
const { mutate: patchMetadata } = useMutation<
|
||||
InferResponseType<typeof $patchMetadata>,
|
||||
@@ -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}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user