Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
web: fix delete comment, spaces custom domain link (#1159)
Ameer Al Ashhab4b9eb28780ce
diff --git a/apps/web/actions/videos/delete-comment.ts b/apps/web/actions/videos/delete-comment.tsindex 8451ecc17..a5ffc7221 100644--- a/apps/web/actions/videos/delete-comment.ts+++ b/apps/web/actions/videos/delete-comment.ts@@ -13,7 +13,7 @@ export async function deleteComment({videoId,}: {commentId: Comment.CommentId;- parentId?: Comment.CommentId;+ parentId: Comment.CommentId | null;videoId: Video.VideoId;}) {const user = await getCurrentUser();diff --git a/apps/web/app/(org)/dashboard/caps/Caps.tsx b/apps/web/app/(org)/dashboard/caps/Caps.tsxindex 7c98c8b43..fd6240e07 100644--- a/apps/web/app/(org)/dashboard/caps/Caps.tsx+++ b/apps/web/app/(org)/dashboard/caps/Caps.tsx@@ -52,15 +52,11 @@ export type VideoData = {export const Caps = ({data,count,- customDomain,- domainVerified,dubApiKeyEnabled,folders,}: {data: VideoData;count: number;- customDomain: string | null;- domainVerified: boolean;folders: FolderDataType[];dubApiKeyEnabled: boolean;}) => {@@ -322,9 +318,7 @@ export const Caps = ({}}}userId={user?.id}- customDomain={customDomain}isLoadingAnalytics={isLoadingAnalytics}- domainVerified={domainVerified}isSelected={selectedCaps.includes(video.id)}anyCapSelected={anyCapSelected}onSelectToggle={() => handleCapSelection(video.id)}diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsxindex c5ac6d40f..64d949bdd 100644--- a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx+++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx@@ -92,8 +92,6 @@ export interface CapCardProps extends PropsWithChildren {sharedCapCard?: boolean;isSelected?: boolean;onSelectToggle?: () => void;- customDomain?: string | null;- domainVerified?: boolean;hideSharedStatus?: boolean;anyCapSelected?: boolean;isDeleting?: boolean;@@ -110,13 +108,15 @@ export const CapCard = ({isLoadingAnalytics,sharedCapCard = false,hideSharedStatus = false,- customDomain,- domainVerified,isSelected = false,onSelectToggle,anyCapSelected = false,isDeleting = false,}: CapCardProps) => {+ const { activeOrganization } = useDashboardContext();+ const customDomain = activeOrganization?.organization.customDomain;+ const domainVerified = activeOrganization?.organization.domainVerified;+const [isSharingDialogOpen, setIsSharingDialogOpen] = useState(false);const [isPasswordDialogOpen, setIsPasswordDialogOpen] = useState(false);const [isDropdownOpen, setIsDropdownOpen] = useState(false);@@ -294,6 +294,18 @@ export const CapCard = ({}};+ const copyLinkHandler = () => {+ handleCopy(+ NODE_ENV === "development"+ ? `${webUrl}/s/${cap.id}`+ : buildEnv.NEXT_PUBLIC_IS_CAP && customDomain && domainVerified+ ? `https://${customDomain}/s/${cap.id}`+ : buildEnv.NEXT_PUBLIC_IS_CAP && !customDomain && !domainVerified+ ? `https://cap.link/${cap.id}`+ : `${webUrl}/s/${cap.id}`,+ );+ };+return (<><SharingDialog@@ -376,45 +388,31 @@ export const CapCard = ({tooltipContent="Copy link"onClick={(e) => {e.stopPropagation();- handleCopy(- NODE_ENV === "development"- ? `${webUrl}/s/${cap.id}`- : buildEnv.NEXT_PUBLIC_IS_CAP &&- customDomain &&- domainVerified- ? `https://${customDomain}/s/${cap.id}`- : buildEnv.NEXT_PUBLIC_IS_CAP &&- !customDomain &&- !domainVerified- ? `https://cap.link/${cap.id}`- : `${webUrl}/s/${cap.id}`,- );+ copyLinkHandler();}}className="delay-0"icon={- <>- {!copyPressed ? (- <FontAwesomeIcon- className="text-gray-12 size-4"- icon={faLink}- />- ) : (- <svg- xmlns="http://www.w3.org/2000/svg"- width="24"- height="24"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"- className="text-gray-12 size-5 svgpathanimation"- >- <path d="M20 6 9 17l-5-5" />- </svg>- )}- </>+ !copyPressed ? (+ <FontAwesomeIcon+ className="text-gray-12 size-4"+ icon={faLink}+ />+ ) : (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="24"+ height="24"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ className="text-gray-12 size-5 svgpathanimation"+ >+ <path d="M20 6 9 17l-5-5" />+ </svg>+ )}/>)}@@ -448,17 +446,7 @@ export const CapCard = ({<DropdownMenuItemonClick={(e) => {e.stopPropagation();- handleCopy(- buildEnv.NEXT_PUBLIC_IS_CAP &&- NODE_ENV === "production" &&- customDomain &&- domainVerified- ? `https://${customDomain}/s/${cap.id}`- : buildEnv.NEXT_PUBLIC_IS_CAP &&- NODE_ENV === "production"- ? `https://cap.link/${cap.id}`- : `${location.origin}/s/${cap.id}`,- );+ copyLinkHandler();toast.success("Link copied to clipboard");}}className="flex gap-2 items-center rounded-lg"diff --git a/apps/web/app/(org)/dashboard/caps/page.tsx b/apps/web/app/(org)/dashboard/caps/page.tsxindex 754d9665d..ad73d21aa 100644--- a/apps/web/app/(org)/dashboard/caps/page.tsx+++ b/apps/web/app/(org)/dashboard/caps/page.tsx@@ -267,8 +267,6 @@ export default async function CapsPage(props: PageProps<"/dashboard/caps">) {<Capsdata={processedVideoData}folders={foldersData}- customDomain={customDomain}- domainVerified={domainVerified}count={totalCount}dubApiKeyEnabled={!!serverEnv().DUB_API_KEY}/>diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsxindex f277028e0..e7210cf3c 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsx@@ -22,7 +22,7 @@ const CommentComponent: React.FC<{onCancelReply: () => void;onDelete: (commentId: Comment.CommentId,- parentId?: Comment.CommentId,+ parentId: Comment.CommentId | null,) => void;user: typeof userSelectProps | null;level?: number;@@ -55,10 +55,7 @@ const CommentComponent: React.FC<{: [];const handleDelete = () => {- if (- comment.parentCommentId &&- window.confirm("Are you sure you want to delete this comment?")- ) {+ if (window.confirm("Are you sure you want to delete this comment?")) {onDelete(comment.id, comment.parentCommentId);}};diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsxindex e724d1f03..62f03fa63 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comments.tsx@@ -174,7 +174,7 @@ export const Comments = Object.assign(const handleDeleteComment = async (commentId: Comment.CommentId,- parentId?: Comment.CommentId,+ parentId: Comment.CommentId | null,) => {try {await deleteComment({