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 7c32959920..bf979e2c32 100644 --- a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx +++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx @@ -1,6 +1,5 @@ import type { VideoMetadata } from "@cap/database/types"; import { - Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, @@ -11,7 +10,9 @@ import { HttpClient } from "@effect/platform"; import { faCheck, faCopy, + faDownload, faEllipsis, + faLink, faLock, faTrash, faUnlock, @@ -25,20 +26,18 @@ import Link from "next/link"; import { useRouter } from "next/navigation"; import { type PropsWithChildren, useState } from "react"; import { toast } from "sonner"; -import { downloadVideo } from "@/actions/videos/download"; import { ConfirmationDialog } from "@/app/(org)/dashboard/_components/ConfirmationDialog"; import { useDashboardContext } from "@/app/(org)/dashboard/Contexts"; import ProgressCircle, { useUploadProgress, } from "@/app/s/[videoId]/_components/ProgressCircle"; -import { Tooltip } from "@/components/Tooltip"; import { VideoThumbnail } from "@/components/VideoThumbnail"; import { useEffectMutation } from "@/lib/EffectRuntime"; import { withRpc } from "@/lib/Rpcs"; import { PasswordDialog } from "../PasswordDialog"; import { SharingDialog } from "../SharingDialog"; import { CapCardAnalytics } from "./CapCardAnalytics"; -import { CapCardButtons } from "./CapCardButtons"; +import { CapCardButton } from "./CapCardButton"; import { CapCardContent } from "./CapCardContent"; export interface CapCardProps extends PropsWithChildren { @@ -305,51 +304,102 @@ export const CapCard = ({ {anyCapSelected && !sharedCapCard && (
)} - {!sharedCapCard && ( -
- - - - - - - + + + +
+ ) : ( + + ); + }} + /> + {isOwner && ( + + + ( + + )} + /> + { @@ -392,19 +442,21 @@ export const CapCard = ({ - } - title="Delete Cap" - description={`Are you sure you want to delete the cap "${cap.name}"? This action cannot be undone.`} - confirmLabel={deleteMutation.isPending ? "Deleting..." : "Delete"} - cancelLabel="Cancel" - loading={deleteMutation.isPending} - onConfirm={() => deleteMutation.mutate()} - onCancel={() => setConfirmOpen(false)} - /> -
- )} + )} + + } + title="Delete Cap" + description={`Are you sure you want to delete the cap "${cap.name}"? This action cannot be undone.`} + confirmLabel={deleteMutation.isPending ? "Deleting..." : "Delete"} + cancelLabel="Cancel" + loading={deleteMutation.isPending} + onConfirm={() => deleteMutation.mutate()} + onCancel={() => setConfirmOpen(false)} + /> + + {!sharedCapCard && onSelectToggle && (
void; + disabled?: boolean; + className: string; + icon: () => ReactNode; +} + +export const CapCardButton = ({ + tooltipContent, + onClick = () => {}, + disabled, + className, + icon, +}: CapCardButtonProps) => { + return ( + + + + ); +}; diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsx deleted file mode 100644 index 3232c92b92..0000000000 --- a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsx +++ /dev/null @@ -1,173 +0,0 @@ -import { buildEnv, NODE_ENV } from "@cap/env"; -import { Button } from "@cap/ui"; -import { faDownload, faLink } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import clsx from "clsx"; -import type { ReactNode } from "react"; -import { Tooltip } from "@/components/Tooltip"; -import { usePublicEnv } from "@/utils/public-env"; - -interface ButtonConfig { - tooltipContent: string; - onClick: (e: React.MouseEvent) => void; - className: string; - disabled: boolean; - icon: () => ReactNode; -} - -export interface CapCardButtonsProps { - capId: string; - copyPressed: boolean; - isDownloading: boolean; - handleCopy: (url: string) => void; - handleDownload: () => void; - customDomain?: string | null; - domainVerified?: boolean; -} - -export const CapCardButtons: React.FC = ({ - capId, - copyPressed, - isDownloading, - handleCopy, - handleDownload, - customDomain, - domainVerified, -}) => { - const { webUrl } = usePublicEnv(); - return ( - <> - {buttons( - capId, - copyPressed, - isDownloading, - handleCopy, - handleDownload, - webUrl, - customDomain, - domainVerified, - ).map((button, index) => ( - - - - ))} - - ); -}; - -const buttons = ( - capId: string, - copyPressed: boolean, - isDownloading: boolean, - handleCopy: (url: string) => void, - handleDownload: () => void, - webUrl: string, - customDomain?: string | null, - domainVerified?: boolean, -): ButtonConfig[] => [ - { - tooltipContent: "Copy link", - onClick: (e: React.MouseEvent) => { - e.stopPropagation(); - - const getVideoLink = () => { - if (NODE_ENV === "development" && customDomain && domainVerified) { - return `https://${customDomain}/s/${capId}`; - } else if ( - NODE_ENV === "development" && - !customDomain && - !domainVerified - ) { - return `${webUrl}/s/${capId}`; - } else if ( - buildEnv.NEXT_PUBLIC_IS_CAP && - customDomain && - domainVerified - ) { - return `https://${customDomain}/s/${capId}`; - } else if ( - buildEnv.NEXT_PUBLIC_IS_CAP && - !customDomain && - !domainVerified - ) { - return `https://cap.link/${capId}`; - } else { - return `${webUrl}/s/${capId}`; - } - }; - - handleCopy(getVideoLink()); - }, - className: "delay-0", - disabled: false, - icon: () => { - return !copyPressed ? ( - - ) : ( - - - - ); - }, - }, - { - tooltipContent: "Download Cap", - onClick: (e: React.MouseEvent) => { - e.stopPropagation(); - handleDownload(); - }, - className: "delay-25", - disabled: isDownloading, - icon: () => { - return isDownloading ? ( -
- - - - -
- ) : ( - - ); - }, - }, -]; diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx index 07ad8214e4..ae33089287 100644 --- a/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx +++ b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx @@ -14,21 +14,16 @@ import type { VideoData } from "../../../caps/Caps"; import { CapCard } from "../../../caps/components/CapCard/CapCard"; import { SelectedCapsBar } from "../../../caps/components/SelectedCapsBar"; import { UploadPlaceholderCard } from "../../../caps/components/UploadPlaceholderCard"; -import { - useUploadingContext, - useUploadingStatus, -} from "../../../caps/UploadingContext"; +import { useUploadingStatus } from "../../../caps/UploadingContext"; interface FolderVideosSectionProps { initialVideos: VideoData; dubApiKeyEnabled: boolean; - cardType?: "shared" | "default"; } export default function FolderVideosSection({ initialVideos, dubApiKeyEnabled, - cardType = "default", }: FolderVideosSectionProps) { const router = useRouter(); const { user } = useDashboardContext(); diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx index 9bbab65427..943c3484a0 100644 --- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx +++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx @@ -50,7 +50,6 @@ export const SharedCapCard: React.FC = ({ isLoadingAnalytics={isLoadingAnalytics} cap={cap} analytics={displayCount} - sharedCapCard userId={userId} >
diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/folder/[folderId]/page.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/folder/[folderId]/page.tsx index ab4b63ec61..41e602b598 100644 --- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/folder/[folderId]/page.tsx +++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/folder/[folderId]/page.tsx @@ -70,7 +70,6 @@ const FolderPage = async (props: { )} {/* Display Videos */} diff --git a/apps/web/app/api/settings/onboarding/route.ts b/apps/web/app/api/settings/onboarding/route.ts index 3f9255021d..5036599a3d 100644 --- a/apps/web/app/api/settings/onboarding/route.ts +++ b/apps/web/app/api/settings/onboarding/route.ts @@ -47,12 +47,8 @@ export async function POST(request: NextRequest) { ) .limit(1); - console.log("memberButNotOwner", memberButNotOwner); - const isMemberOfOrganization = memberButNotOwner.length > 0; - console.log("isMemberOfOrganization", isMemberOfOrganization); - const [organization] = await db() .select() .from(organizations)