Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(web): allow null comment timestamps for screenshots

Richie McIlroyda04db0c1036
diff --git a/apps/web/actions/videos/new-comment.ts b/apps/web/actions/videos/new-comment.ts
index 1b153b4e2..6b7814a46 100644
--- a/apps/web/actions/videos/new-comment.ts
+++ b/apps/web/actions/videos/new-comment.ts
@@ -15,7 +15,7 @@ export async function newComment(data: {
type: "text" | "emoji";
authorImage: ImageUpload.ImageUrl | null;
parentCommentId: Comment.CommentId;
- timestamp: number;
+ timestamp: number | null;
}) {
const user = await getCurrentUser();
diff --git a/apps/web/app/s/[videoId]/_components/Toolbar.tsx b/apps/web/app/s/[videoId]/_components/Toolbar.tsx
index d511a844a..9bd0c5aa3 100644
--- a/apps/web/app/s/[videoId]/_components/Toolbar.tsx
+++ b/apps/web/app/s/[videoId]/_components/Toolbar.tsx
@@ -57,7 +57,9 @@ export const Toolbar = ({
const handleEmojiClick = async (emoji: string) => {
if (!canReact || !user) return;
const videoElement = document.querySelector("video") as HTMLVideoElement;
- const currentTime = videoElement?.currentTime || 0;
+ const currentTime = data.isScreenshot
+ ? null
+ : videoElement?.currentTime || 0;
const optimisticComment: CommentType = {
id: Comment.CommentId.make(`temp-${Date.now()}`),
authorId: user.id,
@@ -100,7 +102,9 @@ export const Toolbar = ({
return;
}
const videoElement = document.querySelector("video") as HTMLVideoElement;
- const currentTime = videoElement?.currentTime || 0;
+ const currentTime = data.isScreenshot
+ ? null
+ : videoElement?.currentTime || 0;
const optimisticComment: CommentType = {
id: Comment.CommentId.make(`temp-${Date.now()}`),
authorId: user.id,