Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
web: fix new comment image (#1281)
Ameer Al Ashhaba2628a85f008
diff --git a/apps/web/actions/videos/new-comment.ts b/apps/web/actions/videos/new-comment.tsindex 742753e1f..1b153b4e2 100644--- a/apps/web/actions/videos/new-comment.ts+++ b/apps/web/actions/videos/new-comment.ts@@ -4,6 +4,7 @@ import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";import { nanoId } from "@cap/database/helpers";import { comments } from "@cap/database/schema";+import type { ImageUpload } from "@cap/web-domain";import { Comment, type Video } from "@cap/web-domain";import { revalidatePath } from "next/cache";import { createNotification } from "@/lib/Notification";@@ -12,6 +13,7 @@ export async function newComment(data: {content: string;videoId: Video.VideoId;type: "text" | "emoji";+ authorImage: ImageUpload.ImageUrl | null;parentCommentId: Comment.CommentId;timestamp: number;}) {@@ -67,7 +69,7 @@ export async function newComment(data: {const commentWithAuthor = {...newComment,authorName: user.name,- authorImageUrlOrKey: user.image ?? null,+ authorImage: data.authorImage,sending: false,};diff --git a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx b/apps/web/app/s/[videoId]/_components/ShareHeader.tsxindex 12939e03b..7666184f5 100644--- a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx+++ b/apps/web/app/s/[videoId]/_components/ShareHeader.tsx@@ -238,12 +238,14 @@ export const ShareHeader = ({</div><div className="flex gap-7 items-center"><div className="flex gap-2 items-center">- <SignedImageUrl- name={data.ownerName ?? "User"}- image={data.ownerImage}- className="size-8"- letterClass="text-base"- />+ {data.ownerName && (+ <SignedImageUrl+ name={data.ownerName}+ image={data.ownerImage}+ className="size-8"+ letterClass="text-base"+ />+ )}<div className="flex flex-col text-left"><p className="text-sm text-gray-12">{data.ownerName}</p><p className="text-xs text-gray-10">diff --git a/apps/web/app/s/[videoId]/_components/Toolbar.tsx b/apps/web/app/s/[videoId]/_components/Toolbar.tsxindex 4605d4d12..05b7080a7 100644--- a/apps/web/app/s/[videoId]/_components/Toolbar.tsx+++ b/apps/web/app/s/[videoId]/_components/Toolbar.tsx@@ -58,6 +58,7 @@ export const Toolbar = ({const newCommentData = await newComment({content: emoji,videoId: data.id,+ authorImage: user.imageUrl,parentCommentId: Comment.CommentId.make(""),type: "emoji",timestamp: currentTime,@@ -100,6 +101,7 @@ export const Toolbar = ({const newCommentData = await newComment({content: comment,videoId: data.id,+ authorImage: user.imageUrl,parentCommentId: Comment.CommentId.make(""),type: "text",timestamp: currentTime,diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsxindex 63ab4aaf9..57e98a4ba 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx@@ -1,4 +1,3 @@-import type { userSelectProps } from "@cap/database/auth/session";import { Button } from "@cap/ui";import { Comment, User, type Video } from "@cap/web-domain";import { faCommentSlash } from "@fortawesome/free-solid-svg-icons";@@ -109,6 +108,7 @@ export const Comments = Object.assign(const data = await newComment({content,videoId: props.videoId,+ authorImage: user.imageUrl,parentCommentId: Comment.CommentId.make(""),type: "text",timestamp: currentTime,@@ -134,7 +134,7 @@ export const Comments = Object.assign(id: Comment.CommentId.make(`temp-reply-${Date.now()}`),authorId: user.id,authorName: user.name,- authorImage: user.imageUrl ?? null,+ authorImage: user.imageUrl,content,createdAt: new Date(),videoId: props.videoId,@@ -156,6 +156,7 @@ export const Comments = Object.assign(parentCommentId: actualParentId,type: "text",timestamp: currentTime,+ authorImage: user.imageUrl,});handleCommentSuccess(data);