fix(comment): restrict timestamp capture toggle and badges to video files

This commit is contained in:
yiling
2026-05-27 16:16:32 +08:00
parent 1a8712175e
commit 08b9c7ae0e
3 changed files with 33 additions and 19 deletions
+5 -5
View File
@@ -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'
+11 -9
View File
@@ -709,15 +709,17 @@ export const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(
multiple
onChange={handleFileSelect}
/>
<Button
onClick={() => setIsTimestampEnabled(!isTimestampEnabled)}
variant={isTimestampEnabled ? 'secondary' : 'ghost'}
size="icon"
className={`p-2 rounded-full cursor-pointer ${isTimestampEnabled ? 'text-blue-600 bg-blue-50 dark:bg-blue-900/20' : ''}`}
title={isTimestampEnabled ? 'Disable Timestamp' : 'Enable Timestamp'}
>
<Clock className="w-4 h-4" />
</Button>
{currentTime !== undefined && frameRate !== undefined && (
<Button
onClick={() => setIsTimestampEnabled(!isTimestampEnabled)}
variant={isTimestampEnabled ? 'secondary' : 'ghost'}
size="icon"
className={`p-2 rounded-full cursor-pointer ${isTimestampEnabled ? 'text-blue-600 bg-blue-50 dark:bg-blue-900/20' : ''}`}
title={isTimestampEnabled ? 'Disable Timestamp' : 'Enable Timestamp'}
>
<Clock className="w-4 h-4" />
</Button>
)}
<Button
onClick={() => fileInputRef.current?.click()}
className="p-2 rounded-full cursor-pointer"
@@ -331,7 +331,7 @@ export function FileViewerRightSidebar({
</div>
</div>
)}
<Tabs defaultValue="comments" className="p-4 flex-1 flex flex-col px-2 min-h-0">
<Tabs defaultValue="comments" className="p-1 flex-1 flex flex-col px-2 min-h-0">
<TabsList className="w-full shrink-0">
<TabsTrigger value="comments" className="flex-1">
Comments
@@ -352,7 +352,11 @@ export function FileViewerRightSidebar({
onReply={setReplyingTo}
onViewAttachment={setViewingAttachment}
hasReplies={!!comment.replies?.length}
frameRate={file?.media?.metadata?.frameRate || 30}
frameRate={
file?.mediaType?.startsWith('video/')
? file?.media?.metadata?.frameRate || 30
: undefined
}
isSelected={selectedCommentId === comment.id}
onSelect={() => {
onCommentSelect?.(comment)
@@ -369,7 +373,11 @@ export function FileViewerRightSidebar({
onViewAttachment={setViewingAttachment}
hasReplies={false}
isLastReply={index === (comment.replies?.length ?? 0) - 1}
frameRate={file?.media?.metadata?.frameRate || 30}
frameRate={
file?.mediaType?.startsWith('video/')
? file?.media?.metadata?.frameRate || 30
: undefined
}
isSelected={selectedCommentId === reply.id}
onSelect={() => {
onCommentSelect?.(reply)
@@ -398,8 +406,12 @@ export function FileViewerRightSidebar({
bots={enabledBots}
hideAnnotationControl={hideAnnotationControl}
disableMentions={isPublic}
currentTime={currentTime}
frameRate={file?.media?.metadata?.frameRate || 30}
currentTime={file?.mediaType?.startsWith('video/') ? currentTime : undefined}
frameRate={
file?.mediaType?.startsWith('video/')
? file?.media?.metadata?.frameRate || 30
: undefined
}
onTyping={onTyping}
/>
</GuestIdentityPopup>