diff --git a/apps/web/actions/videos/delete-comment.ts b/apps/web/actions/videos/delete-comment.ts index 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.tsx index 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.tsx index 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 ( <> { 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 ? ( - - ) : ( - - - - )} - + !copyPressed ? ( + + ) : ( + + + + ) } /> )} @@ -448,17 +446,7 @@ export const CapCard = ({ { 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.tsx index 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">) { diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity/Comment.tsx index 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.tsx index 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({