Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: Cap folders (#728)

Ameer Al Ashhabb4d91940517b
diff --git a/apps/web/actions/folders/createFolder.ts b/apps/web/actions/folders/createFolder.ts
new file mode 100644
index 000000000..978c1f387
--- /dev/null
+++ b/apps/web/actions/folders/createFolder.ts
@@ -0,0 +1,59 @@
+"use server";
+
+import { db } from "@cap/database";
+import { folders } from "@cap/database/schema";
+import { eq, and } from "drizzle-orm";
+import { getCurrentUser } from "@cap/database/auth/session";
+import { nanoId } from "@cap/database/helpers";
+import { revalidatePath } from "next/cache";
+
+export async function createFolder({
+ name,
+ color,
+ parentId,
+}: {
+ name: string;
+ color: "normal" | "blue" | "red" | "yellow";
+ parentId?: string;
+}) {
+ const user = await getCurrentUser();
+ if (!user || !user.activeOrganizationId)
+ throw new Error("Unauthorized or no active organization");
+ if (!name) throw new Error("Folder name is required");
+
+ // If parentId is provided, verify it exists and belongs to the same organization
+ if (parentId) {
+ const [parentFolder] = await db()
+ .select()
+ .from(folders)
+ .where(
+ and(
+ eq(folders.id, parentId),
+ eq(folders.organizationId, user.activeOrganizationId)
+ )
+ );
+
+ if (!parentFolder) {
+ throw new Error("Parent folder not found or not accessible");
+ }
+ }
+
+ const id = nanoId();
+ const now = new Date();
+
+ const folder = {
+ id,
+ name,
+ color,
+ organizationId: user.activeOrganizationId,
+ createdById: user.id,
+ parentId: parentId || null,
+ createdAt: now,
+ updatedAt: now,
+ };
+
+ await db().insert(folders).values(folder);
+
+ revalidatePath("/dashboard/folder");
+ return folder;
+}
diff --git a/apps/web/actions/folders/deleteFolder.ts b/apps/web/actions/folders/deleteFolder.ts
new file mode 100644
index 000000000..0b9accfac
--- /dev/null
+++ b/apps/web/actions/folders/deleteFolder.ts
@@ -0,0 +1,34 @@
+"use server";
+
+import { db } from "@cap/database";
+import { folders, videos } from "@cap/database/schema";
+import { eq } from "drizzle-orm";
+import { revalidatePath } from "next/cache";
+import { getFolderById } from "./getFolderById";
+
+export async function deleteFolder(folderId: string) {
+ if (!folderId) throw new Error("Folder ID is required");
+
+ // Get the folder to find its parent
+ const folder = await getFolderById(folderId);
+ const parentId = folder.parentId ?? null;
+
+ // Recursively delete all child folders first
+ const childFolders = await db()
+ .select({ id: folders.id })
+ .from(folders)
+ .where(eq(folders.parentId, folderId));
+ for (const child of childFolders) {
+ await deleteFolder(child.id);
+ }
+
+ // Set folderId to parentId for all videos in this folder
+ await db()
+ .update(videos)
+ .set({ folderId: parentId })
+ .where(eq(videos.folderId, folderId));
+
+ // Delete the folder itself
+ await db().delete(folders).where(eq(folders.id, folderId));
+ revalidatePath(`/dashboard/caps`);
+}
diff --git a/apps/web/actions/folders/duplicateFolder.ts b/apps/web/actions/folders/duplicateFolder.ts
new file mode 100644
index 000000000..c698e1669
--- /dev/null
+++ b/apps/web/actions/folders/duplicateFolder.ts
@@ -0,0 +1,97 @@
+"use server";
+
+import { db } from "@cap/database";
+import { folders, videos, s3Buckets } from "@cap/database/schema";
+import { eq } from "drizzle-orm";
+import { nanoId } from "@cap/database/helpers";
+import { revalidatePath } from "next/cache";
+import { getFolderById } from "./getFolderById";
+
+export async function duplicateFolder(
+ folderId: string,
+ parentId?: string | null
+): Promise<string> {
+ if (!folderId) throw new Error("Folder ID is required");
+
+ // Get the folder to duplicate
+ const folder = await getFolderById(folderId);
+ if (!folder) throw new Error("Folder not found");
+
+ // Create the duplicated folder
+ const newFolderId = nanoId();
+ const now = new Date();
+ const newFolder = {
+ id: newFolderId,
+ name: folder.name,
+ color: folder.color,
+ organizationId: folder.organizationId,
+ createdById: folder.createdById,
+ createdAt: now,
+ updatedAt: now,
+ parentId: parentId ?? null,
+ };
+ await db().insert(folders).values(newFolder);
+
+ // Duplicate all videos in this folder
+ const videosInFolder = await db()
+ .select()
+ .from(videos)
+ .where(eq(videos.folderId, folderId));
+ for (const video of videosInFolder) {
+ const newVideoId = nanoId();
+ await db().insert(videos).values({
+ ...video,
+ id: newVideoId,
+ folderId: newFolderId,
+ createdAt: now,
+ updatedAt: now,
+ });
+
+ // --- S3 Asset Duplication ---
+ // Copy all S3 objects from old video to new video
+ try {
+ const { createBucketProvider } = await import("@/utils/s3");
+ let bucketProvider = null;
+ let prefix: string | null = null;
+ let newPrefix: string | null = null;
+ if (video.bucket) {
+ // Modern: use custom bucket
+ const [bucketRow] = await db().select().from(s3Buckets).where(eq(s3Buckets.id, video.bucket));
+ if (bucketRow) {
+ bucketProvider = await createBucketProvider(bucketRow);
+ prefix = `${video.ownerId}/${video.id}/`;
+ newPrefix = `${video.ownerId}/${newVideoId}/`;
+ }
+ } else if (video.awsBucket) {
+ // Legacy: use global/default bucket
+ bucketProvider = await createBucketProvider(); // No arg = default/global bucket
+ prefix = `${video.ownerId}/${video.id}/`;
+ newPrefix = `${video.ownerId}/${newVideoId}/`;
+ }
+ if (bucketProvider && prefix && newPrefix) {
+ const objects = await bucketProvider.listObjects({ prefix });
+ if (objects.Contents) {
+ for (const obj of objects.Contents) {
+ if (!obj.Key) continue;
+ const newKey = obj.Key.replace(prefix, newPrefix);
+ await bucketProvider.copyObject(`${bucketProvider.name}/${obj.Key}`, newKey);
+ }
+ }
+ }
+ } catch (err) {
+ console.error("Failed to copy S3 assets for duplicated video", err);
+ }
+ }
+
+ // Recursively duplicate all child folders
+ const childFolders = await db()
+ .select()
+ .from(folders)
+ .where(eq(folders.parentId, folderId));
+ for (const child of childFolders) {
+ await duplicateFolder(child.id, newFolderId);
+ }
+
+ revalidatePath(`/dashboard/caps`);
+ return newFolderId;
+}
diff --git a/apps/web/actions/folders/getChildFolders.ts b/apps/web/actions/folders/getChildFolders.ts
new file mode 100644
index 000000000..c82264346
--- /dev/null
+++ b/apps/web/actions/folders/getChildFolders.ts
@@ -0,0 +1,37 @@
+"use server";
+
+import { db } from "@cap/database";
+import { folders } from "@cap/database/schema";
+import { eq, and } from "drizzle-orm";
+import { getCurrentUser } from "@cap/database/auth/session";
+import { sql } from "drizzle-orm/sql";
+import { revalidatePath } from "next/cache";
+
+export async function getChildFolders(folderId: string) {
+ const user = await getCurrentUser();
+ if (!user || !user.activeOrganizationId)
+ throw new Error("Unauthorized or no active organization");
+
+ const childFolders = await db()
+ .select({
+ id: folders.id,
+ name: folders.name,
+ color: folders.color,
+ parentId: folders.parentId,
+ organizationId: folders.organizationId,
+ videoCount: sql<number>`(
+ SELECT COUNT(*) FROM videos WHERE videos.folderId = folders.id
+ )`,
+ })
+ .from(folders)
+ .where(
+ and(
+ eq(folders.parentId, folderId),
+ eq(folders.organizationId, user.activeOrganizationId)
+ )
+ );
+
+ revalidatePath(`/dashboard/folder/${folderId}`);
+
+ return childFolders;
+}
diff --git a/apps/web/actions/folders/getFolderBreadcrumb.ts b/apps/web/actions/folders/getFolderBreadcrumb.ts
new file mode 100644
index 000000000..9f15646ca
--- /dev/null
+++ b/apps/web/actions/folders/getFolderBreadcrumb.ts
@@ -0,0 +1,30 @@
+"use server";
+
+import { revalidatePath } from "next/cache";
+import { getFolderById } from "./getFolderById";
+
+export async function getFolderBreadcrumb(folderId: string) {
+ const breadcrumb: Array<{
+ id: string;
+ name: string;
+ color: "normal" | "blue" | "red" | "yellow";
+ }> = [];
+ let currentFolderId = folderId;
+
+ while (currentFolderId) {
+ const folder = await getFolderById(currentFolderId);
+ if (!folder) break;
+
+ breadcrumb.unshift({
+ id: folder.id,
+ name: folder.name,
+ color: folder.color,
+ });
+
+ if (!folder.parentId) break;
+ currentFolderId = folder.parentId;
+ }
+
+ revalidatePath(`/dashboard/folder/${folderId}`);
+ return breadcrumb;
+}
diff --git a/apps/web/actions/folders/getFolderById.ts b/apps/web/actions/folders/getFolderById.ts
new file mode 100644
index 000000000..e7827e31f
--- /dev/null
+++ b/apps/web/actions/folders/getFolderById.ts
@@ -0,0 +1,20 @@
+"use server";
+
+import { db } from "@cap/database";
+import { folders } from "@cap/database/schema";
+import { eq } from "drizzle-orm";
+import { revalidatePath } from "next/cache";
+
+export async function getFolderById(folderId: string | undefined) {
+ if (!folderId) throw new Error("Folder ID is required");
+
+ const [folder] = await db()
+ .select()
+ .from(folders)
+ .where(eq(folders.id, folderId));
+
+ if (!folder) throw new Error("Folder not found");
+
+ revalidatePath(`/dashboard/folder/${folderId}`);
+ return folder;
+}
diff --git a/apps/web/actions/folders/getVideosByFolderId.ts b/apps/web/actions/folders/getVideosByFolderId.ts
new file mode 100644
index 000000000..64cc73410
--- /dev/null
+++ b/apps/web/actions/folders/getVideosByFolderId.ts
@@ -0,0 +1,144 @@
+"use server";
+
+import { db } from "@cap/database";
+import {
+ videos,
+ comments,
+ users,
+ organizations,
+ sharedVideos,
+} from "@cap/database/schema";
+import { eq, desc } from "drizzle-orm";
+import { sql } from "drizzle-orm/sql";
+import { revalidatePath } from "next/cache";
+
+export async function getVideosByFolderId(folderId: string) {
+ if (!folderId) throw new Error("Folder ID is required");
+
+ const videoData = await db()
+ .select({
+ id: videos.id,
+ ownerId: videos.ownerId,
+ name: videos.name,
+ createdAt: videos.createdAt,
+ metadata: videos.metadata,
+ totalComments: sql<number>`COUNT(DISTINCT CASE WHEN ${comments.type} = 'text' THEN ${comments.id} END)`,
+ totalReactions: sql<number>`COUNT(DISTINCT CASE WHEN ${comments.type} = 'emoji' THEN ${comments.id} END)`,
+ sharedOrganizations: sql<{ id: string; name: string; iconUrl: string }[]>`
+ COALESCE(
+ JSON_ARRAYAGG(
+ JSON_OBJECT(
+ 'id', ${organizations.id},
+ 'name', ${organizations.name},
+ 'iconUrl', ${organizations.iconUrl}
+ )
+ ),
+ JSON_ARRAY()
+ )
+ `,
+ sharedSpaces: sql<
+ {
+ id: string;
+ name: string;
+ organizationId: string;
+ iconUrl: string;
+ isOrg: boolean;
+ }[]
+ >`
+ COALESCE(
+ (
+ SELECT JSON_ARRAYAGG(
+ JSON_OBJECT(
+ 'id', s.id,
+ 'name', s.name,
+ 'organizationId', s.organizationId,
+ 'iconUrl', s.iconUrl,
+ 'isOrg', s.isOrg
+ )
+ )
+ FROM (
+ -- Include spaces where the video is directly added via space_videos
+ SELECT DISTINCT
+ s.id,
+ s.name,
+ s.organizationId,
+ o.iconUrl as iconUrl,
+ FALSE as isOrg
+ FROM space_videos sv
+ JOIN spaces s ON sv.spaceId = s.id
+ JOIN organizations o ON s.organizationId = o.id
+ WHERE sv.videoId = ${videos.id}
+
+ UNION
+
+ -- For organization-level sharing, include the organization details
+ -- and mark it as an organization with isOrg=TRUE
+ SELECT DISTINCT
+ o.id as id,
+ o.name as name,
+ o.id as organizationId,
+ o.iconUrl as iconUrl,
+ TRUE as isOrg
+ FROM shared_videos sv
+ JOIN organizations o ON sv.organizationId = o.id
+ WHERE sv.videoId = ${videos.id}
+ ) AS s
+ ),
+ JSON_ARRAY()
+ )
+ `,
+ ownerName: users.name,
+ effectiveDate: sql<string>`
+ COALESCE(
+ JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')),
+ ${videos.createdAt}
+ )
+ `,
+ hasPassword: sql<number>`IF(${videos.password} IS NULL, 0, 1)`,
+ })
+ .from(videos)
+ .leftJoin(comments, eq(videos.id, comments.videoId))
+ .leftJoin(sharedVideos, eq(videos.id, sharedVideos.videoId))
+ .leftJoin(organizations, eq(sharedVideos.organizationId, organizations.id))
+ .leftJoin(users, eq(videos.ownerId, users.id))
+ .where(eq(videos.folderId, folderId))
+ .groupBy(
+ videos.id,
+ videos.ownerId,
+ videos.name,
+ videos.createdAt,
+ videos.metadata,
+ users.name
+ )
+ .orderBy(
+ desc(sql`COALESCE(
+ JSON_UNQUOTE(JSON_EXTRACT(${videos.metadata}, '$.customCreatedAt')),
+ ${videos.createdAt}
+ )`)
+ );
+
+ // Process the video data to match the expected format
+ const processedVideoData = videoData.map((video) => {
+ const { effectiveDate, ...videoWithoutEffectiveDate } = video;
+
+ return {
+ ...videoWithoutEffectiveDate,
+ sharedOrganizations: video.sharedOrganizations.filter(
+ (organization) => organization.id !== null
+ ),
+ sharedSpaces: video.sharedSpaces.filter((space) => space.id !== null),
+ ownerName: video.ownerName ?? "",
+ metadata: video.metadata as
+ | {
+ customCreatedAt?: string;
+ [key: string]: any;
+ }
+ | undefined,
+ hasPassword: video.hasPassword === 1,
+ };
+ });
+
+ revalidatePath(`/dashboard/folder/${folderId}`);
+
+ return processedVideoData;
+}
diff --git a/apps/web/actions/folders/moveVideoToFolder.ts b/apps/web/actions/folders/moveVideoToFolder.ts
new file mode 100644
index 000000000..d17ea8deb
--- /dev/null
+++ b/apps/web/actions/folders/moveVideoToFolder.ts
@@ -0,0 +1,91 @@
+"use server";
+
+import { db } from "@cap/database";
+import { folders, videos } from "@cap/database/schema";
+import { eq, and } from "drizzle-orm";
+import { getCurrentUser } from "@cap/database/auth/session";
+import { revalidatePath } from "next/cache";
+
+export async function moveVideoToFolder({
+ videoId,
+ folderId,
+}: {
+ videoId: string;
+ folderId: string | null;
+}) {
+ const user = await getCurrentUser();
+ if (!user || !user.activeOrganizationId)
+ throw new Error("Unauthorized or no active organization");
+
+ if (!videoId) throw new Error("Video ID is required");
+
+ // Get the current video to know its original folder
+ const [currentVideo] = await db()
+ .select({ folderId: videos.folderId })
+ .from(videos)
+ .where(eq(videos.id, videoId));
+
+ const originalFolderId = currentVideo?.folderId;
+
+ // If folderId is provided, verify it exists and belongs to the same organization
+ if (folderId) {
+ const [folder] = await db()
+ .select()
+ .from(folders)
+ .where(
+ and(
+ eq(folders.id, folderId),
+ eq(folders.organizationId, user.activeOrganizationId)
+ )
+ );
+
+ if (!folder) {
+ throw new Error("Folder not found or not accessible");
+ }
+ }
+
+ // Update the video's folderId
+ await db()
+ .update(videos)
+ .set({
+ folderId,
+ updatedAt: new Date(),
+ })
+ .where(eq(videos.id, videoId));
+
+ // Always revalidate the main caps page
+ revalidatePath(`/dashboard/caps`);
+
+ // Revalidate the target folder if it exists
+ if (folderId) {
+ revalidatePath(`/dashboard/folder/${folderId}`);
+ }
+
+ // Revalidate the original folder if it exists
+ if (originalFolderId) {
+ revalidatePath(`/dashboard/folder/${originalFolderId}`);
+ }
+
+ // If we're moving from one folder to another, revalidate the parent folders too
+ if (originalFolderId && folderId && originalFolderId !== folderId) {
+ // Get parent of original folder
+ const [originalFolder] = await db()
+ .select({ parentId: folders.parentId })
+ .from(folders)
+ .where(eq(folders.id, originalFolderId));
+
+ if (originalFolder?.parentId) {
+ revalidatePath(`/dashboard/folder/${originalFolder.parentId}`);
+ }
+
+ // Get parent of target folder
+ const [targetFolder] = await db()
+ .select({ parentId: folders.parentId })
+ .from(folders)
+ .where(eq(folders.id, folderId));
+
+ if (targetFolder?.parentId) {
+ revalidatePath(`/dashboard/folder/${targetFolder.parentId}`);
+ }
+ }
+}
diff --git a/apps/web/actions/folders/updateFolder.ts b/apps/web/actions/folders/updateFolder.ts
new file mode 100644
index 000000000..bfac22719
--- /dev/null
+++ b/apps/web/actions/folders/updateFolder.ts
@@ -0,0 +1,72 @@
+"use server";
+
+import { db } from "@cap/database";
+import { folders } from "@cap/database/schema";
+import { eq, and } from "drizzle-orm";
+import { getCurrentUser } from "@cap/database/auth/session";
+import { revalidatePath } from "next/cache";
+
+export async function updateFolder({
+ folderId,
+ name,
+ color,
+ parentId,
+}: {
+ folderId: string;
+ name?: string;
+ color?: "normal" | "blue" | "red" | "yellow";
+ parentId?: string | null;
+}) {
+ const user = await getCurrentUser();
+ if (!user || !user.activeOrganizationId)
+ throw new Error("Unauthorized or no active organization");
+
+ // If parentId is provided and not null, verify it exists and belongs to the same organization
+ if (parentId) {
+ // Check that we're not creating a circular reference
+ if (parentId === folderId) {
+ throw new Error("A folder cannot be its own parent");
+ }
+
+ const [parentFolder] = await db()
+ .select()
+ .from(folders)
+ .where(
+ and(
+ eq(folders.id, parentId),
+ eq(folders.organizationId, user.activeOrganizationId)
+ )
+ );
+
+ if (!parentFolder) {
+ throw new Error("Parent folder not found or not accessible");
+ }
+
+ // Check for circular references in the folder hierarchy
+ let currentParentId = parentFolder.parentId;
+ while (currentParentId) {
+ if (currentParentId === folderId) {
+ throw new Error("Cannot create circular folder references");
+ }
+
+ const [nextParent] = await db()
+ .select()
+ .from(folders)
+ .where(eq(folders.id, currentParentId));
+
+ if (!nextParent) break;
+ currentParentId = nextParent.parentId;
+ }
+ }
+
+ await db()
+ .update(folders)
+ .set({
+ ...(name !== undefined ? { name } : {}),
+ ...(color !== undefined ? { color } : {}),
+ ...(parentId !== undefined ? { parentId } : {}),
+ })
+ .where(eq(folders.id, folderId));
+ revalidatePath(`/dashboard/caps`);
+ revalidatePath(`/dashboard/folder/${folderId}`);
+}
diff --git a/apps/web/actions/video/upload.ts b/apps/web/actions/video/upload.ts
index 9d92c91fe..be04a1ee4 100644
--- a/apps/web/actions/video/upload.ts
+++ b/apps/web/actions/video/upload.ts
@@ -1,7 +1,7 @@
"use server";
import { getCurrentUser } from "@cap/database/auth/session";
-import { createBucketProvider, getS3Bucket, getS3Config } from "@/utils/s3";
+import { createBucketProvider } from "@/utils/s3";
import { db } from "@cap/database";
import { s3Buckets, videos } from "@cap/database/schema";
import { eq } from "drizzle-orm";
@@ -11,6 +11,7 @@ import {
CloudFrontClient,
CreateInvalidationCommand,
} from "@aws-sdk/client-cloudfront";
+import { revalidatePath } from "next/cache";
async function getVideoUploadPresignedUrl({
fileKey,
@@ -151,6 +152,7 @@ export async function createVideoAndGetUploadUrl({
audioCodec,
isScreenshot = false,
isUpload = false,
+ folderId,
}: {
videoId?: string;
duration?: number;
@@ -159,6 +161,7 @@ export async function createVideoAndGetUploadUrl({
audioCodec?: string;
isScreenshot?: boolean;
isUpload?: boolean;
+ folderId?: string;
}) {
const user = await getCurrentUser();
@@ -222,6 +225,7 @@ export async function createVideoAndGetUploadUrl({
source: { type: "desktopMP4" as const },
isScreenshot,
bucket: customBucket?.id,
+ ...(folderId ? { folderId } : {}),
};
await db().insert(videos).values(videoData);
@@ -237,6 +241,8 @@ export async function createVideoAndGetUploadUrl({
audioCodec,
});
+ revalidatePath("/dashboard/folder");
+
return {
id: idToUse,
presignedPostData,
diff --git a/apps/web/actions/videos/duplicate.ts b/apps/web/actions/videos/duplicate.ts
new file mode 100644
index 000000000..ba9670d36
--- /dev/null
+++ b/apps/web/actions/videos/duplicate.ts
@@ -0,0 +1,74 @@
+"use server";
+
+import { db } from "@cap/database";
+import { videos, s3Buckets } from "@cap/database/schema";
+import { eq } from "drizzle-orm";
+import { revalidatePath } from "next/cache";
+
+import { nanoId } from "@cap/database/helpers";
+
+export async function duplicateVideo(videoId: string): Promise<string> {
+ if (!videoId) throw new Error("Video ID is required");
+
+ // Get the video
+ const [video] = await db()
+ .select()
+ .from(videos)
+ .where(eq(videos.id, videoId));
+ if (!video) throw new Error("Video not found");
+
+ const newVideoId = nanoId();
+ const now = new Date();
+
+ // Insert the duplicated video
+ await db()
+ .insert(videos)
+ .values({
+ ...video,
+ id: newVideoId,
+ createdAt: now,
+ updatedAt: now,
+ });
+
+ // Copy S3 assets
+ try {
+ const { createBucketProvider } = await import("@/utils/s3");
+ let bucketProvider = null;
+ let prefix: string | null = null;
+ let newPrefix: string | null = null;
+ if (video.bucket) {
+ const [bucketRow] = await db()
+ .select()
+ .from(s3Buckets)
+ .where(eq(s3Buckets.id, video.bucket));
+ if (bucketRow) {
+ bucketProvider = await createBucketProvider(bucketRow);
+ prefix = `${video.ownerId}/${video.id}/`;
+ newPrefix = `${video.ownerId}/${newVideoId}/`;
+ }
+ } else if (video.awsBucket) {
+ bucketProvider = await createBucketProvider();
+ prefix = `${video.ownerId}/${video.id}/`;
+ newPrefix = `${video.ownerId}/${newVideoId}/`;
+ }
+ if (bucketProvider && prefix && newPrefix) {
+ const objects = await bucketProvider.listObjects({ prefix });
+ if (objects.Contents) {
+ for (const obj of objects.Contents) {
+ if (!obj.Key) continue;
+ const newKey = obj.Key.replace(prefix, newPrefix);
+ await bucketProvider.copyObject(
+ `${bucketProvider.name}/${obj.Key}`,
+ newKey
+ );
+ }
+ }
+ }
+ } catch (err) {
+ console.error("Failed to copy S3 assets for duplicated video", err);
+ }
+
+ revalidatePath("/dashboard/caps");
+
+ return newVideoId;
+}
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/ArrowUp.tsx b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/ArrowUp.tsx
index 316a029dd..667ef9f51 100644
--- a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/ArrowUp.tsx
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/ArrowUp.tsx
@@ -108,4 +108,4 @@ const ArrowUpIcon = forwardRef<ArrowUpIconHandle, ArrowUpIconProps>(
ArrowUpIcon.displayName = 'ArrowUpIcon';
-export { ArrowUpIcon };
+export default ArrowUpIcon;
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Cap.tsx b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Cap.tsx
index fce936b2c..886fc402b 100644
--- a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Cap.tsx
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Cap.tsx
@@ -89,4 +89,4 @@ const CapIcon = forwardRef<CapIconHandle, CapIconProps>(
CapIcon.displayName = 'CapIcon';
-export { CapIcon };
+export default CapIcon;
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Chat.tsx b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Chat.tsx
index 8d54164ac..6b5eaf51d 100644
--- a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Chat.tsx
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Chat.tsx
@@ -121,4 +121,4 @@ const MessageCircleMoreIcon = forwardRef<
MessageCircleMoreIcon.displayName = 'MessageCircleMoreIcon';
-export { MessageCircleMoreIcon };
+export default MessageCircleMoreIcon;
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Cog.tsx b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Cog.tsx
index 29893e850..909ddfe23 100644
--- a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Cog.tsx
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Cog.tsx
@@ -99,4 +99,4 @@ const CogIcon = forwardRef<CogIconHandle, CogIconProps>(
CogIcon.displayName = 'CogIcon';
-export { CogIcon };
+export default CogIcon;
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Download.tsx b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Download.tsx
index 83c1cda6a..ce43e4c05 100644
--- a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Download.tsx
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Download.tsx
@@ -95,4 +95,4 @@ const DownloadIcon = forwardRef<DownloadIconHandle, DownloadIconProps>(
DownloadIcon.displayName = 'DownloadIcon';
-export { DownloadIcon };
+export default DownloadIcon;
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Home.tsx b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Home.tsx
index aff17afd7..2dfdd2d6a 100644
--- a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Home.tsx
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Home.tsx
@@ -99,4 +99,4 @@ const HomeIcon = forwardRef<HomeIconHandle, HomeIconProps>(
HomeIcon.displayName = 'HomeIcon';
-export { HomeIcon };
+export default HomeIcon;
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Layers.tsx b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Layers.tsx
index e97e0937c..b5fb9fcd3 100644
--- a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Layers.tsx
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Layers.tsx
@@ -109,4 +109,4 @@ const LayersIcon = forwardRef<LayersIconHandle, LayersIconProps>(
LayersIcon.displayName = 'LayersIcon';
-export { LayersIcon };
+export default LayersIcon;
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Logout.tsx b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Logout.tsx
index a402ef155..61cbec69d 100644
--- a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Logout.tsx
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Logout.tsx
@@ -100,4 +100,4 @@ const LogoutIcon = forwardRef<LogoutIconHandle, LogoutIconProps>(
LogoutIcon.displayName = 'LogoutIcon';
-export { LogoutIcon };
+export default LogoutIcon;
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Settings.tsx b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Settings.tsx
index 17c71b0b3..0cbc70685 100644
--- a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Settings.tsx
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/Settings.tsx
@@ -89,4 +89,4 @@ const SettingsGearIcon = forwardRef<
SettingsGearIcon.displayName = 'SettingsGearIcon';
-export { SettingsGearIcon };
+export default SettingsGearIcon;
diff --git a/apps/web/app/(org)/dashboard/_components/AnimatedIcons/index.ts b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/index.ts
new file mode 100644
index 000000000..cca970a9e
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/_components/AnimatedIcons/index.ts
@@ -0,0 +1,21 @@
+import ArrowUpIcon from "./ArrowUp";
+import CapIcon from "./Cap";
+import MessageCircleMoreIcon from "./Chat";
+import CogIcon from "./Cog";
+import DownloadIcon from "./Download";
+import HomeIcon from "./Home";
+import LayersIcon from "./Layers";
+import LogoutIcon from "./Logout";
+import SettingsGearIcon from "./Settings";
+
+export {
+ ArrowUpIcon,
+ CapIcon,
+ MessageCircleMoreIcon,
+ CogIcon,
+ DownloadIcon,
+ HomeIcon,
+ LayersIcon,
+ LogoutIcon,
+ SettingsGearIcon,
+};
diff --git a/apps/web/app/(org)/dashboard/_components/ConfirmationDialog.tsx b/apps/web/app/(org)/dashboard/_components/ConfirmationDialog.tsx
index 1db087e11..8aaa46695 100644
--- a/apps/web/app/(org)/dashboard/_components/ConfirmationDialog.tsx
+++ b/apps/web/app/(org)/dashboard/_components/ConfirmationDialog.tsx
@@ -40,11 +40,17 @@ export function ConfirmationDialog({
</DialogHeader>
<p className="p-5 text-[14px] leading-5 text-gray-11">{description}</p>
<DialogFooter>
- <Button onClick={onCancel} variant="gray" size="sm" disabled={loading}>
+ <Button onClick={(e) => {
+ e.stopPropagation();
+ onCancel();
+ }} variant="gray" size="sm" disabled={loading}>
{cancelLabel}
</Button>
<Button
- onClick={onConfirm}
+ onClick={(e) => {
+ e.stopPropagation();
+ onConfirm();
+ }}
variant={confirmVariant}
size="sm"
spinner={loading}
diff --git a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx
index 21a421d44..f8794cc9f 100644
--- a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx
+++ b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx
@@ -25,12 +25,10 @@ import { usePathname } from "next/navigation";
import React, { cloneElement, memo, useMemo, useRef, useState } from "react";
import { useDashboardContext, useTheme } from "../Contexts";
import { MembersDialog } from "../spaces/[spaceId]/components/MembersDialog";
-import { ArrowUpIcon } from "./AnimatedIcons/ArrowUp";
-import { MessageCircleMoreIcon } from "./AnimatedIcons/Chat";
-import { DownloadIcon, DownloadIconHandle } from "./AnimatedIcons/Download";
-import { HomeIcon } from "./AnimatedIcons/Home";
-import { LogoutIcon } from "./AnimatedIcons/Logout";
-import { SettingsGearIcon } from "./AnimatedIcons/Settings";
+import { ArrowUpIcon, MessageCircleMoreIcon, DownloadIcon, HomeIcon, LogoutIcon, SettingsGearIcon } from "./AnimatedIcons";
+import { DownloadIconHandle } from "./AnimatedIcons/Download";
+
+
export const navItemClass =
"flex items-center justify-start rounded-xl outline-none tracking-tight overflow-hidden";
diff --git a/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx b/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx
index 16f03a4f8..7d0f395a2 100644
--- a/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx
+++ b/apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx
@@ -34,10 +34,10 @@ import Link from "next/link";
import { usePathname } from "next/navigation";
import { cloneElement, useRef, useState } from "react";
import { useDashboardContext } from "../../Contexts";
-import { CapIcon } from "../AnimatedIcons/Cap";
-import { CogIcon, CogIconHandle } from "../AnimatedIcons/Cog";
+import { CogIcon, CapIcon } from "../AnimatedIcons";
import { updateActiveOrganization } from "./server";
import SpacesList from "./SpacesList";
+import { CogIconHandle } from "../AnimatedIcons/Cog";
interface Props {
toggleMobileNav?: () => void;
diff --git a/apps/web/app/(org)/dashboard/_components/Navbar/SpacesList.tsx b/apps/web/app/(org)/dashboard/_components/Navbar/SpacesList.tsx
index 9066aacd6..6e8a58b19 100644
--- a/apps/web/app/(org)/dashboard/_components/Navbar/SpacesList.tsx
+++ b/apps/web/app/(org)/dashboard/_components/Navbar/SpacesList.tsx
@@ -11,7 +11,7 @@ import {
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import clsx from "clsx";
-import { motion } from "framer-motion";
+import { AnimatePresence, motion } from "framer-motion";
import { ChevronDown, ChevronUp } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
@@ -23,7 +23,8 @@ import SpaceDialog from "./SpaceDialog";
import { useDashboardContext } from "../../Contexts";
import { Spaces } from "../../dashboard-data";
-import { LayersIcon, LayersIconHandle } from "../AnimatedIcons/Layers";
+import { LayersIcon } from "../AnimatedIcons";
+import { LayersIconHandle } from "../AnimatedIcons/Layers";
import { navItemClass } from "./Items";
const SpacesList = ({ toggleMobileNav }: { toggleMobileNav?: () => void }) => {
@@ -248,9 +249,17 @@ const SpacesList = ({ toggleMobileNav }: { toggleMobileNav?: () => void }) => {
}}
/>
)}
- {activeDropTarget === space.id && (
- <div className="absolute inset-0 z-10 rounded-xl border pointer-events-none border-gray-5 bg-gray-4" />
- )}
+ <AnimatePresence>
+ {activeDropTarget === space.id && (
+ <motion.div
+ className="absolute inset-0 z-10 rounded-xl border transition-all duration-200 pointer-events-none border-blue-10 bg-gray-4"
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ exit={{ opacity: 0 }}
+ transition={{ duration: 0.2 }}
+ />
+ )}
+ </AnimatePresence>
<Link
href={`/dashboard/spaces/${space.id}`}
className={clsx(
diff --git a/apps/web/app/(org)/dashboard/caps/Caps.tsx b/apps/web/app/(org)/dashboard/caps/Caps.tsx
index a8afecc33..617e2cf20 100644
--- a/apps/web/app/(org)/dashboard/caps/Caps.tsx
+++ b/apps/web/app/(org)/dashboard/caps/Caps.tsx
@@ -2,9 +2,13 @@
import { deleteVideo } from "@/actions/videos/delete";
import { useApiClient } from "@/utils/web-api";
import { VideoMetadata } from "@cap/database/types";
-import { useRouter, useSearchParams } from "next/navigation";
+import { Button } from "@cap/ui";
+import { faFolderPlus } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useRouter, useSearchParams, } from "next/navigation";
import { useEffect, useRef, useState } from "react";
import { toast } from "sonner";
+import { NewFolderDialog } from "./components/NewFolderDialog";
import { useDashboardContext } from "../Contexts";
import { CapCard } from "./components/CapCard/CapCard";
import { CapPagination } from "./components/CapPagination";
@@ -12,6 +16,10 @@ import { EmptyCapState } from "./components/EmptyCapState";
import { SelectedCapsBar } from "./components/SelectedCapsBar";
import { UploadCapButton } from "./components/UploadCapButton";
import { UploadPlaceholderCard } from "./components/UploadPlaceholderCard";
+import Folder from "./components/Folder";
+import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
+import type { FolderDataType } from "./components/Folder";
+import { useUploadingContext } from "./UploadingContext";
type VideoData = {
id: string;
@@ -32,38 +40,44 @@ type VideoData = {
hasPassword: boolean;
}[];
+
export const Caps = ({
data,
count,
customDomain,
domainVerified,
dubApiKeyEnabled,
+ folders,
}: {
data: VideoData;
count: number;
customDomain: string | null;
domainVerified: boolean;
+ folders: FolderDataType[];
dubApiKeyEnabled: boolean;
}) => {
const { refresh } = useRouter();
const params = useSearchParams();
const page = Number(params.get("page")) || 1;
const [analytics, setAnalytics] = useState<Record<string, number>>({});
- const { user, spacesData, organizationData } = useDashboardContext();
+ const { user } = useDashboardContext();
const limit = 15;
+ const [openNewFolderDialog, setOpenNewFolderDialog] = useState(false);
const totalPages = Math.ceil(count / limit);
- const [selectedCaps, setSelectedCaps] = useState<string[]>([]);
const previousCountRef = useRef<number>(0);
+ const [selectedCaps, setSelectedCaps] = useState<string[]>([]);
const [isDeleting, setIsDeleting] = useState(false);
const [isDraggingCap, setIsDraggingCap] = useState(false);
- const [uploadPlaceholders, setUploadPlaceholders] = useState<
- {
- id: string;
- progress: number;
- thumbnail?: string;
- uploadProgress?: number;
- }[]
- >([]);
+ const {
+ isUploading,
+ setIsUploading,
+ uploadingCapId,
+ setUploadingCapId,
+ uploadingThumbnailUrl,
+ setUploadingThumbnailUrl,
+ uploadProgress,
+ setUploadProgress
+ } = useUploadingContext();
const anyCapSelected = selectedCaps.length > 0;
@@ -147,25 +161,6 @@ export const Caps = ({
};
}, []);
- const deleteCap = async (videoId: string) => {
- try {
- const response = await deleteVideo(videoId);
- if (response.success) {
- refresh();
- toast.success("Cap deleted successfully");
- } else {
- throw new Error(
- response.message || "Failed to delete Cap - please try again later"
- );
- }
- } catch (error) {
- if (error instanceof Error) {
- toast.error(error.message);
- } else {
- toast.error("Failed to delete Cap - please try again later");
- }
- }
- };
const handleCapSelection = (capId: string) => {
setSelectedCaps((prev) => {
@@ -185,7 +180,7 @@ export const Caps = ({
setIsDeleting(true);
try {
- await toast.promise(
+ toast.promise(
async () => {
const results = await Promise.allSettled(
selectedCaps.map((capId) => deleteVideo(capId))
@@ -232,26 +227,7 @@ export const Caps = ({
}
};
- const handleUploadStart = (id: string, thumbnail?: string) => {
- setUploadPlaceholders((prev) => [{ id, progress: 0, thumbnail }, ...prev]);
- };
-
- const handleUploadProgress = (
- id: string,
- progress: number,
- uploadProgress?: number
- ) => {
- setUploadPlaceholders((prev) =>
- prev.map((u) => (u.id === id ? { ...u, progress, uploadProgress } : u))
- );
- };
-
- const handleUploadComplete = (id: string) => {
- setUploadPlaceholders((prev) => prev.filter((u) => u.id !== id));
- refresh();
- };
-
- if (data.length === 0) {
+ if (count === 0) {
return <EmptyCapState />;
}
@@ -260,44 +236,93 @@ export const Caps = ({
{isDraggingCap && (
<div className="fixed inset-0 z-50 pointer-events-none">
<div className="flex justify-center items-center w-full h-full">
- <div className="px-5 py-3 text-sm font-medium rounded-lg border backdrop-blur-md bg-gray-1/80 border-gray-4 text-gray-12">
- Drag to a space to share
+ <div className="flex gap-2 items-center px-5 py-3 text-sm font-medium text-white rounded-xl bg-blue-12">
+ <FontAwesomeIcon className="size-3.5 text-white opacity-50" icon={faInfoCircle} />
+ <p className="text-white">Drag to a space to share or folder to move</p>
</div>
</div>
</div>
)}
- <div className="flex justify-start mb-4">
+ <NewFolderDialog
+ open={openNewFolderDialog}
+ onOpenChange={setOpenNewFolderDialog}
+ />
+ <div className="flex gap-3 items-center mb-10 w-full">
+ <Button
+ onClick={() => setOpenNewFolderDialog(true)}
+ size="sm"
+ variant="dark"
+ className="flex gap-2 items-center w-fit"
+ >
+ <FontAwesomeIcon className="size-3.5" icon={faFolderPlus} />
+ New Folder
+ </Button>
<UploadCapButton
- onStart={handleUploadStart}
+ onStart={(id, thumbnailUrl) => {
+ setIsUploading(true);
+ setUploadingCapId(id);
+ setUploadingThumbnailUrl(thumbnailUrl);
+ setUploadProgress(0);
+ }}
size="sm"
- onProgress={handleUploadProgress}
- onComplete={handleUploadComplete}
+ onProgress={(id, progress, uploadProgress) => {
+ // Update progress in the context
+ if (uploadProgress !== undefined) {
+ setUploadProgress(Math.round(uploadProgress * 100));
+ }
+ }}
+ onComplete={() => {
+ setIsUploading(false);
+ setUploadingCapId(null);
+ setUploadingThumbnailUrl(undefined);
+ setUploadProgress(0);
+ }}
/>
</div>
- <div className="grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
- {uploadPlaceholders.map((u) => (
- <UploadPlaceholderCard
- key={u.id}
- thumbnail={u.thumbnail}
- progress={u.progress}
- uploadProgress={u.uploadProgress}
- />
- ))}
- {data.map((cap) => (
- <CapCard
- key={cap.id}
- cap={cap}
- analytics={analytics[cap.id] || 0}
- onDelete={deleteCap}
- userId={user?.id}
- customDomain={customDomain}
- domainVerified={domainVerified}
- isSelected={selectedCaps.includes(cap.id)}
- onSelectToggle={() => handleCapSelection(cap.id)}
- anyCapSelected={anyCapSelected}
- />
- ))}
- </div>
+ {folders.length > 0 && (
+ <>
+ <div className="flex gap-3 items-center mb-6 w-full">
+ <h1 className="text-2xl font-medium text-gray-12">Folders</h1>
+ </div>
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-4 mb-10">
+ {folders.map((folder) => (
+ <Folder key={folder.id} {...folder} />
+ ))}
+ </div>
+ </>
+ )}
+ {data.length > 0 && (
+ <>
+ <div className="flex justify-between items-center mb-6 w-full">
+ <h1 className="text-2xl font-medium text-gray-12">Videos</h1>
+ </div>
+
+ <div className="grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
+ {isUploading && (
+ <UploadPlaceholderCard
+ key={"upload-placeholder"}
+ id={uploadingCapId || undefined}
+ thumbnailUrl={uploadingThumbnailUrl}
+ progress={uploadProgress}
+ />
+ )}
+ {data.map((cap) => (
+ <CapCard
+ key={cap.id}
+ cap={cap}
+ analytics={analytics[cap.id] || 0}
+ onDelete={deleteSelectedCaps}
+ userId={user?.id}
+ customDomain={customDomain}
+ domainVerified={domainVerified}
+ isSelected={selectedCaps.includes(cap.id)}
+ anyCapSelected={anyCapSelected}
+ onSelectToggle={() => handleCapSelection(cap.id)}
+ />
+ ))}
+ </div>
+ </>
+ )}
{(data.length > limit || data.length === limit || page !== 1) && (
<div className="mt-7">
<CapPagination currentPage={page} totalPages={totalPages} />
diff --git a/apps/web/app/(org)/dashboard/caps/UploadingContext.tsx b/apps/web/app/(org)/dashboard/caps/UploadingContext.tsx
new file mode 100644
index 000000000..a81f5bcd6
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/caps/UploadingContext.tsx
@@ -0,0 +1,46 @@
+"use client";
+
+import React, { createContext, useContext, useState } from "react";
+
+interface UploadingContextType {
+ isUploading: boolean;
+ setIsUploading: (value: boolean) => void;
+ uploadingCapId: string | null;
+ setUploadingCapId: (id: string | null) => void;
+ uploadingThumbnailUrl: string | undefined;
+ setUploadingThumbnailUrl: (url: string | undefined) => void;
+ uploadProgress: number;
+ setUploadProgress: (progress: number) => void;
+}
+
+const UploadingContext = createContext<UploadingContextType | undefined>(undefined);
+
+export function useUploadingContext() {
+ const context = useContext(UploadingContext);
+ if (!context) {
+ throw new Error('useUploadingContext must be used within an UploadingProvider');
+ }
+ return context;
+}
+
+export function UploadingProvider({ children }: { children: React.ReactNode }) {
+ const [isUploading, setIsUploading] = useState(false);
+ const [uploadingCapId, setUploadingCapId] = useState<string | null>(null);
+ const [uploadingThumbnailUrl, setUploadingThumbnailUrl] = useState<string | undefined>(undefined);
+ const [uploadProgress, setUploadProgress] = useState(0);
+
+ return (
+ <UploadingContext.Provider value={{
+ isUploading,
+ setIsUploading,
+ uploadingCapId,
+ setUploadingCapId,
+ uploadingThumbnailUrl,
+ setUploadingThumbnailUrl,
+ uploadProgress,
+ setUploadProgress
+ }}>
+ {children}
+ </UploadingContext.Provider>
+ );
+}
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 01db839fd..1ed6e28d2 100644
--- a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
+++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
@@ -7,8 +7,8 @@ import { VideoMetadata } from "@cap/database/types";
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@cap/ui";
import {
faCheck,
- faEllipsis,
- faLock,
+ faCopy,
+ faEllipsis, faLock,
faTrash,
faUnlock,
faVideo
@@ -24,6 +24,7 @@ import { SharingDialog } from "../SharingDialog";
import { CapCardAnalytics } from "./CapCardAnalytics";
import { CapCardButtons } from "./CapCardButtons";
import { CapCardContent } from "./CapCardContent";
+import { duplicateVideo } from "@/actions/videos/duplicate";
@@ -51,7 +52,7 @@ export interface CapCardProps extends PropsWithChildren {
hasPassword?: boolean;
};
analytics: number;
- onDelete?: (videoId: string) => Promise<void>;
+ onDelete?: () => Promise<void>;
userId?: string;
sharedCapCard?: boolean;
isSelected?: boolean;
@@ -60,6 +61,7 @@ export interface CapCardProps extends PropsWithChildren {
domainVerified?: boolean;
hideSharedStatus?: boolean;
anyCapSelected?: boolean;
+ isDeleting?: boolean;
}
export const CapCard = ({
@@ -75,6 +77,7 @@ export const CapCard = ({
isSelected = false,
onSelectToggle,
anyCapSelected = false,
+ isDeleting = false,
}: CapCardProps) => {
const [isSharingDialogOpen, setIsSharingDialogOpen] = useState(false);
const [isPasswordDialogOpen, setIsPasswordDialogOpen] = useState(false);
@@ -104,7 +107,7 @@ export const CapCard = ({
const confirmRemoveCap = async () => {
if (!onDelete) return;
setRemoving(true);
- await onDelete(cap.id);
+ await onDelete();
setRemoving(false);
setConfirmOpen(false);
};
@@ -265,7 +268,7 @@ export const CapCard = ({
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
className={clsx(
- "flex relative flex-col gap-4 w-full h-full rounded-xl cursor-default bg-gray-1 border border-gray-3 group border-px",
+ "flex relative transition-colors duration-200 flex-col gap-4 w-full h-full rounded-xl cursor-default bg-gray-1 border border-gray-3 group border-px",
isSelected
? "!border-blue-10 border-px"
: anyCapSelected
@@ -327,7 +330,24 @@ export const CapCard = ({
sideOffset={5}
>
<DropdownMenuItem
- onClick={(e) => {
+ onClick={async () => {
+ try {
+ await duplicateVideo(cap.id)
+ toast.success("Cap duplicated successfully");
+ } catch (error) {
+ toast.error("Failed to duplicate cap");
+ }
+ }}
+ className="flex gap-2 items-center rounded-lg"
+ >
+ <FontAwesomeIcon
+ className="size-3"
+ icon={faCopy}
+ />
+ <p className="text-sm text-gray-12">Duplicate</p>
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => {
if (!isSubscribed) {
setUpgradeModalOpen(true);
} else {
@@ -398,6 +418,11 @@ export const CapCard = ({
"block group",
anyCapSelected && "cursor-pointer pointer-events-none"
)}
+ onClick={(e) => {
+ if (isDeleting) {
+ e.preventDefault();
+ }
+ }}
href={`/s/${cap.id}`}
>
<VideoThumbnail
diff --git a/apps/web/app/(org)/dashboard/caps/components/Folder.tsx b/apps/web/app/(org)/dashboard/caps/components/Folder.tsx
new file mode 100644
index 000000000..90bea94bf
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/caps/components/Folder.tsx
@@ -0,0 +1,371 @@
+"use client";
+import { faTrash } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { Fit, Layout, useRive } from "@rive-app/react-canvas";
+import { useEffect, useRef, useState } from "react";
+import { toast } from "sonner";
+import Link from "next/link";
+import { useTheme } from "../../Contexts";
+import { deleteFolder } from "@/actions/folders/deleteFolder";
+import { updateFolder } from "@/actions/folders/updateFolder";
+import { moveVideoToFolder } from "@/actions/folders/moveVideoToFolder";
+import { registerDropTarget } from "../../folder/[id]/components/ClientCapCard";
+import { ConfirmationDialog } from "../../_components/ConfirmationDialog";
+import { FoldersDropdown } from "./FoldersDropdown";
+import clsx from "clsx";
+
+export type FolderDataType = {
+ name: string;
+ id: string;
+ color: "normal" | "blue" | "red" | "yellow";
+ videoCount: number;
+ parentId?: string | null;
+};
+
+const Folder = ({ name, color, id, parentId, videoCount }: FolderDataType) => {
+ const { theme } = useTheme();
+ const [confirmDeleteFolderOpen, setConfirmDeleteFolderOpen] = useState(false);
+ const [deleteFolderLoading, setDeleteFolderLoading] = useState(false);
+ const [isRenaming, setIsRenaming] = useState(false);
+ const [updateName, setUpdateName] = useState(name);
+ const nameRef = useRef<HTMLTextAreaElement>(null);
+ const folderRef = useRef<HTMLDivElement>(null);
+ const [isDragOver, setIsDragOver] = useState(false);
+ const [isMovingVideo, setIsMovingVideo] = useState(false);
+ // Use a ref to track drag state to avoid re-renders during animation
+ const dragStateRef = useRef({
+ isDragging: false,
+ isAnimating: false
+ });
+
+ // Add a debounce timer ref to prevent animation stuttering
+ const animationTimerRef = useRef<NodeJS.Timeout | null>(null);
+
+ const artboard =
+ theme === "dark" && color === "normal"
+ ? "folder"
+ : color === "normal"
+ ? "folder-dark"
+ : `folder-${color}`;
+
+ const { rive, RiveComponent: FolderRive } = useRive({
+ src: "/rive/dashboard.riv",
+ artboard,
+ animations: "idle",
+ autoplay: false,
+ layout: new Layout({
+ fit: Fit.Contain,
+ }),
+ });
+
+ const deleteFolderHandler = async () => {
+ try {
+ setDeleteFolderLoading(true);
+ await deleteFolder(id);
+ toast.success("Folder deleted successfully");
+ } catch (error) {
+ toast.error("Failed to delete folder");
+ } finally {
+ setDeleteFolderLoading(false);
+ setConfirmDeleteFolderOpen(false);
+ }
+ };
+
+ useEffect(() => {
+ if (isRenaming && nameRef.current) {
+ nameRef.current.focus();
+ nameRef.current.select();
+ }
+ }, [isRenaming]);
+
+ // Register this folder as a drop target for mobile drag and drop
+ useEffect(() => {
+ if (!folderRef.current) return;
+
+ const unregister = registerDropTarget(
+ folderRef.current,
+ // onDrop handler
+ async (data) => {
+ if (!data || !data.id) return;
+
+ try {
+ setIsMovingVideo(true);
+ await moveVideoToFolder({ videoId: data.id, folderId: id });
+ toast.success(`"${data.name}" moved to "${name}" folder`);
+ } catch (error) {
+ console.error("Error moving video to folder:", error);
+ toast.error("Failed to move video to folder");
+ } finally {
+ setIsMovingVideo(false);
+ dragStateRef.current.isDragging = false;
+ }
+ },
+ // onDragOver handler
+ () => {
+ dragStateRef.current.isDragging = true;
+ setIsDragOver(true);
+
+ // Clear any pending animation timer
+ if (animationTimerRef.current) {
+ clearTimeout(animationTimerRef.current);
+ animationTimerRef.current = null;
+ }
+
+ // Play the folder-open animation
+ if (rive) {
+ rive.stop();
+ rive.play("folder-open");
+ }
+ },
+ // onDragLeave handler
+ () => {
+ setIsDragOver(false);
+
+ // Clear any pending animation timer
+ if (animationTimerRef.current) {
+ clearTimeout(animationTimerRef.current);
+ animationTimerRef.current = null;
+ }
+
+ // Play the folder-close animation
+ if (rive) {
+ rive.stop();
+ rive.play("folder-close");
+ }
+ }
+ );
+
+ // Add global drag end listener
+ const handleDragEnd = () => {
+ if (dragStateRef.current.isDragging) {
+ dragStateRef.current.isDragging = false;
+ if (!isDragOver) {
+ // Only reset animation if we're not currently over this folder
+ if (rive) {
+ // Clear any pending animation timer
+ if (animationTimerRef.current) {
+ clearTimeout(animationTimerRef.current);
+ animationTimerRef.current = null;
+ }
+ }
+ }
+ }
+ };
+
+ document.addEventListener('dragend', handleDragEnd);
+
+ return () => {
+ unregister();
+ document.removeEventListener('dragend', handleDragEnd);
+ };
+ }, [id, name, rive, isDragOver]);
+
+
+
+ const updateFolderNameHandler = async () => {
+ try {
+ await updateFolder({ folderId: id, name: updateName });
+ toast.success("Folder name updated successfully");
+ } catch (error) {
+ toast.error("Failed to update folder name");
+ } finally {
+ setIsRenaming(false);
+ }
+ };
+
+ const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {
+ e.preventDefault();
+ e.stopPropagation();
+
+ // Check if the dragged item is a CapCard
+ if (e.dataTransfer.types.includes("application/cap")) {
+ if (!isDragOver) {
+ setIsDragOver(true);
+ dragStateRef.current.isDragging = true;
+ e.dataTransfer.dropEffect = "move";
+
+ // Clear any pending animation timer
+ if (animationTimerRef.current) {
+ clearTimeout(animationTimerRef.current);
+ animationTimerRef.current = null;
+ }
+ // Play the folder-open animation when first dragging over
+ if (rive) {
+ rive.stop();
+ rive.play("folder-open");
+ }
+
+ }
+ }
+ };
+
+ const handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {
+ e.preventDefault();
+ e.stopPropagation();
+
+ // Check if this is a real leave event (not just moving within the element)
+ // by checking if the related target is not a child of our folder element
+ const relatedTarget = e.relatedTarget as Node;
+ if (folderRef.current && !folderRef.current.contains(relatedTarget)) {
+ setIsDragOver(false);
+
+ // Clear any pending animation timer
+ if (animationTimerRef.current) {
+ clearTimeout(animationTimerRef.current);
+ animationTimerRef.current = null;
+ }
+ if (rive) {
+ rive.stop();
+ rive.play("folder-close");
+ }
+
+ }
+ };
+
+ const handleDrop = async (e: React.DragEvent<HTMLDivElement>) => {
+ e.preventDefault();
+ e.stopPropagation();
+ setIsDragOver(false);
+ dragStateRef.current.isDragging = false;
+
+ // Clear any pending animation timer
+ if (animationTimerRef.current) {
+ clearTimeout(animationTimerRef.current);
+ animationTimerRef.current = null;
+ }
+
+ // Keep the folder open after a successful drop
+ if (rive) {
+ rive.stop();
+ rive.play("folder-close");
+ }
+
+ try {
+ const data = e.dataTransfer.getData("application/cap");
+ if (!data) return;
+
+ const capData = JSON.parse(data);
+ if (!capData.id) return;
+
+ setIsMovingVideo(true);
+ await moveVideoToFolder({ videoId: capData.id, folderId: id });
+ toast.success(`"${capData.name}" moved to "${name}" folder`);
+ } catch (error) {
+ console.error("Error moving video to folder:", error);
+ toast.error("Failed to move video to folder");
+ } finally {
+ setIsMovingVideo(false);
+ }
+ };
+
+ return (
+ <Link legacyBehavior prefetch={false} href={`/dashboard/folder/${id}`}>
+ <div
+ ref={folderRef}
+ onMouseEnter={() => {
+ // Don't play mouse animations during drag operations
+ if (dragStateRef.current.isDragging) return;
+ if (!rive) return;
+
+ // Clear any pending animation timer
+ if (animationTimerRef.current) {
+ clearTimeout(animationTimerRef.current);
+ animationTimerRef.current = null;
+ }
+
+ // Use a small delay to prevent stuttering when moving the mouse quickly
+ animationTimerRef.current = setTimeout(() => {
+ rive.stop();
+ rive.play("folder-open");
+ }, 50);
+ }}
+ onMouseLeave={() => {
+ // Don't play mouse animations during drag operations
+ if (dragStateRef.current.isDragging) return;
+ if (!rive) return;
+
+ // Clear any pending animation timer
+ if (animationTimerRef.current) {
+ clearTimeout(animationTimerRef.current);
+ animationTimerRef.current = null;
+ }
+
+ // Use a small delay to prevent stuttering when moving the mouse quickly
+ animationTimerRef.current = setTimeout(() => {
+ rive.stop();
+ rive.play("folder-close");
+ }, 50);
+ }}
+ onDragOver={handleDragOver}
+ onDragLeave={handleDragLeave}
+ onDrop={handleDrop}
+ className={clsx(
+ "flex justify-between items-center px-4 py-4 w-full h-auto rounded-lg border transition-colors duration-200 cursor-pointer bg-gray-3 hover:bg-gray-4 hover:border-gray-6",
+ isDragOver ? "border-blue-10 bg-gray-4" : "border-gray-5",
+ isMovingVideo && "opacity-70"
+ )}
+ >
+ <div
+ className="flex flex-1 gap-3 items-center">
+ <FolderRive
+ key={theme + "folder" + id}
+ className="w-[50px] h-[50px]"
+ />
+ <div onClick={(e) => {
+ e.stopPropagation();
+ }} className="flex flex-col justify-center h-10">
+ {isRenaming ? (
+ <textarea
+ ref={nameRef}
+ rows={1}
+ value={updateName}
+ onChange={(e) => setUpdateName(e.target.value)}
+ onBlur={async () => {
+ setIsRenaming(false);
+ if (updateName.trim() !== name) {
+ await updateFolderNameHandler();
+ }
+ }}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ setIsRenaming(false);
+ if (updateName.trim() !== name) {
+ updateFolderNameHandler();
+ }
+ }
+ }}
+ className="w-full resize-none bg-transparent border-none focus:outline-none
+ focus:ring-0 focus:border-none text-gray-12 text-[15px] max-w-[116px] truncate p-0 m-0 h-[22px] leading-[22px] overflow-hidden font-normal tracking-normal"
+ />
+ ) : (
+ <p onClick={(e) => {
+ e.stopPropagation()
+ setIsRenaming(true)
+ }} className="text-[15px] truncate text-gray-12 w-full max-w-[116px] m-0 p-0 h-[22px] leading-[22px] font-normal tracking-normal">{updateName}</p>
+ )}
+ <p className="text-sm truncate text-gray-10 w-fit">{`${videoCount} ${videoCount === 1 ? "video" : "videos"
+ }`}</p>
+ </div>
+ </div>
+ <ConfirmationDialog
+ loading={deleteFolderLoading}
+ open={confirmDeleteFolderOpen}
+ icon={<FontAwesomeIcon icon={faTrash} />}
+ onConfirm={deleteFolderHandler}
+ onCancel={() => setConfirmDeleteFolderOpen(false)}
+ title="Delete Folder"
+ description={`Are you sure you want to delete the folder "${name}"? This action cannot be undone.`}
+ />
+ <FoldersDropdown
+ id={id}
+ parentId={parentId}
+ setIsRenaming={setIsRenaming}
+ setConfirmDeleteFolderOpen={setConfirmDeleteFolderOpen}
+ nameRef={nameRef}
+ />
+ </div>
+ </Link >
+ );
+};
+
+export default Folder;
diff --git a/apps/web/app/(org)/dashboard/caps/components/Folders.tsx b/apps/web/app/(org)/dashboard/caps/components/Folders.tsx
new file mode 100644
index 000000000..538c545d8
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/caps/components/Folders.tsx
@@ -0,0 +1,146 @@
+"use client"
+
+import { Fit, Layout, useRive } from "@rive-app/react-canvas";
+import { useTheme } from "../../Contexts";
+import React, { useImperativeHandle } from "react";
+
+export interface FolderHandle {
+ play: (animationName: string) => void;
+ stop: () => void;
+}
+
+export const NormalFolder = React.forwardRef<FolderHandle>((_, ref) => {
+ const { theme } = useTheme();
+ const { rive, RiveComponent: NormalFolderRive } = useRive({
+ src: "/rive/dashboard.riv",
+ artboard: theme === "dark" ? "folder" : "folder-dark",
+ animations: "idle",
+ autoplay: false,
+ layout: new Layout({
+ fit: Fit.Contain,
+ }),
+ });
+
+ useImperativeHandle(ref, () => ({
+ play: (animationName: string) => {
+ if (!rive) return;
+ rive.play(animationName);
+ },
+ stop: () => {
+ if (!rive) return;
+ rive.stop();
+ }
+ }), [rive]);
+
+ return <NormalFolderRive key={theme + "folder-normal"} className="w-[50px] h-[50px]" />
+});
+
+export const BlueFolder = React.forwardRef<FolderHandle>((_, ref) => {
+ const { rive, RiveComponent: BlueFolderRive } = useRive({
+ src: "/rive/dashboard.riv",
+ artboard: "folder-blue",
+ animations: "idle",
+ autoplay: false,
+ layout: new Layout({
+ fit: Fit.Contain,
+ }),
+ });
+
+ useImperativeHandle(ref, () => ({
+ play: (animationName: string) => {
+ if (!rive) return;
+ rive.play(animationName);
+ },
+ stop: () => {
+ if (!rive) return;
+ rive.stop();
+ }
+ }), [rive]);
+
+ return <BlueFolderRive className="w-[50px] h-[50px]" />
+});
+
+export const RedFolder = React.forwardRef<FolderHandle>((_, ref) => {
+ const { rive, RiveComponent: RedFolderRive } = useRive({
+ src: "/rive/dashboard.riv",
+ artboard: "folder-red",
+ animations: "idle",
+ autoplay: false,
+ layout: new Layout({
+ fit: Fit.Contain,
+ }),
+ });
+
+ useImperativeHandle(ref, () => ({
+ play: (animationName: string) => {
+ if (!rive) return;
+ rive.play(animationName);
+ },
+ stop: () => {
+ if (!rive) return;
+ rive.stop();
+ }
+ }), [rive]);
+
+ return <RedFolderRive className="w-[50px] h-[50px]" />
+});
+
+export const YellowFolder = React.forwardRef<FolderHandle>((_, ref) => {
+ const { rive, RiveComponent: YellowFolderRive } = useRive({
+ src: "/rive/dashboard.riv",
+ artboard: "folder-yellow",
+ animations: "idle",
+ autoplay: false,
+ layout: new Layout({
+ fit: Fit.Contain,
+ }),
+ });
+
+ useImperativeHandle(ref, () => ({
+ play: (animationName: string) => {
+ if (!rive) return;
+ rive.play(animationName);
+ },
+ stop: () => {
+ if (!rive) return;
+ rive.stop();
+ }
+ }), [rive]);
+
+ return <YellowFolderRive className="w-[50px] h-[50px]" />
+});
+
+interface AllFoldersProps {
+ color: "normal" | "blue" | "red" | "yellow";
+ className?: string;
+}
+
+
+export const AllFolders = React.forwardRef<FolderHandle, AllFoldersProps>((props, ref) => {
+ const { theme } = useTheme();
+
+
+ const artboard = theme === "dark" && props.color === "normal" ? "folder" : props.color === "blue" ? "folder-blue" : props.color === "red" ? "folder-red" : props.color === "yellow" ? "folder-yellow" : "folder-dark";
+ const { rive, RiveComponent: AllFoldersRive } = useRive({
+ src: "/rive/dashboard.riv",
+ artboard,
+ animations: "idle",
+ autoplay: false,
+ layout: new Layout({
+ fit: Fit.Contain,
+ }),
+ });
+
+ useImperativeHandle(ref, () => ({
+ play: (animationName: string) => {
+ if (!rive) return;
+ rive.play(animationName);
+ },
+ stop: () => {
+ if (!rive) return;
+ rive.stop();
+ }
+ }), [rive]);
+
+ return <AllFoldersRive key={theme + props.color} className={props.className} />
+});
diff --git a/apps/web/app/(org)/dashboard/caps/components/FoldersDropdown.tsx b/apps/web/app/(org)/dashboard/caps/components/FoldersDropdown.tsx
new file mode 100644
index 000000000..971490636
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/caps/components/FoldersDropdown.tsx
@@ -0,0 +1,85 @@
+"use client";
+
+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@cap/ui";
+import { faCopy, faEllipsis, faPencil, faTrash } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { RefObject } from "react";
+import { toast } from "sonner";
+import { duplicateFolder } from "@/actions/folders/duplicateFolder";
+
+interface FoldersDropdownProps {
+ id: string;
+ setIsRenaming: (isRenaming: boolean) => void;
+ setConfirmDeleteFolderOpen: (open: boolean) => void;
+ nameRef: RefObject<HTMLTextAreaElement>;
+ parentId?: string | null;
+}
+
+export const FoldersDropdown = ({
+ id,
+ parentId,
+ setIsRenaming,
+ setConfirmDeleteFolderOpen,
+ nameRef,
+}: FoldersDropdownProps) => {
+ return (
+ <div
+ onClick={(e) => e.stopPropagation()}
+ onMouseEnter={(e) => e.stopPropagation()}
+ onMouseLeave={(e) => e.stopPropagation()}
+ >
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <div
+ className="flex justify-center items-center rounded-full border transition-colors duration-200
+ size-8 bg-gray-5 border-gray-7 hover:bg-gray-7 hover:border-gray-9 data-[state=open]:bg-gray-7 data-[state=open]:border-gray-9"
+ >
+ <FontAwesomeIcon className="text-gray-12 size-4" icon={faEllipsis} />
+ </div>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent>
+ {[
+ {
+ label: "Rename",
+ icon: faPencil,
+ onClick: () => {
+ setIsRenaming(true)
+ // Use setTimeout to ensure the textarea is rendered before focusing
+ setTimeout(() => {
+ nameRef.current?.focus()
+ nameRef.current?.select()
+ }, 0)
+ }
+ },
+ {
+ label: "Duplicate",
+ icon: faCopy,
+ onClick: async () => {
+ try {
+ await duplicateFolder(id, parentId);
+ toast.success("Folder duplicated successfully");
+ } catch (error) {
+ toast.error("Failed to duplicate folder");
+ }
+ }
+ },
+ {
+ label: "Delete",
+ icon: faTrash,
+ onClick: () => setConfirmDeleteFolderOpen(true)
+ }
+ ].map((item, index) => (
+ <DropdownMenuItem
+ key={item.label}
+ onClick={item.onClick}
+ className="rounded-lg"
+ >
+ <FontAwesomeIcon className="mr-1.5 text-gray-10 size-3" icon={item.icon} />
+ {item.label}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ );
+};
diff --git a/apps/web/app/(org)/dashboard/caps/components/NewFolderDialog.tsx b/apps/web/app/(org)/dashboard/caps/components/NewFolderDialog.tsx
new file mode 100644
index 000000000..c7f48a571
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/caps/components/NewFolderDialog.tsx
@@ -0,0 +1,150 @@
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Input,
+} from "@cap/ui";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { faFolderPlus } from "@fortawesome/free-solid-svg-icons";
+import React, { useEffect, useRef, useState } from "react";
+import clsx from "clsx";
+import { createFolder } from "@/actions/folders/createFolder";
+import { toast } from "sonner";
+import { BlueFolder, NormalFolder, RedFolder, YellowFolder } from "./Folders";
+
+interface Props {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+}
+
+const FolderOptions = [
+ {
+ value: "normal",
+ label: "Normal",
+ component: <NormalFolder />,
+ },
+ {
+ value: "blue",
+ label: "Blue",
+ component: <BlueFolder />,
+ },
+ {
+ value: "red",
+ label: "Red",
+ component: <RedFolder />,
+ },
+ {
+ value: "yellow",
+ label: "Yellow",
+ component: <YellowFolder />,
+ },
+] as const;
+
+export const NewFolderDialog: React.FC<Props> = ({ open, onOpenChange }) => {
+ const [selectedColor, setSelectedColor] = useState<
+ (typeof FolderOptions)[number]["value"] | null
+ >(null);
+ const [folderName, setFolderName] = useState<string>("");
+ const folderRefs = useRef<Record<string, any>>({});
+ const [loading, setLoading] = useState<boolean>(false);
+
+ useEffect(() => {
+ if (!open) setSelectedColor(null);
+ }, [open]);
+
+ const createFolderHandler = async () => {
+ if (!selectedColor) return;
+ try {
+ setLoading(true);
+ await createFolder({
+ name: folderName,
+ color: selectedColor,
+ });
+ setFolderName("");
+ setSelectedColor(null);
+ onOpenChange(false);
+ toast.success("Folder created successfully");
+ } catch (error: any) {
+ toast.error("Failed to create folder");
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent className="w-[calc(100%-20px)]">
+ <DialogHeader
+ icon={<FontAwesomeIcon icon={faFolderPlus} className="size-3.5" />}
+ >
+ <DialogTitle>New Folder</DialogTitle>
+ </DialogHeader>
+ <div className="p-5">
+ <Input
+ value={folderName}
+ onChange={(e) => setFolderName(e.target.value)}
+ required
+ placeholder="Folder name"
+ />
+ <div className="flex flex-wrap gap-2 mt-3">
+ {FolderOptions.map((option) => {
+ const folderRef = useRef<any>(null);
+ folderRefs.current[option.value] = folderRef;
+
+ return (
+ <div
+ className={clsx(
+ "flex flex-col flex-1 gap-1 items-center p-2 rounded-xl border transition-colors duration-200 cursor-pointer",
+ selectedColor === option.value
+ ? "border-gray-12 bg-gray-3 hover:bg-gray-3 hover:border-gray-12"
+ : "border-gray-4 hover:bg-gray-3 hover:border-gray-5 bg-transparent"
+ )}
+ key={option.value}
+ onClick={() => {
+ if (selectedColor === option.value) {
+ setSelectedColor(null);
+ return;
+ }
+ setSelectedColor(option.value);
+ }}
+ onMouseEnter={() => {
+ const folderRef = folderRefs.current[option.value]?.current;
+ if (!folderRef) return;
+ folderRef.stop();
+ folderRef.play("folder-open");
+ }}
+ onMouseLeave={() => {
+ const folderRef = folderRefs.current[option.value]?.current;
+ if (!folderRef) return;
+ folderRef.stop();
+ folderRef.play("folder-close");
+ }}
+ >
+ {React.cloneElement(option.component, { ref: folderRef })}
+ <p className="text-xs text-gray-10">{option.label}</p>
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ <DialogFooter>
+ <Button size="sm" variant="gray" onClick={() => onOpenChange(false)}>
+ Cancel
+ </Button>
+ <Button
+ onClick={createFolderHandler}
+ size="sm"
+ spinner={loading}
+ variant="dark"
+ disabled={!selectedColor || !folderName.trim().length || loading}
+ >
+ Create
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+};
diff --git a/apps/web/app/(org)/dashboard/caps/components/SelectedCapsBar.tsx b/apps/web/app/(org)/dashboard/caps/components/SelectedCapsBar.tsx
index 326331f74..1e86b4e9d 100644
--- a/apps/web/app/(org)/dashboard/caps/components/SelectedCapsBar.tsx
+++ b/apps/web/app/(org)/dashboard/caps/components/SelectedCapsBar.tsx
@@ -80,7 +80,7 @@ export const SelectedCapsBar = ({
</Button>
<ConfirmationDialog
open={confirmOpen}
- icon={<FontAwesomeIcon icon={faFilm} className="text-red-10" />}
+ icon={<FontAwesomeIcon icon={faFilm} />}
title="Delete selected Caps"
description={`Are you sure you want to delete ${selectedCaps.length} cap${selectedCaps.length === 1 ? '' : 's'}? This action cannot be undone.`}
confirmLabel="Delete"
diff --git a/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx b/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx
index aa8dbba39..665c55487 100644
--- a/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx
+++ b/apps/web/app/(org)/dashboard/caps/components/SharingDialog.tsx
@@ -318,7 +318,7 @@ const SpaceCard = ({
>
<div
className={clsx(
- "flex items-center relative overflow-visible flex-col justify-center gap-2 border transition-colors bg-gray-1",
+ "flex items-center relative overflow-visible flex-col justify-center gap-2 border transition-colors bg-gray-2",
"duration-200 w-full p-2.5 rounded-xl cursor-pointer",
isSelected
? "bg-gray-3 border-green-500"
diff --git a/apps/web/app/(org)/dashboard/caps/components/UploadCapButton.tsx b/apps/web/app/(org)/dashboard/caps/components/UploadCapButton.tsx
index fd30628ef..a513bb3e1 100644
--- a/apps/web/app/(org)/dashboard/caps/components/UploadCapButton.tsx
+++ b/apps/web/app/(org)/dashboard/caps/components/UploadCapButton.tsx
@@ -5,13 +5,7 @@ import { Button } from "@cap/ui";
import { createVideoAndGetUploadUrl } from "@/actions/video/upload";
import { useRouter } from "next/navigation";
import { toast } from "sonner";
-import {
- getProgressCircleConfig,
- calculateStrokeDashoffset,
- getUploadStatus,
- getDisplayProgress,
- isUserOnProPlan,
-} from "@cap/utils";
+import { isUserOnProPlan } from "@cap/utils";
import { UpgradeModal } from "@/components/UpgradeModal";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faUpload } from "@fortawesome/free-solid-svg-icons";
@@ -22,13 +16,14 @@ export const UploadCapButton = ({
onProgress,
onComplete,
size = "md",
- grey = false,
+ folderId,
}: {
onStart?: (id: string, thumbnail?: string) => void;
onProgress?: (id: string, progress: number, uploadProgress?: number) => void;
onComplete?: (id: string) => void;
size?: "sm" | "lg" | "md";
grey?: boolean;
+ folderId?: string;
}) => {
const { user, isSubscribed } = useDashboardContext();
const inputRef = useRef<HTMLInputElement>(null);
@@ -40,17 +35,6 @@ export const UploadCapButton = ({
const [upgradeModalOpen, setUpgradeModalOpen] = useState(false);
const router = useRouter();
- const { circumference } = getProgressCircleConfig();
- const status = getUploadStatus(uploadProgress);
- const displayProgress = getDisplayProgress(
- uploadProgress,
- processingProgress
- );
- const strokeDashoffset = calculateStrokeDashoffset(
- displayProgress,
- circumference
- );
-
const handleClick = () => {
if (!user) return;
@@ -101,9 +85,11 @@ export const UploadCapButton = ({
audioCodec: "aac",
isScreenshot: false,
isUpload: true,
+ folderId,
});
const uploadId = videoData.id;
+ // Initial start with thumbnail as undefined
onStart?.(uploadId);
onProgress?.(uploadId, 10);
@@ -206,7 +192,7 @@ export const UploadCapButton = ({
resolve(false);
});
- testVideo.addEventListener("loadstart", () => {});
+ testVideo.addEventListener("loadstart", () => { });
testVideo.src = URL.createObjectURL(optimizedBlob);
});
@@ -297,7 +283,7 @@ export const UploadCapButton = ({
resolve(null);
});
- video.addEventListener("loadstart", () => {});
+ video.addEventListener("loadstart", () => { });
});
};
@@ -306,6 +292,7 @@ export const UploadCapButton = ({
? URL.createObjectURL(thumbnailBlob)
: undefined;
+ // Pass the thumbnail URL to the parent component
onStart?.(uploadId, thumbnailUrl);
onProgress?.(uploadId, 100);
@@ -410,7 +397,7 @@ export const UploadCapButton = ({
spinner={uploading}
>
<FontAwesomeIcon className="size-3.5" icon={faUpload} />
- Upload Video
+ {uploading ? "Uploading..." : "Upload Video"}
</Button>
<input
ref={inputRef}
diff --git a/apps/web/app/(org)/dashboard/caps/components/UploadPlaceholderCard.tsx b/apps/web/app/(org)/dashboard/caps/components/UploadPlaceholderCard.tsx
index c4d537762..4b04ad8da 100644
--- a/apps/web/app/(org)/dashboard/caps/components/UploadPlaceholderCard.tsx
+++ b/apps/web/app/(org)/dashboard/caps/components/UploadPlaceholderCard.tsx
@@ -1,91 +1,103 @@
"use client";
+import { useUploadingContext } from "../UploadingContext";
import { LogoSpinner } from "@cap/ui";
-import {
- getProgressCircleConfig,
- calculateStrokeDashoffset,
- getUploadStatus,
- getDisplayProgress,
-} from "@cap/utils";
+import Image from "next/image";
+import { useEffect, useState } from "react";
-export const UploadPlaceholderCard = ({
- thumbnail,
- progress,
- uploadProgress,
-}: {
- thumbnail?: string;
- progress: number;
- uploadProgress?: number;
-}) => {
- const { circumference } = getProgressCircleConfig();
- const status = getUploadStatus(uploadProgress);
- const displayProgress = getDisplayProgress(uploadProgress, progress);
- const strokeDashoffset = calculateStrokeDashoffset(
- displayProgress,
- circumference
- );
+interface UploadPlaceholderCardProps {
+ id?: string;
+ thumbnailUrl?: string;
+ progress?: number;
+}
+
+export const UploadPlaceholderCard = ({ id, thumbnailUrl: propThumbnailUrl, progress: propProgress }: UploadPlaceholderCardProps) => {
+
+ const { uploadingThumbnailUrl, uploadProgress } = useUploadingContext();
+ const thumbnailUrl = propThumbnailUrl || uploadingThumbnailUrl;
+
+ const [progress, setProgress] = useState(propProgress || uploadProgress || 0);
+
+ useEffect(() => {
+ if (propProgress !== undefined) {
+ setProgress(propProgress);
+ return;
+ } else if (uploadProgress > 0) {
+ setProgress(uploadProgress);
+ return;
+ }
+
+ if (progress < 100) {
+ const timer = setTimeout(() => {
+ const increment = Math.max(1, Math.floor((100 - progress) / 10));
+ setProgress(prev => Math.min(99, prev + increment));
+ }, 300);
+ return () => clearTimeout(timer);
+ }
+ }, [progress, propProgress, uploadProgress]);
return (
<div className="flex flex-col gap-4 w-full h-full rounded-xl bg-gray-1 border-gray-3 border-[1px]">
- <div className="relative w-full overflow-hidden bg-black rounded-t-xl border-b border-gray-3 aspect-video group">
- {thumbnail ? (
- <img
- src={thumbnail}
- alt="Uploading thumbnail"
- className="w-full h-full object-cover"
+ <div className="overflow-hidden relative w-full bg-black rounded-t-xl border-b border-gray-3 aspect-video group">
+ {thumbnailUrl ? (
+ <Image
+ src={thumbnailUrl}
+ alt="Upload thumbnail"
+ fill={true}
+ sizes="(max-width: 768px) 100vw, 33vw"
+ objectFit="cover"
/>
) : (
- <div className="flex items-center justify-center w-full h-full">
+ <div className="flex justify-center items-center w-full h-full">
<LogoSpinner className="w-8 h-8 animate-spin" />
</div>
)}
- <div className="absolute inset-0 bg-black/60 transition-all duration-300"></div>
-
- <div className="absolute bottom-3 left-3 flex items-center gap-2">
- <span className="text-sm font-semibold text-white">{status}</span>
- <svg className="w-4 h-4 transform -rotate-90" viewBox="0 0 20 20">
+ {/* Circular progress indicator with text */}
+ <div className="flex absolute bottom-4 left-4 z-10 gap-2 items-center">
+ <svg className="w-6 h-6" width="28" height="28" viewBox="0 0 28 28">
<circle
- cx="10"
- cy="10"
- r="8"
- stroke="currentColor"
- strokeWidth="3"
+ cx="14"
+ cy="14"
+ r="12"
fill="none"
- className="text-white/30"
+ stroke="rgba(255,255,255,0.2)"
+ strokeWidth="3"
/>
<circle
- cx="10"
- cy="10"
- r="8"
- stroke="currentColor"
- strokeWidth="3"
+ cx="14"
+ cy="14"
+ r="12"
fill="none"
+ stroke="white"
+ strokeWidth="3"
+ strokeDasharray="75.4"
+ strokeDashoffset={75.4 * (1 - progress / 100)}
+ transform="rotate(-90 14 14)"
strokeLinecap="round"
- className="text-white transition-all duration-200 ease-out"
- style={{
- strokeDasharray: `${circumference} ${circumference}`,
- strokeDashoffset: `${strokeDashoffset}`,
- }}
/>
</svg>
+ <div className="text-sm font-medium text-white">
+ Uploading...
+ </div>
</div>
</div>
+
<div className="flex flex-col flex-grow gap-3 px-4 pb-4 w-full">
<div>
- <div className="h-[1.25rem] mb-1">
- <div className="h-4 bg-gray-3 rounded animate-pulse"></div>
+ <div className="mb-1 h-[1.25rem]">
+ <div className="w-36 h-3 rounded animate-pulse bg-gray-3"></div>
+ </div>
+ <div className="mb-2 h-[1.25rem]">
+ <div className="w-24 h-3 rounded animate-pulse bg-gray-3"></div>
</div>
<div className="mb-1 h-[1.25rem]">
- <div className="h-3 bg-gray-3 rounded animate-pulse w-24"></div>
+ <div className="w-16 h-3 rounded animate-pulse bg-gray-3"></div>
</div>
- <div className="mb-1 h-[1.5rem]">
- <div className="h-3 bg-gray-3 rounded animate-pulse w-20"></div>
+ <div className="mt-5 h-[1.25rem]">
+ <div className="w-32 h-3 rounded animate-pulse bg-gray-3"></div>
</div>
</div>
- <div className="flex items-center gap-4 text-sm text-gray-10">
- <div className="h-3 bg-gray-3 rounded animate-pulse w-16"></div>
- </div>
</div>
</div>
);
diff --git a/apps/web/app/(org)/dashboard/caps/page.tsx b/apps/web/app/(org)/dashboard/caps/page.tsx
index 384fa79ea..f41bb5d2e 100644
--- a/apps/web/app/(org)/dashboard/caps/page.tsx
+++ b/apps/web/app/(org)/dashboard/caps/page.tsx
@@ -1,16 +1,22 @@
import { db } from "@cap/database";
import { getCurrentUser } from "@cap/database/auth/session";
import {
- comments, organizations,
- sharedVideos,
- users,
+ comments,
+ folders, organizations,
+ sharedVideos, users,
videos
} from "@cap/database/schema";
-import { count, desc, eq, sql } from "drizzle-orm";
+import { and, count, desc, eq, isNull, sql } from "drizzle-orm";
import { Metadata } from "next";
import { redirect } from "next/navigation";
import { Caps } from "./Caps";
import { serverEnv } from "@cap/env";
+import { UploadingProvider } from "./UploadingContext";
+
+// Client component wrapper to provide the uploading context
+const ClientCapsPage = ({ children }: { children: React.ReactNode }) => {
+ return <UploadingProvider>{children}</UploadingProvider>;
+};
export const metadata: Metadata = {
title: "My Caps — Cap",
@@ -155,7 +161,7 @@ export default async function CapsPage({
.leftJoin(sharedVideos, eq(videos.id, sharedVideos.videoId))
.leftJoin(organizations, eq(sharedVideos.organizationId, organizations.id))
.leftJoin(users, eq(videos.ownerId, users.id))
- .where(eq(videos.ownerId, userId))
+ .where(and(eq(videos.ownerId, userId), isNull(videos.folderId)))
.groupBy(
videos.id,
videos.ownerId,
@@ -173,11 +179,30 @@ export default async function CapsPage({
.limit(limit)
.offset(offset);
+ const foldersData = await db()
+ .select({
+ id: folders.id,
+ name: folders.name,
+ color: folders.color,
+ parentId: folders.parentId,
+ videoCount: sql<number>`(
+ SELECT COUNT(*) FROM videos WHERE videos.folderId = folders.id
+ )`,
+ })
+ .from(folders)
+ .where(
+ and(
+ eq(folders.organizationId, user.activeOrganizationId),
+ isNull(folders.parentId)
+ )
+ );
+
const processedVideoData = videoData.map((video) => {
const { effectiveDate, ...videoWithoutEffectiveDate } = video;
return {
...videoWithoutEffectiveDate,
+ foldersData,
sharedOrganizations: video.sharedOrganizations.filter(
(organization) => organization.id !== null
),
@@ -194,12 +219,15 @@ export default async function CapsPage({
});
return (
- <Caps
- data={processedVideoData}
- customDomain={customDomain}
- domainVerified={domainVerified}
- count={totalCount}
- dubApiKeyEnabled={!!serverEnv().DUB_API_KEY}
- />
+ <ClientCapsPage>
+ <Caps
+ data={processedVideoData}
+ folders={foldersData}
+ customDomain={customDomain}
+ domainVerified={domainVerified}
+ count={totalCount}
+ dubApiKeyEnabled={!!serverEnv().DUB_API_KEY}
+ />
+ </ClientCapsPage>
);
}
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/BreadcrumbItem.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/BreadcrumbItem.tsx
new file mode 100644
index 000000000..38b092513
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/BreadcrumbItem.tsx
@@ -0,0 +1,105 @@
+"use client";
+
+import { AllFolders } from "../../../caps/components/Folders";
+import Link from "next/link";
+import { useState } from "react";
+import { moveVideoToFolder } from "@/actions/folders/moveVideoToFolder";
+import { toast } from "sonner";
+import clsx from "clsx";
+import { useRouter } from "next/navigation";
+
+interface BreadcrumbItemProps {
+ id: string;
+ name: string;
+ color: "normal" | "blue" | "red" | "yellow";
+ isLast: boolean;
+}
+
+export function BreadcrumbItem({ id, name, color, isLast }: BreadcrumbItemProps) {
+ const [isDragOver, setIsDragOver] = useState(false);
+ const [isMoving, setIsMoving] = useState(false);
+ const router = useRouter();
+
+ const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {
+ e.preventDefault();
+ e.stopPropagation();
+
+ // Check if the dragged item is a CapCard
+ if (e.dataTransfer.types.includes("application/cap")) {
+ setIsDragOver(true);
+ e.dataTransfer.dropEffect = "move";
+ }
+ };
+
+ const handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {
+ e.preventDefault();
+ e.stopPropagation();
+ setIsDragOver(false);
+ };
+
+ const handleDrop = async (e: React.DragEvent<HTMLDivElement>) => {
+ e.preventDefault();
+ e.stopPropagation();
+ setIsDragOver(false);
+
+ try {
+ const data = e.dataTransfer.getData("application/cap");
+ if (!data) return;
+
+ const capData = JSON.parse(data);
+ if (!capData.id) return;
+
+ setIsMoving(true);
+ await moveVideoToFolder({ videoId: capData.id, folderId: id });
+ router.refresh();
+ toast.success(`"${capData.name}" moved to "${name}" folder`);
+ } catch (error) {
+ console.error("Error moving video to folder:", error);
+ toast.error("Failed to move video to folder");
+ } finally {
+ setIsMoving(false);
+ }
+ };
+
+ if (isLast) {
+ return (
+ <div
+ className="flex gap-1.5 px-2 items-center"
+ onDragOver={handleDragOver}
+ onDragLeave={handleDragLeave}
+ onDrop={handleDrop}
+ >
+ <AllFolders color={color} className="size-5" />
+ <p className={clsx(`text-xl whitespace-nowrap text-gray-12`, {
+ 'opacity-70': isMoving
+ })}>
+ {name}
+ </p>
+ </div>
+ );
+ }
+
+ return (
+ <div
+ onDragOver={handleDragOver}
+ onDragLeave={handleDragLeave}
+ onDrop={handleDrop}
+ className={clsx(`relative px-2`, {
+ 'rounded-lg bg-gray-5': isDragOver,
+ 'opacity-70': isMoving
+ })}
+ >
+ <Link
+ href={`/dashboard/folder/${id}`}
+ className="flex gap-1.5 items-center transition-colors duration-200 z-10 relative"
+ >
+ <AllFolders color={color} className="size-5" />
+ <p className={clsx("text-lg whitespace-nowrap transition-colors duration-200 hover:text-gray-11",
+ isDragOver ? 'text-gray-12' : 'text-gray-9'
+ )}>
+ {name}
+ </p>
+ </Link>
+ </div>
+ );
+}
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/ClientCapCard.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/ClientCapCard.tsx
new file mode 100644
index 000000000..6bb40f89a
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/ClientCapCard.tsx
@@ -0,0 +1,249 @@
+"use client";
+
+import { CapCard, CapCardProps } from "../../../caps/components/CapCard/CapCard";
+import { deleteVideo } from "@/actions/videos/delete";
+import { useState, useRef } from "react";
+import { createPortal } from "react-dom";
+import { useRouter } from "next/navigation";
+import { toast } from "sonner";
+
+type ClientCapCardProps = CapCardProps & {
+ videoId: string;
+};
+
+// Interface for drop targets that will be registered for mobile drag and drop
+interface DropTarget {
+ element: HTMLElement;
+ onDrop: (data: any) => void;
+ onDragOver?: () => void;
+ onDragLeave?: () => void;
+}
+
+// Global registry for drop targets
+let dropTargets: DropTarget[] = [];
+
+// Register a drop target element
+export function registerDropTarget(
+ element: HTMLElement,
+ onDrop: (data: any) => void,
+ onDragOver?: () => void,
+ onDragLeave?: () => void
+) {
+ dropTargets.push({ element, onDrop, onDragOver, onDragLeave });
+ return () => {
+ dropTargets = dropTargets.filter(target => target.element !== element);
+ };
+}
+
+export function ClientCapCard(props: ClientCapCardProps) {
+ const { videoId, ...rest } = props;
+ const router = useRouter();
+ const [isDragging, setIsDragging] = useState(false);
+ const cardRef = useRef<HTMLDivElement>(null);
+ const [touchDragging, setTouchDragging] = useState(false);
+ const [touchPosition, setTouchPosition] = useState({ x: 0, y: 0 });
+ const dragDataRef = useRef<any>(null);
+
+ const handleDelete = async (videoId: string) => {
+ try {
+ await deleteVideo(videoId);
+ router.refresh();
+ toast.success('Video deleted successfully');
+ } catch (error) {
+ console.error('Error deleting video:', error);
+ toast.error('Failed to delete video');
+ }
+ };
+
+
+ // Create a drag preview element with thumbnail
+ const createDragPreview = (text: string): HTMLElement => {
+ // Create the container element
+ const container = document.createElement('div');
+ container.className = 'flex gap-2 items-center px-3 py-2 rounded-lg border shadow-md bg-gray-1 border-gray-4';
+ container.style.position = 'absolute';
+ container.style.top = '-9999px';
+ container.style.left = '-9999px';
+
+ // Add the text
+ const textElement = document.createElement('span');
+ textElement.textContent = text;
+ textElement.className = 'text-sm font-medium text-gray-12';
+ container.appendChild(textElement);
+
+ return container;
+ };
+
+ // Create the data object for drag operations
+ const createDragData = () => {
+ return {
+ id: videoId,
+ name: props.cap.name,
+ type: "application/cap"
+ };
+ };
+
+ // Handle drag start event for desktop
+ const handleDragStart = (e: React.DragEvent<HTMLDivElement>) => {
+ // Set the data transfer
+ e.dataTransfer.setData(
+ "application/cap",
+ JSON.stringify({
+ id: videoId,
+ name: props.cap.name,
+ })
+ );
+
+ // Set drag effect to 'move'
+ e.dataTransfer.effectAllowed = 'move';
+
+ // Set the drag image
+ try {
+ const dragPreview = createDragPreview(props.cap.name);
+ document.body.appendChild(dragPreview);
+
+ // Adjust offset based on whether we have a thumbnail
+ e.dataTransfer.setDragImage(dragPreview, 10, 10);
+
+ // Clean up after a short delay
+ setTimeout(() => document.body.removeChild(dragPreview), 100);
+ } catch (error) {
+ console.error('Error setting drag image:', error);
+ }
+
+ setIsDragging(true);
+ };
+
+ const handleDragEnd = () => {
+ setIsDragging(false);
+ };
+
+ // Touch event handlers for mobile drag and drop
+ const handleTouchStart = (e: React.TouchEvent<HTMLDivElement>) => {
+ // Store the drag data for potential drop
+ dragDataRef.current = createDragData();
+
+ // Get touch position
+ if (e.touches.length > 0) {
+ const touch = e.touches[0];
+ // Safely access touch properties
+ if (touch) {
+ const initialX = touch.clientX;
+ const initialY = touch.clientY;
+
+ // Set a timeout to distinguish between tap and drag
+ const timer = setTimeout(() => {
+ // Start dragging after a short delay to avoid accidental drags
+ setTouchDragging(true);
+ setTouchPosition({ x: initialX, y: initialY });
+ }, 200);
+
+ // Clear the timer if the touch ends quickly (tap)
+ const clearTimer = () => clearTimeout(timer);
+ document.addEventListener('touchend', clearTimer, { once: true });
+ }
+ }
+ };
+
+ const handleTouchMove = (e: React.TouchEvent<HTMLDivElement>) => {
+ if (!touchDragging) return;
+
+ // Prevent scrolling while dragging
+ e.preventDefault();
+
+ if (e.touches.length > 0) {
+ const touch = e.touches[0];
+ // Safely access touch properties
+ if (touch) {
+ setTouchPosition({ x: touch.clientX, y: touch.clientY });
+
+ // Check if we're over any drop targets
+ checkDropTargets(touch.clientX, touch.clientY);
+ }
+ }
+ };
+
+ const handleTouchEnd = (e: React.TouchEvent<HTMLDivElement>) => {
+ if (!touchDragging) return;
+
+ // Check if we're over a drop target and trigger the drop
+ if (e.changedTouches.length > 0) {
+ const lastTouch = e.changedTouches[0];
+ // Safely access touch properties
+ if (lastTouch) {
+ const dropTarget = findDropTargetAtPosition(lastTouch.clientX, lastTouch.clientY);
+
+ if (dropTarget && dragDataRef.current) {
+ dropTarget.onDrop(dragDataRef.current);
+ }
+ }
+ }
+
+ // Reset dragging state
+ setTouchDragging(false);
+ dragDataRef.current = null;
+ };
+
+ // Helper function to check if we're over a drop target
+ const checkDropTargets = (x: number, y: number) => {
+ // Highlight the drop target we're over (if any)
+ dropTargets.forEach(target => {
+ const rect = target.element.getBoundingClientRect();
+ const isOver = x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
+
+ // Add/remove a class to highlight the drop target
+ if (isOver) {
+ target.element.classList.add('drag-over');
+ // Trigger the onDragOver callback if provided
+ if (target.onDragOver) {
+ target.onDragOver();
+ }
+ } else if (target.element.classList.contains('drag-over')) {
+ target.element.classList.remove('drag-over');
+ // Trigger the onDragLeave callback if provided
+ if (target.onDragLeave) {
+ target.onDragLeave();
+ }
+ }
+ });
+ };
+
+ // Helper function to find a drop target at a position
+ const findDropTargetAtPosition = (x: number, y: number) => {
+ return dropTargets.find(target => {
+ const rect = target.element.getBoundingClientRect();
+ return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
+ });
+ };
+
+ return (
+ <>
+ <div
+ ref={cardRef}
+ draggable={true}
+ onDragStart={handleDragStart}
+ onDragEnd={handleDragEnd}
+ onTouchStart={handleTouchStart}
+ onTouchMove={handleTouchMove}
+ onTouchEnd={handleTouchEnd}
+ className={isDragging || touchDragging ? "opacity-50" : ""}
+ >
+ <CapCard {...rest} />
+ </div>
+
+ {/* Mobile drag preview */}
+ {touchDragging && typeof document !== 'undefined' && createPortal(
+ <div
+ className="flex fixed z-50 gap-2 items-center px-3 py-2 rounded-lg border shadow-md pointer-events-none bg-gray-1 border-gray-4"
+ style={{
+ left: `${touchPosition.x - 20}px`,
+ top: `${touchPosition.y - 30}px`,
+ }}
+ >
+ <span className="text-sm font-medium text-gray-12">{props.cap.name}</span>
+ </div>,
+ document.body
+ )}
+ </>
+ );
+}
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/ClientMyCapsLink.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/ClientMyCapsLink.tsx
new file mode 100644
index 000000000..ea4f025ea
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/ClientMyCapsLink.tsx
@@ -0,0 +1,115 @@
+"use client";
+
+import Link from "next/link";
+import { useState, useEffect, useRef } from "react";
+import { moveVideoToFolder } from "@/actions/folders/moveVideoToFolder";
+import { toast } from "sonner";
+import clsx from "clsx";
+import { registerDropTarget } from "./ClientCapCard";
+import { useRouter } from "next/navigation";
+
+export function ClientMyCapsLink() {
+ const [isDragOver, setIsDragOver] = useState(false);
+ const [isMovingVideo, setIsMovingVideo] = useState(false);
+ const linkRef = useRef<HTMLAnchorElement>(null);
+ const router = useRouter();
+
+ // Register this component as a drop target for mobile drag and drop
+ useEffect(() => {
+ if (!linkRef.current) return;
+
+ const unregister = registerDropTarget(linkRef.current, (data) => {
+ if (data && data.type === "application/cap") {
+ handleDrop({ id: data.id, name: data.name });
+ }
+ });
+
+ return () => {
+ unregister();
+ };
+ }, []);
+
+ // Handle drag events for desktop
+ const handleDragOver = (e: React.DragEvent<HTMLAnchorElement>) => {
+ e.preventDefault();
+
+ // Check if the dragged item is a cap
+ if (e.dataTransfer.types.includes("application/cap")) {
+ setIsDragOver(true);
+ }
+ };
+
+ const handleDragLeave = () => {
+ setIsDragOver(false);
+ };
+
+ const handleDrop = async (e: React.DragEvent<HTMLAnchorElement> | { id: string, name: string }) => {
+ if ('preventDefault' in e) {
+ e.preventDefault();
+
+ try {
+ // Get the cap data from the data transfer
+ const capData = JSON.parse(e.dataTransfer.getData("application/cap"));
+
+ if (!capData || !capData.id) {
+ console.error("Invalid cap data");
+ return;
+ }
+
+ await processDrop(capData);
+ } catch (error) {
+ console.error("Error processing drop:", error);
+ toast.error("Failed to move video");
+ }
+ } else {
+ // Handle mobile drop with direct data
+ await processDrop(e);
+ }
+ };
+
+ // Common function to process the drop for both desktop and mobile
+ const processDrop = async (capData: { id: string, name: string }) => {
+ setIsDragOver(false);
+
+ try {
+ if (!capData || !capData.id) {
+ console.error("Invalid cap data");
+ return;
+ }
+
+ setIsMovingVideo(true);
+
+ // Move the video to the root folder (null parentId)
+ await moveVideoToFolder({
+ videoId: capData.id,
+ folderId: null
+ });
+ router.refresh();
+
+ toast.success(`Moved "${capData.name}" to My Caps`);
+ } catch (error) {
+ console.error("Error moving video:", error);
+ toast.error("Failed to move video");
+ } finally {
+ setIsMovingVideo(false);
+ }
+ };
+
+ return (
+ <Link
+ ref={linkRef}
+ href="/dashboard/caps"
+ className={clsx(
+ "text-xl whitespace-nowrap transition-colors duration-200 hover:text-gray-12",
+ isDragOver ? "text-blue-10" : "text-gray-9",
+ isMovingVideo && "opacity-70",
+ "drag-target" // Add a class for styling when used as a drop target
+ )}
+ onDragOver={handleDragOver}
+ onDragLeave={handleDragLeave}
+ onDrop={handleDrop}
+ >
+ My Caps
+ </Link>
+ );
+}
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx
new file mode 100644
index 000000000..f06c287c5
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/FolderVideosSection.tsx
@@ -0,0 +1,159 @@
+"use client";
+
+import { UploadPlaceholderCard } from "../../../caps/components/UploadPlaceholderCard";
+import { ClientCapCard } from "./index";
+import { useRouter } from "next/navigation";
+import { useState, useRef, useEffect } from "react";
+import { toast } from "sonner";
+import { deleteVideo } from "@/actions/videos/delete";
+import { SelectedCapsBar } from "../../../caps/components/SelectedCapsBar";
+import { useApiClient } from "@/utils/web-api";
+import { useUploadingContext } from "../../../caps/UploadingContext";
+
+interface FolderVideosSectionProps {
+ folderId: string;
+ initialVideos: Array<any>; // Replace 'any' with your Video type if available
+ dubApiKeyEnabled: boolean;
+}
+
+export default function FolderVideosSection({ folderId, initialVideos, dubApiKeyEnabled }: FolderVideosSectionProps) {
+ const router = useRouter();
+ const apiClient = useApiClient();
+ const { isUploading, uploadingCapId, uploadingThumbnailUrl } = useUploadingContext();
+
+ const [selectedCaps, setSelectedCaps] = useState<string[]>([]);
+ const previousCountRef = useRef<number>(0);
+ const [analytics, setAnalytics] = useState<Record<string, number>>({});
+
+ const [isDeleting, setIsDeleting] = useState(false);
+
+ const deleteSelectedCaps = async () => {
+ if (selectedCaps.length === 0) return;
+
+ setIsDeleting(true);
+
+ try {
+ toast.promise(
+ async () => {
+ const results = await Promise.allSettled(
+ selectedCaps.map((capId) => deleteVideo(capId))
+ );
+
+ const successCount = results.filter(
+ (result) => result.status === "fulfilled" && result.value.success
+ ).length;
+
+ const errorCount = selectedCaps.length - successCount;
+
+ if (successCount > 0 && errorCount > 0) {
+ return { success: successCount, error: errorCount };
+ } else if (successCount > 0) {
+ return { success: successCount };
+ } else {
+ throw new Error(
+ `Failed to delete ${errorCount} cap${errorCount === 1 ? "" : "s"}`
+ );
+ }
+ },
+ {
+ loading: `Deleting ${selectedCaps.length} cap${selectedCaps.length === 1 ? "" : "s"
+ }...`,
+ success: (data) => {
+ if (data.error) {
+ return `Successfully deleted ${data.success} cap${data.success === 1 ? "" : "s"
+ }, but failed to delete ${data.error} cap${data.error === 1 ? "" : "s"
+ }`;
+ }
+ return `Successfully deleted ${data.success} cap${data.success === 1 ? "" : "s"
+ }`;
+ },
+ error: (error) =>
+ error.message || "An error occurred while deleting caps",
+ }
+ );
+
+ setSelectedCaps([]);
+ router.refresh();
+ } catch (error) {
+ } finally {
+ setIsDeleting(false);
+ }
+ };
+
+ const handleCapSelection = (capId: string) => {
+ setSelectedCaps((prev) => {
+ const newSelection = prev.includes(capId)
+ ? prev.filter((id) => id !== capId)
+ : [...prev, capId];
+
+ previousCountRef.current = prev.length;
+
+ return newSelection;
+ });
+ };
+
+ useEffect(() => {
+ const fetchAnalytics = async () => {
+ if (!dubApiKeyEnabled) return;
+
+ const analyticsData: Record<string, number> = {};
+ for (const video of initialVideos) {
+ const response = await apiClient.video.getAnalytics({
+ query: { videoId: video.id },
+ fetchOptions: {
+ cache: "force-cache",
+ },
+ });
+
+ if (response.status !== 200) continue;
+
+ analyticsData[video.id] = response.body.count || 0;
+ }
+ setAnalytics(analyticsData);
+ };
+
+ fetchAnalytics();
+ }, [initialVideos]);
+
+ return (
+ <>
+ <div className="flex justify-between items-center mb-6 w-full">
+ <h1 className="text-2xl font-medium text-gray-12">Videos</h1>
+ </div>
+ <div className="grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
+ {initialVideos.length === 0 && !isUploading ? (
+ <p className="col-span-full text-gray-9">No videos in this folder yet. Drag and drop into the folder or upload.</p>
+ ) : (
+ <>
+ {isUploading && (
+ <UploadPlaceholderCard
+ key={"upload-placeholder"}
+ id={uploadingCapId || undefined}
+ thumbnailUrl={uploadingThumbnailUrl}
+ />
+ )}
+ {initialVideos.map((video: any) => (
+ <ClientCapCard
+ key={video.id}
+ videoId={video.id}
+ cap={video}
+ analytics={analytics[video.id] || 0}
+ isSelected={selectedCaps.includes(video.id)}
+ anyCapSelected={selectedCaps.length > 0}
+ isDeleting={isDeleting}
+ onSelectToggle={() => handleCapSelection(video.id)}
+ onDelete={deleteSelectedCaps}
+ />
+ ))}
+ </>
+ )}
+ </div>
+ <SelectedCapsBar
+ selectedCaps={selectedCaps}
+ setSelectedCaps={setSelectedCaps}
+ deleteSelectedCaps={deleteSelectedCaps}
+ isDeleting={isDeleting}
+ />
+ </>
+ );
+}
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/NewSubfolderButton.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/NewSubfolderButton.tsx
new file mode 100644
index 000000000..5faa97ec4
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/NewSubfolderButton.tsx
@@ -0,0 +1,34 @@
+"use client";
+
+import { Button } from "@cap/ui";
+import { faFolderPlus } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useState } from "react";
+import { SubfolderDialog } from "./SubfolderDialog";
+
+interface NewSubfolderButtonProps {
+ parentFolderId: string;
+}
+
+export const NewSubfolderButton = ({ parentFolderId }: NewSubfolderButtonProps) => {
+ const [openDialog, setOpenDialog] = useState(false);
+
+ return (
+ <>
+ <Button
+ onClick={() => setOpenDialog(true)}
+ size="sm"
+ variant="dark"
+ className="flex gap-2 items-center"
+ >
+ <FontAwesomeIcon className="size-3.5" icon={faFolderPlus} />
+ New Subfolder
+ </Button>
+ <SubfolderDialog
+ open={openDialog}
+ onOpenChange={setOpenDialog}
+ parentFolderId={parentFolderId}
+ />
+ </>
+ );
+};
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/SubfolderDialog.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/SubfolderDialog.tsx
new file mode 100644
index 000000000..9de1231a9
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/SubfolderDialog.tsx
@@ -0,0 +1,157 @@
+"use client";
+
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Input,
+} from "@cap/ui";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { faFolderPlus } from "@fortawesome/free-solid-svg-icons";
+import React, { useEffect, useRef, useState } from "react";
+import clsx from "clsx";
+import { createFolder } from "@/actions/folders/createFolder";
+import { toast } from "sonner";
+import { BlueFolder, NormalFolder, RedFolder, YellowFolder } from "../../../caps/components/Folders";
+
+interface Props {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ parentFolderId: string;
+}
+
+const FolderOptions = [
+ {
+ value: "normal",
+ label: "Normal",
+ component: <NormalFolder />,
+ },
+ {
+ value: "blue",
+ label: "Blue",
+ component: <BlueFolder />,
+ },
+ {
+ value: "red",
+ label: "Red",
+ component: <RedFolder />,
+ },
+ {
+ value: "yellow",
+ label: "Yellow",
+ component: <YellowFolder />,
+ },
+] as const;
+
+export const SubfolderDialog: React.FC<Props> = ({ open, onOpenChange, parentFolderId }) => {
+ const [selectedColor, setSelectedColor] = useState<
+ (typeof FolderOptions)[number]["value"] | null
+ >(null);
+ const [folderName, setFolderName] = useState<string>("");
+ const folderRefs = useRef<Record<string, any>>({});
+ const [loading, setLoading] = useState<boolean>(false);
+
+ useEffect(() => {
+ if (!open) {
+ setSelectedColor(null);
+ setFolderName("");
+ }
+ }, [open]);
+
+ const createSubfolderHandler = async () => {
+ if (!selectedColor) return;
+ try {
+ setLoading(true);
+ await createFolder({
+ name: folderName,
+ color: selectedColor,
+ parentId: parentFolderId,
+ });
+ setFolderName("");
+ setSelectedColor(null);
+ onOpenChange(false);
+ toast.success("Subfolder created successfully");
+ } catch (error: any) {
+ toast.error("Failed to create subfolder");
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent className="w-[calc(100%-20px)]">
+ <DialogHeader
+ icon={<FontAwesomeIcon icon={faFolderPlus} className="size-3.5" />}
+ >
+ <DialogTitle>New Subfolder</DialogTitle>
+ </DialogHeader>
+ <div className="p-5">
+ <Input
+ value={folderName}
+ onChange={(e) => setFolderName(e.target.value)}
+ required
+ placeholder="Subfolder name"
+ />
+ <div className="flex flex-wrap gap-2 mt-3">
+ {FolderOptions.map((option) => {
+ const folderRef = useRef<any>(null);
+ folderRefs.current[option.value] = folderRef;
+
+ return (
+ <div
+ className={clsx(
+ "flex flex-col flex-1 gap-1 items-center p-2 rounded-xl border transition-colors duration-200 cursor-pointer",
+ selectedColor === option.value
+ ? "border-gray-12 bg-gray-3 hover:bg-gray-3 hover:border-gray-12"
+ : "border-gray-4 hover:bg-gray-3 hover:border-gray-5 bg-transparent"
+ )}
+ key={option.value}
+ onClick={() => {
+ if (selectedColor === option.value) {
+ setSelectedColor(null);
+ return;
+ }
+ setSelectedColor(option.value);
+ }}
+ onMouseEnter={() => {
+ const folderRef = folderRefs.current[option.value]?.current;
+ if (!folderRef) return;
+ folderRef.stop();
+ folderRef.play("folder-open");
+ }}
+ onMouseLeave={() => {
+ const folderRef = folderRefs.current[option.value]?.current;
+ if (!folderRef) return;
+ folderRef.stop();
+ folderRef.play("folder-close");
+ }}
+ >
+ {React.cloneElement(option.component, { ref: folderRef })}
+ <p className="text-xs text-gray-10">{option.label}</p>
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ <DialogFooter>
+ <Button size="sm" variant="gray" onClick={() => onOpenChange(false)}>
+ Cancel
+ </Button>
+ <Button
+ onClick={createSubfolderHandler}
+ size="sm"
+ spinner={loading}
+ variant="dark"
+ disabled={!selectedColor || !folderName.trim().length || loading}
+ >
+ Create
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+};
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/UploadCapButtonWithFolder.tsx b/apps/web/app/(org)/dashboard/folder/[id]/components/UploadCapButtonWithFolder.tsx
new file mode 100644
index 000000000..ebb3c976c
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/UploadCapButtonWithFolder.tsx
@@ -0,0 +1,45 @@
+"use client";
+
+import { UploadCapButton } from "../../../caps/components/UploadCapButton";
+import { useRouter } from "next/navigation";
+import { useUploadingContext } from "../../../caps/UploadingContext";
+export function UploadCapButtonWithFolder({
+ folderId,
+}: {
+ folderId: string;
+}) {
+ const router = useRouter();
+ const {
+ setIsUploading,
+ setUploadingCapId,
+ setUploadingThumbnailUrl,
+ setUploadProgress
+ } = useUploadingContext();
+
+ return (
+ <UploadCapButton
+ onStart={(id, thumbnail) => {
+ setIsUploading(true);
+ setUploadingCapId(id);
+ setUploadingThumbnailUrl(thumbnail);
+ setUploadProgress(0);
+ }}
+ onProgress={(id, progress, uploadProgress) => {
+ // Update progress in the context
+ if (uploadProgress !== undefined) {
+ setUploadProgress(Math.round(uploadProgress * 100));
+ }
+ }}
+ onComplete={(id) => {
+ // Reset all uploading state
+ setIsUploading(false);
+ setUploadingCapId(null);
+ setUploadingThumbnailUrl(undefined);
+ setUploadProgress(0);
+ router.refresh();
+ }}
+ folderId={folderId}
+ size="sm"
+ />
+ );
+}
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/index.ts b/apps/web/app/(org)/dashboard/folder/[id]/components/index.ts
new file mode 100644
index 000000000..679785877
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/index.ts
@@ -0,0 +1,6 @@
+export * from "./BreadcrumbItem";
+export * from "./ClientCapCard";
+export * from "./NewSubfolderButton";
+export * from "./ClientMyCapsLink";
+export * from "./NewSubfolderButton";
+export * from "./SubfolderDialog";
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/components/useUploadPlaceholders.ts b/apps/web/app/(org)/dashboard/folder/[id]/components/useUploadPlaceholders.ts
new file mode 100644
index 000000000..c97895b33
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/components/useUploadPlaceholders.ts
@@ -0,0 +1,35 @@
+import { useCallback } from "react";
+import { useUploadContext } from "./UploadContext";
+
+export interface UploadPlaceholder {
+ id: string;
+ progress: number;
+ thumbnail?: string;
+ uploadProgress?: number;
+}
+
+export function useUploadPlaceholders() {
+ const { uploadPlaceholders, setUploadPlaceholders, isUploading } = useUploadContext();
+
+ const handleUploadStart = useCallback((id: string, thumbnail?: string) => {
+ setUploadPlaceholders((prev) => [{ id, progress: 0, thumbnail }, ...prev]);
+ }, [setUploadPlaceholders]);
+
+ const handleUploadProgress = useCallback((id: string, progress: number, uploadProgress?: number) => {
+ setUploadPlaceholders((prev) =>
+ prev.map((u) => (u.id === id ? { ...u, progress, uploadProgress } : u))
+ );
+ }, [setUploadPlaceholders]);
+
+ const handleUploadComplete = useCallback((id: string) => {
+ setUploadPlaceholders((prev) => prev.filter((u) => u.id !== id));
+ }, [setUploadPlaceholders]);
+
+ return {
+ uploadPlaceholders,
+ isUploading,
+ handleUploadStart,
+ handleUploadProgress,
+ handleUploadComplete,
+ };
+}
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/page.tsx b/apps/web/app/(org)/dashboard/folder/[id]/page.tsx
new file mode 100644
index 000000000..70e06c6b3
--- /dev/null
+++ b/apps/web/app/(org)/dashboard/folder/[id]/page.tsx
@@ -0,0 +1,78 @@
+import { ClientMyCapsLink, NewSubfolderButton, BreadcrumbItem } from "./components";
+import Folder from "../../caps/components/Folder";
+import { getFolderBreadcrumb } from "@/actions/folders/getFolderBreadcrumb";
+import { getChildFolders } from "@/actions/folders/getChildFolders";
+import { getVideosByFolderId } from "@/actions/folders/getVideosByFolderId";
+import { serverEnv } from "@cap/env";
+import { UploadCapButtonWithFolder } from "./components/UploadCapButtonWithFolder";
+import { UploadingProvider } from "../../caps/UploadingContext";
+import FolderVideosSection from "./components/FolderVideosSection";
+
+// Client component wrapper to provide the uploading context
+const ClientFolderPage = ({ children }: { children: React.ReactNode }) => {
+ return <UploadingProvider>{children}</UploadingProvider>;
+};
+
+const FolderPage = async ({ params }: { params: { id: string } }) => {
+ const [childFolders, breadcrumb, videosData] = await Promise.all([
+ getChildFolders(params.id),
+ getFolderBreadcrumb(params.id),
+ getVideosByFolderId(params.id),
+ ]);
+
+ return (
+ <ClientFolderPage>
+ <div>
+ <div className="flex gap-2 items-center mb-10">
+ <NewSubfolderButton parentFolderId={params.id} />
+ <UploadCapButtonWithFolder folderId={params.id} />
+ </div>
+ <div className="flex justify-between items-center mb-6 w-full">
+ <div className="flex overflow-x-auto items-center font-medium">
+ <ClientMyCapsLink />
+
+ {breadcrumb.map((folder, index) => (
+ <div key={folder.id} className="flex items-center">
+ <p className="mx-2 text-gray-10">/</p>
+ <BreadcrumbItem
+ id={folder.id}
+ name={folder.name}
+ color={folder.color}
+ isLast={index === breadcrumb.length - 1}
+ />
+ </div>
+ ))}
+ </div>
+ </div>
+
+ {/* Display Child Folders */}
+ {childFolders.length > 0 && (
+ <>
+ <h1 className="mb-6 text-xl font-medium text-gray-12">Subfolders</h1>
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-4 mb-10">
+ {childFolders.map((folder) => (
+ <Folder
+ key={folder.id}
+ name={folder.name}
+ color={folder.color}
+ id={folder.id}
+ parentId={folder.parentId}
+ videoCount={folder.videoCount}
+ />
+ ))}
+ </div>
+ </>
+ )}
+
+ {/* Display Videos */}
+ <FolderVideosSection
+ folderId={params.id}
+ initialVideos={videosData}
+ dubApiKeyEnabled={!!serverEnv().DUB_API_KEY}
+ />
+ </div>
+ </ClientFolderPage>
+ );
+};
+
+export default FolderPage;
diff --git a/apps/web/app/(org)/dashboard/settings/organization/components/CustomDomain.tsx b/apps/web/app/(org)/dashboard/settings/organization/components/CustomDomain.tsx
index 5a8d270a7..693ed8ef8 100644
--- a/apps/web/app/(org)/dashboard/settings/organization/components/CustomDomain.tsx
+++ b/apps/web/app/(org)/dashboard/settings/organization/components/CustomDomain.tsx
@@ -274,6 +274,7 @@ export function CustomDomain({ isOwner, showOwnerToast }: CustomDomainProps) {
<Button
type="submit"
size="sm"
+ className="px-[1.5rem]"
variant="dark"
className="px-[1.5rem]"
onClick={handleSubmit}
diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/actions.ts b/apps/web/app/(org)/dashboard/spaces/[spaceId]/actions.ts
index 1d90d7aea..42a072d25 100644
--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/actions.ts
+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/actions.ts
@@ -6,7 +6,7 @@ import { z } from "zod";
import { spaceMembers } from "@cap/database/schema";
import { getCurrentUser } from "@cap/database/auth/session";
import { nanoIdLength } from "@cap/database/helpers";
-import { eq } from "drizzle-orm";
+import { eq, inArray } from "drizzle-orm";
import { v4 as uuidv4 } from "uuid";
const addSpaceMemberSchema = z.object({
@@ -171,7 +171,7 @@ export async function setSpaceMembers(
// Insert new members if any
if (userIds.length > 0) {
const now = new Date();
- const values = userIds.map(userId => ({
+ const values = userIds.map((userId) => ({
id: uuidv4().substring(0, nanoIdLength),
spaceId,
userId,
@@ -212,10 +212,10 @@ export async function batchRemoveSpaceMembers(
const members = await db()
.select({ spaceId: spaceMembers.spaceId })
.from(spaceMembers)
- .where(spaceMembers.id.in(memberIds));
+ .where(inArray(spaceMembers.id, memberIds));
const spaceId = members[0]?.spaceId;
- await db().delete(spaceMembers).where(spaceMembers.id.in(memberIds));
+ await db().delete(spaceMembers).where(inArray(spaceMembers.id, memberIds));
if (spaceId) {
revalidatePath(`/dashboard/spaces/${spaceId}`);
}
diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css
index 5e01f6a5b..a90f6a768 100644
--- a/apps/web/app/globals.css
+++ b/apps/web/app/globals.css
@@ -527,14 +527,6 @@ label {
@apply pb-4 border-b border-filler;
}
-.dashboard-page h1,
-.dashboard-page h2,
-.dashboard-page h3,
-.dashboard-page h4,
-.dashboard-page h5 {
- @apply text-[1rem] font-medium leading-[1.25rem] text-gray-12 !important;
-}
-
.dashboard-header p {
@apply text-lg;
}
diff --git a/apps/web/components/VideoThumbnail.tsx b/apps/web/components/VideoThumbnail.tsx
index 97a74fee1..9be59339e 100644
--- a/apps/web/components/VideoThumbnail.tsx
+++ b/apps/web/components/VideoThumbnail.tsx
@@ -1,3 +1,4 @@
+import { useUploadingContext } from "@/app/(org)/dashboard/caps/UploadingContext";
import { LogoSpinner } from "@cap/ui";
import clsx from "clsx";
import Image from "next/image";
@@ -33,26 +34,41 @@ export const VideoThumbnail: React.FC<VideoThumbnailProps> = memo(
const [imageUrls, setImageUrls] = useState({ screen: "" });
const [loading, setLoading] = useState(true);
const [failed, setFailed] = useState(false);
+ const { uploadingCapId } = useUploadingContext()
useEffect(() => {
+ // Reset states when videoId changes
+ setLoading(true);
+ setFailed(false);
+
const fetchPreSignedUrls = async () => {
try {
+ // Add cache busting parameter to ensure we get fresh thumbnails
+ const cacheBuster = new Date().getTime();
const response = await fetch(
- `/api/thumbnail?userId=${userId}&videoId=${videoId}`
+ `/api/thumbnail?userId=${userId}&videoId=${videoId}&t=${cacheBuster}`
);
if (response.ok) {
const data = await response.json();
- setImageUrls({ screen: data.screen });
+ // Add cache busting to the thumbnail URL as well
+ setImageUrls({ screen: `${data.screen}${data.screen.includes('?') ? '&' : '?'}t=${cacheBuster}` });
} else {
console.error("Failed to fetch pre-signed URLs");
+ setFailed(true);
}
} catch (error) {
console.error("Error fetching pre-signed URLs:", error);
+ setFailed(true);
+ } finally {
+ // If we couldn't fetch the URL, we should stop showing the spinner
+ if (!imageUrls.screen) {
+ setLoading(false);
+ }
}
};
fetchPreSignedUrls();
- }, [userId, videoId]);
+ }, [userId, videoId, uploadingCapId]);
const randomGradient = `linear-gradient(to right, ${generateRandomGrayScaleColor()}, ${generateRandomGrayScaleColor()})`;
@@ -78,9 +94,11 @@ export const VideoThumbnail: React.FC<VideoThumbnailProps> = memo(
{imageUrls.screen && (
<Image
src={imageUrls.screen}
- layout="fill"
+ fill={true}
+ sizes="(max-width: 768px) 100vw, 33vw"
alt={alt}
- objectFit={objectFit}
+ key={videoId}
+ style={{ objectFit: objectFit as any }}
className={clsx("w-full h-full", imageClass)}
onLoad={() => setLoading(false)}
onError={() => {
diff --git a/apps/web/public/rive/dashboard.riv b/apps/web/public/rive/dashboard.riv
new file mode 100644
index 000000000..fd7ca6bf3
Binary files /dev/null and b/apps/web/public/rive/dashboard.riv differ
diff --git a/packages/database/migrations/0003_outstanding_kylun.sql b/packages/database/migrations/0003_outstanding_kylun.sql
new file mode 100644
index 000000000..660026119
--- /dev/null
+++ b/packages/database/migrations/0003_outstanding_kylun.sql
@@ -0,0 +1,16 @@
+CREATE TABLE `folders` (
+ `id` varchar(15) NOT NULL,
+ `name` varchar(255) NOT NULL,
+ `color` varchar(16) NOT NULL DEFAULT 'normal',
+ `organizationId` varchar(15) NOT NULL,
+ `createdById` varchar(15) NOT NULL,
+ `createdAt` timestamp NOT NULL DEFAULT (now()),
+ `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
+ CONSTRAINT `folders_id` PRIMARY KEY(`id`),
+ CONSTRAINT `folders_id_unique` UNIQUE(`id`)
+);
+--> statement-breakpoint
+ALTER TABLE `videos` ADD `folderId` varchar(15);--> statement-breakpoint
+CREATE INDEX `organization_id_idx` ON `folders` (`organizationId`);--> statement-breakpoint
+CREATE INDEX `created_by_id_idx` ON `folders` (`createdById`);--> statement-breakpoint
+CREATE INDEX `folder_id_idx` ON `videos` (`folderId`);
\ No newline at end of file
diff --git a/packages/database/migrations/0004_optimal_eddie_brock.sql b/packages/database/migrations/0004_optimal_eddie_brock.sql
new file mode 100644
index 000000000..a88cbecb7
--- /dev/null
+++ b/packages/database/migrations/0004_optimal_eddie_brock.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `folders` ADD `parentId` varchar(15);--> statement-breakpoint
+CREATE INDEX `parent_id_idx` ON `folders` (`parentId`);
\ No newline at end of file
diff --git a/packages/database/migrations/20250704_add_videos_folderid_on_delete_set_null.sql b/packages/database/migrations/20250704_add_videos_folderid_on_delete_set_null.sql
new file mode 100644
index 000000000..cb83f541e
--- /dev/null
+++ b/packages/database/migrations/20250704_add_videos_folderid_on_delete_set_null.sql
@@ -0,0 +1,5 @@
+-- Add foreign key constraint to videos.folderId referencing folders.id with ON DELETE SET NULL
+ALTER TABLE videos
+ ADD CONSTRAINT fk_folder
+ FOREIGN KEY (folderId) REFERENCES folders(id)
+ ON DELETE SET NULL;
diff --git a/packages/database/migrations/meta/0003_snapshot.json b/packages/database/migrations/meta/0003_snapshot.json
new file mode 100644
index 000000000..da79ce26f
--- /dev/null
+++ b/packages/database/migrations/meta/0003_snapshot.json
@@ -0,0 +1,1742 @@
+{
+ "version": "5",
+ "dialect": "mysql",
+ "id": "eec68218-19f8-4f8a-a7c4-5986f26dbb52",
+ "prevId": "34547a7f-467f-4213-af17-84b26feef022",
+ "tables": {
+ "accounts": {
+ "name": "accounts",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_in": {
+ "name": "expires_in",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "refresh_token_expires_in": {
+ "name": "refresh_token_expires_in",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "tempColumn": {
+ "name": "tempColumn",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "provider_account_id_idx": {
+ "name": "provider_account_id_idx",
+ "columns": [
+ "providerAccountId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "accounts_id": {
+ "name": "accounts_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "accounts_id_unique": {
+ "name": "accounts_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "auth_api_keys": {
+ "name": "auth_api_keys",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(36)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "auth_api_keys_id": {
+ "name": "auth_api_keys_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "auth_api_keys_id_unique": {
+ "name": "auth_api_keys_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "comments": {
+ "name": "comments",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(6)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "float",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "authorId": {
+ "name": "authorId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "videoId": {
+ "name": "videoId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "parentCommentId": {
+ "name": "parentCommentId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "video_id_idx": {
+ "name": "video_id_idx",
+ "columns": [
+ "videoId"
+ ],
+ "isUnique": false
+ },
+ "author_id_idx": {
+ "name": "author_id_idx",
+ "columns": [
+ "authorId"
+ ],
+ "isUnique": false
+ },
+ "parent_comment_id_idx": {
+ "name": "parent_comment_id_idx",
+ "columns": [
+ "parentCommentId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "comments_id": {
+ "name": "comments_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "comments_id_unique": {
+ "name": "comments_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "folders": {
+ "name": "folders",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "varchar(16)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'normal'"
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdById": {
+ "name": "createdById",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "created_by_id_idx": {
+ "name": "created_by_id_idx",
+ "columns": [
+ "createdById"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "folders_id": {
+ "name": "folders_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "folders_id_unique": {
+ "name": "folders_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "organization_invites": {
+ "name": "organization_invites",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "invitedEmail": {
+ "name": "invitedEmail",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "invitedByUserId": {
+ "name": "invitedByUserId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "invited_email_idx": {
+ "name": "invited_email_idx",
+ "columns": [
+ "invitedEmail"
+ ],
+ "isUnique": false
+ },
+ "invited_by_user_id_idx": {
+ "name": "invited_by_user_id_idx",
+ "columns": [
+ "invitedByUserId"
+ ],
+ "isUnique": false
+ },
+ "status_idx": {
+ "name": "status_idx",
+ "columns": [
+ "status"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "organization_invites_id": {
+ "name": "organization_invites_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "organization_invites_id_unique": {
+ "name": "organization_invites_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "organization_members": {
+ "name": "organization_members",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "user_id_organization_id_idx": {
+ "name": "user_id_organization_id_idx",
+ "columns": [
+ "userId",
+ "organizationId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "organization_members_id": {
+ "name": "organization_members_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "organization_members_id_unique": {
+ "name": "organization_members_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "organizations": {
+ "name": "organizations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "allowedEmailDomain": {
+ "name": "allowedEmailDomain",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "customDomain": {
+ "name": "customDomain",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "domainVerified": {
+ "name": "domainVerified",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "iconUrl": {
+ "name": "iconUrl",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "workosOrganizationId": {
+ "name": "workosOrganizationId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workosConnectionId": {
+ "name": "workosConnectionId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "owner_id_idx": {
+ "name": "owner_id_idx",
+ "columns": [
+ "ownerId"
+ ],
+ "isUnique": false
+ },
+ "custom_domain_idx": {
+ "name": "custom_domain_idx",
+ "columns": [
+ "customDomain"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "organizations_id": {
+ "name": "organizations_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "organizations_id_unique": {
+ "name": "organizations_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "s3_buckets": {
+ "name": "s3_buckets",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "region": {
+ "name": "region",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "endpoint": {
+ "name": "endpoint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bucketName": {
+ "name": "bucketName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "accessKeyId": {
+ "name": "accessKeyId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "secretAccessKey": {
+ "name": "secretAccessKey",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('aws')"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "s3_buckets_id": {
+ "name": "s3_buckets_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "s3_buckets_id_unique": {
+ "name": "s3_buckets_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "sessions": {
+ "name": "sessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sessionToken": {
+ "name": "sessionToken",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "session_token_idx": {
+ "name": "session_token_idx",
+ "columns": [
+ "sessionToken"
+ ],
+ "isUnique": true
+ },
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "sessions_id": {
+ "name": "sessions_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "sessions_id_unique": {
+ "name": "sessions_id_unique",
+ "columns": [
+ "id"
+ ]
+ },
+ "sessions_sessionToken_unique": {
+ "name": "sessions_sessionToken_unique",
+ "columns": [
+ "sessionToken"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "shared_videos": {
+ "name": "shared_videos",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "videoId": {
+ "name": "videoId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sharedByUserId": {
+ "name": "sharedByUserId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sharedAt": {
+ "name": "sharedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "video_id_idx": {
+ "name": "video_id_idx",
+ "columns": [
+ "videoId"
+ ],
+ "isUnique": false
+ },
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "shared_by_user_id_idx": {
+ "name": "shared_by_user_id_idx",
+ "columns": [
+ "sharedByUserId"
+ ],
+ "isUnique": false
+ },
+ "video_id_organization_id_idx": {
+ "name": "video_id_organization_id_idx",
+ "columns": [
+ "videoId",
+ "organizationId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "shared_videos_id": {
+ "name": "shared_videos_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "shared_videos_id_unique": {
+ "name": "shared_videos_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "space_members": {
+ "name": "space_members",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'member'"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "space_id_idx": {
+ "name": "space_id_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "space_id_user_id_idx": {
+ "name": "space_id_user_id_idx",
+ "columns": [
+ "spaceId",
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "space_members_id": {
+ "name": "space_members_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "space_members_id_unique": {
+ "name": "space_members_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "space_videos": {
+ "name": "space_videos",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "videoId": {
+ "name": "videoId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "addedById": {
+ "name": "addedById",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "addedAt": {
+ "name": "addedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "space_id_idx": {
+ "name": "space_id_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "video_id_idx": {
+ "name": "video_id_idx",
+ "columns": [
+ "videoId"
+ ],
+ "isUnique": false
+ },
+ "added_by_id_idx": {
+ "name": "added_by_id_idx",
+ "columns": [
+ "addedById"
+ ],
+ "isUnique": false
+ },
+ "space_id_video_id_idx": {
+ "name": "space_id_video_id_idx",
+ "columns": [
+ "spaceId",
+ "videoId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "space_videos_id": {
+ "name": "space_videos_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "space_videos_id_unique": {
+ "name": "space_videos_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "spaces": {
+ "name": "spaces",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "primary": {
+ "name": "primary",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdById": {
+ "name": "createdById",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "iconUrl": {
+ "name": "iconUrl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(1000)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "privacy": {
+ "name": "privacy",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'Private'"
+ }
+ },
+ "indexes": {
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "created_by_id_idx": {
+ "name": "created_by_id_idx",
+ "columns": [
+ "createdById"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "spaces_id": {
+ "name": "spaces_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "spaces_id_unique": {
+ "name": "spaces_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "users": {
+ "name": "users",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lastName": {
+ "name": "lastName",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "stripeCustomerId": {
+ "name": "stripeCustomerId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "stripeSubscriptionId": {
+ "name": "stripeSubscriptionId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "thirdPartyStripeSubscriptionId": {
+ "name": "thirdPartyStripeSubscriptionId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "stripeSubscriptionStatus": {
+ "name": "stripeSubscriptionStatus",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "stripeSubscriptionPriceId": {
+ "name": "stripeSubscriptionPriceId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "activeOrganizationId": {
+ "name": "activeOrganizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "onboarding_completed_at": {
+ "name": "onboarding_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "customBucket": {
+ "name": "customBucket",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inviteQuota": {
+ "name": "inviteQuota",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ }
+ },
+ "indexes": {
+ "email_idx": {
+ "name": "email_idx",
+ "columns": [
+ "email"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "users_id": {
+ "name": "users_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "users_id_unique": {
+ "name": "users_id_unique",
+ "columns": [
+ "id"
+ ]
+ },
+ "users_email_unique": {
+ "name": "users_email_unique",
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "verification_tokens": {
+ "name": "verification_tokens",
+ "columns": {
+ "identifier": {
+ "name": "identifier",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "verification_tokens_identifier": {
+ "name": "verification_tokens_identifier",
+ "columns": [
+ "identifier"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "verification_tokens_token_unique": {
+ "name": "verification_tokens_token_unique",
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "videos": {
+ "name": "videos",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'My Video'"
+ },
+ "awsRegion": {
+ "name": "awsRegion",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "awsBucket": {
+ "name": "awsBucket",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bucket": {
+ "name": "bucket",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "public": {
+ "name": "public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "videoStartTime": {
+ "name": "videoStartTime",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "audioStartTime": {
+ "name": "audioStartTime",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "xStreamInfo": {
+ "name": "xStreamInfo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "jobId": {
+ "name": "jobId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "jobStatus": {
+ "name": "jobStatus",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "isScreenshot": {
+ "name": "isScreenshot",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "skipProcessing": {
+ "name": "skipProcessing",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "transcriptionStatus": {
+ "name": "transcriptionStatus",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "source": {
+ "name": "source",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('{\"type\":\"MediaConvert\"}')"
+ },
+ "folderId": {
+ "name": "folderId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "id_idx": {
+ "name": "id_idx",
+ "columns": [
+ "id"
+ ],
+ "isUnique": false
+ },
+ "owner_id_idx": {
+ "name": "owner_id_idx",
+ "columns": [
+ "ownerId"
+ ],
+ "isUnique": false
+ },
+ "is_public_idx": {
+ "name": "is_public_idx",
+ "columns": [
+ "public"
+ ],
+ "isUnique": false
+ },
+ "folder_id_idx": {
+ "name": "folder_id_idx",
+ "columns": [
+ "folderId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "videos_id": {
+ "name": "videos_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "videos_id_unique": {
+ "name": "videos_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ }
+ },
+ "views": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "tables": {},
+ "indexes": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/database/migrations/meta/0004_snapshot.json b/packages/database/migrations/meta/0004_snapshot.json
new file mode 100644
index 000000000..08de4a02b
--- /dev/null
+++ b/packages/database/migrations/meta/0004_snapshot.json
@@ -0,0 +1,1756 @@
+{
+ "version": "5",
+ "dialect": "mysql",
+ "id": "49ce971d-dbc0-4954-80d1-15c0ede03235",
+ "prevId": "eec68218-19f8-4f8a-a7c4-5986f26dbb52",
+ "tables": {
+ "accounts": {
+ "name": "accounts",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_in": {
+ "name": "expires_in",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "refresh_token_expires_in": {
+ "name": "refresh_token_expires_in",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "tempColumn": {
+ "name": "tempColumn",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "provider_account_id_idx": {
+ "name": "provider_account_id_idx",
+ "columns": [
+ "providerAccountId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "accounts_id": {
+ "name": "accounts_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "accounts_id_unique": {
+ "name": "accounts_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "auth_api_keys": {
+ "name": "auth_api_keys",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(36)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "auth_api_keys_id": {
+ "name": "auth_api_keys_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "auth_api_keys_id_unique": {
+ "name": "auth_api_keys_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "comments": {
+ "name": "comments",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(6)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "float",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "authorId": {
+ "name": "authorId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "videoId": {
+ "name": "videoId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "parentCommentId": {
+ "name": "parentCommentId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "video_id_idx": {
+ "name": "video_id_idx",
+ "columns": [
+ "videoId"
+ ],
+ "isUnique": false
+ },
+ "author_id_idx": {
+ "name": "author_id_idx",
+ "columns": [
+ "authorId"
+ ],
+ "isUnique": false
+ },
+ "parent_comment_id_idx": {
+ "name": "parent_comment_id_idx",
+ "columns": [
+ "parentCommentId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "comments_id": {
+ "name": "comments_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "comments_id_unique": {
+ "name": "comments_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "folders": {
+ "name": "folders",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "varchar(16)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'normal'"
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdById": {
+ "name": "createdById",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "parentId": {
+ "name": "parentId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "created_by_id_idx": {
+ "name": "created_by_id_idx",
+ "columns": [
+ "createdById"
+ ],
+ "isUnique": false
+ },
+ "parent_id_idx": {
+ "name": "parent_id_idx",
+ "columns": [
+ "parentId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "folders_id": {
+ "name": "folders_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "folders_id_unique": {
+ "name": "folders_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "organization_invites": {
+ "name": "organization_invites",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "invitedEmail": {
+ "name": "invitedEmail",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "invitedByUserId": {
+ "name": "invitedByUserId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "invited_email_idx": {
+ "name": "invited_email_idx",
+ "columns": [
+ "invitedEmail"
+ ],
+ "isUnique": false
+ },
+ "invited_by_user_id_idx": {
+ "name": "invited_by_user_id_idx",
+ "columns": [
+ "invitedByUserId"
+ ],
+ "isUnique": false
+ },
+ "status_idx": {
+ "name": "status_idx",
+ "columns": [
+ "status"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "organization_invites_id": {
+ "name": "organization_invites_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "organization_invites_id_unique": {
+ "name": "organization_invites_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "organization_members": {
+ "name": "organization_members",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "user_id_organization_id_idx": {
+ "name": "user_id_organization_id_idx",
+ "columns": [
+ "userId",
+ "organizationId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "organization_members_id": {
+ "name": "organization_members_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "organization_members_id_unique": {
+ "name": "organization_members_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "organizations": {
+ "name": "organizations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "allowedEmailDomain": {
+ "name": "allowedEmailDomain",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "customDomain": {
+ "name": "customDomain",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "domainVerified": {
+ "name": "domainVerified",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "iconUrl": {
+ "name": "iconUrl",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "workosOrganizationId": {
+ "name": "workosOrganizationId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workosConnectionId": {
+ "name": "workosConnectionId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "owner_id_idx": {
+ "name": "owner_id_idx",
+ "columns": [
+ "ownerId"
+ ],
+ "isUnique": false
+ },
+ "custom_domain_idx": {
+ "name": "custom_domain_idx",
+ "columns": [
+ "customDomain"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "organizations_id": {
+ "name": "organizations_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "organizations_id_unique": {
+ "name": "organizations_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "s3_buckets": {
+ "name": "s3_buckets",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "region": {
+ "name": "region",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "endpoint": {
+ "name": "endpoint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bucketName": {
+ "name": "bucketName",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "accessKeyId": {
+ "name": "accessKeyId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "secretAccessKey": {
+ "name": "secretAccessKey",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('aws')"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "s3_buckets_id": {
+ "name": "s3_buckets_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "s3_buckets_id_unique": {
+ "name": "s3_buckets_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "sessions": {
+ "name": "sessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sessionToken": {
+ "name": "sessionToken",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "session_token_idx": {
+ "name": "session_token_idx",
+ "columns": [
+ "sessionToken"
+ ],
+ "isUnique": true
+ },
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "sessions_id": {
+ "name": "sessions_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "sessions_id_unique": {
+ "name": "sessions_id_unique",
+ "columns": [
+ "id"
+ ]
+ },
+ "sessions_sessionToken_unique": {
+ "name": "sessions_sessionToken_unique",
+ "columns": [
+ "sessionToken"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "shared_videos": {
+ "name": "shared_videos",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "videoId": {
+ "name": "videoId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sharedByUserId": {
+ "name": "sharedByUserId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sharedAt": {
+ "name": "sharedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "video_id_idx": {
+ "name": "video_id_idx",
+ "columns": [
+ "videoId"
+ ],
+ "isUnique": false
+ },
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "shared_by_user_id_idx": {
+ "name": "shared_by_user_id_idx",
+ "columns": [
+ "sharedByUserId"
+ ],
+ "isUnique": false
+ },
+ "video_id_organization_id_idx": {
+ "name": "video_id_organization_id_idx",
+ "columns": [
+ "videoId",
+ "organizationId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "shared_videos_id": {
+ "name": "shared_videos_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "shared_videos_id_unique": {
+ "name": "shared_videos_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "space_members": {
+ "name": "space_members",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'member'"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "space_id_idx": {
+ "name": "space_id_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "space_id_user_id_idx": {
+ "name": "space_id_user_id_idx",
+ "columns": [
+ "spaceId",
+ "userId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "space_members_id": {
+ "name": "space_members_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "space_members_id_unique": {
+ "name": "space_members_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "space_videos": {
+ "name": "space_videos",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "videoId": {
+ "name": "videoId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "addedById": {
+ "name": "addedById",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "addedAt": {
+ "name": "addedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ }
+ },
+ "indexes": {
+ "space_id_idx": {
+ "name": "space_id_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "video_id_idx": {
+ "name": "video_id_idx",
+ "columns": [
+ "videoId"
+ ],
+ "isUnique": false
+ },
+ "added_by_id_idx": {
+ "name": "added_by_id_idx",
+ "columns": [
+ "addedById"
+ ],
+ "isUnique": false
+ },
+ "space_id_video_id_idx": {
+ "name": "space_id_video_id_idx",
+ "columns": [
+ "spaceId",
+ "videoId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "space_videos_id": {
+ "name": "space_videos_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "space_videos_id_unique": {
+ "name": "space_videos_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "spaces": {
+ "name": "spaces",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "primary": {
+ "name": "primary",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdById": {
+ "name": "createdById",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "iconUrl": {
+ "name": "iconUrl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(1000)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "privacy": {
+ "name": "privacy",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'Private'"
+ }
+ },
+ "indexes": {
+ "organization_id_idx": {
+ "name": "organization_id_idx",
+ "columns": [
+ "organizationId"
+ ],
+ "isUnique": false
+ },
+ "created_by_id_idx": {
+ "name": "created_by_id_idx",
+ "columns": [
+ "createdById"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "spaces_id": {
+ "name": "spaces_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "spaces_id_unique": {
+ "name": "spaces_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "users": {
+ "name": "users",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lastName": {
+ "name": "lastName",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "stripeCustomerId": {
+ "name": "stripeCustomerId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "stripeSubscriptionId": {
+ "name": "stripeSubscriptionId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "thirdPartyStripeSubscriptionId": {
+ "name": "thirdPartyStripeSubscriptionId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "stripeSubscriptionStatus": {
+ "name": "stripeSubscriptionStatus",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "stripeSubscriptionPriceId": {
+ "name": "stripeSubscriptionPriceId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "activeOrganizationId": {
+ "name": "activeOrganizationId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "onboarding_completed_at": {
+ "name": "onboarding_completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "customBucket": {
+ "name": "customBucket",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inviteQuota": {
+ "name": "inviteQuota",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ }
+ },
+ "indexes": {
+ "email_idx": {
+ "name": "email_idx",
+ "columns": [
+ "email"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "users_id": {
+ "name": "users_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "users_id_unique": {
+ "name": "users_id_unique",
+ "columns": [
+ "id"
+ ]
+ },
+ "users_email_unique": {
+ "name": "users_email_unique",
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "verification_tokens": {
+ "name": "verification_tokens",
+ "columns": {
+ "identifier": {
+ "name": "identifier",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "verification_tokens_identifier": {
+ "name": "verification_tokens_identifier",
+ "columns": [
+ "identifier"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "verification_tokens_token_unique": {
+ "name": "verification_tokens_token_unique",
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "videos": {
+ "name": "videos",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'My Video'"
+ },
+ "awsRegion": {
+ "name": "awsRegion",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "awsBucket": {
+ "name": "awsBucket",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bucket": {
+ "name": "bucket",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "public": {
+ "name": "public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "videoStartTime": {
+ "name": "videoStartTime",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "audioStartTime": {
+ "name": "audioStartTime",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "xStreamInfo": {
+ "name": "xStreamInfo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "jobId": {
+ "name": "jobId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "jobStatus": {
+ "name": "jobStatus",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "isScreenshot": {
+ "name": "isScreenshot",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "skipProcessing": {
+ "name": "skipProcessing",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "transcriptionStatus": {
+ "name": "transcriptionStatus",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "onUpdate": true,
+ "default": "(now())"
+ },
+ "source": {
+ "name": "source",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('{\"type\":\"MediaConvert\"}')"
+ },
+ "folderId": {
+ "name": "folderId",
+ "type": "varchar(15)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "id_idx": {
+ "name": "id_idx",
+ "columns": [
+ "id"
+ ],
+ "isUnique": false
+ },
+ "owner_id_idx": {
+ "name": "owner_id_idx",
+ "columns": [
+ "ownerId"
+ ],
+ "isUnique": false
+ },
+ "is_public_idx": {
+ "name": "is_public_idx",
+ "columns": [
+ "public"
+ ],
+ "isUnique": false
+ },
+ "folder_id_idx": {
+ "name": "folder_id_idx",
+ "columns": [
+ "folderId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "videos_id": {
+ "name": "videos_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "videos_id_unique": {
+ "name": "videos_id_unique",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ }
+ },
+ "views": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "tables": {},
+ "indexes": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.json
index 15c834fb8..faaa038cb 100644
--- a/packages/database/migrations/meta/_journal.json
+++ b/packages/database/migrations/meta/_journal.json
@@ -22,6 +22,20 @@
"when": 1750935538683,
"tag": "0002_dusty_maginty",
"breakpoints": true
+ },
+ {
+ "idx": 3,
+ "version": "5",
+ "when": 1751274435418,
+ "tag": "0003_outstanding_kylun",
+ "breakpoints": true
+ },
+ {
+ "idx": 4,
+ "version": "5",
+ "when": 1751299325634,
+ "tag": "0004_optimal_eddie_brock",
+ "breakpoints": true
}
]
-}
+}
\ No newline at end of file
diff --git a/packages/database/schema.ts b/packages/database/schema.ts
index ccee6f775..d7b2a3dc3 100644
--- a/packages/database/schema.ts
+++ b/packages/database/schema.ts
@@ -191,6 +191,25 @@ export const organizationInvites = mysqlTable(
})
);
+export const folders = mysqlTable(
+ "folders",
+ {
+ id: nanoId("id").notNull().primaryKey().unique(),
+ name: varchar("name", { length: 255 }).notNull(),
+ color: varchar("color", { length: 16, enum: ["normal", "blue", "red", "yellow"] }).notNull().default("normal"),
+ organizationId: nanoId("organizationId").notNull(),
+ createdById: nanoId("createdById").notNull(),
+ parentId: nanoIdNullable("parentId"),
+ createdAt: timestamp("createdAt").notNull().defaultNow(),
+ updatedAt: timestamp("updatedAt").notNull().defaultNow().onUpdateNow(),
+ },
+ (table) => ({
+ organizationIdIndex: index("organization_id_idx").on(table.organizationId),
+ createdByIdIndex: index("created_by_id_idx").on(table.createdById),
+ parentIdIndex: index("parent_id_idx").on(table.parentId),
+ })
+);
+
export const videos = mysqlTable(
"videos",
{
@@ -220,11 +239,13 @@ export const videos = mysqlTable(
>()
.notNull()
.default({ type: "MediaConvert" }),
+ folderId: nanoIdNullable("folderId"),
},
(table) => ({
idIndex: index("id_idx").on(table.id),
ownerIdIndex: index("owner_id_idx").on(table.ownerId),
publicIndex: index("is_public_idx").on(table.public),
+ folderIdIndex: index("folder_id_idx").on(table.folderId),
})
);
@@ -394,6 +415,10 @@ export const videosRelations = relations(videos, ({ one, many }) => ({
}),
sharedVideos: many(sharedVideos),
spaceVideos: many(spaceVideos),
+ folder: one(folders, {
+ fields: [videos.folderId],
+ references: [folders.id],
+ }),
}));
export const sharedVideosRelations = relations(sharedVideos, ({ one }) => ({
@@ -411,6 +436,8 @@ export const sharedVideosRelations = relations(sharedVideos, ({ one }) => ({
}),
}));
+
+
export const spaces = mysqlTable(
"spaces",
{
@@ -511,3 +538,21 @@ export const spaceVideosRelations = relations(spaceVideos, ({ one }) => ({
references: [users.id],
}),
}));
+
+export const foldersRelations = relations(folders, ({ one, many }) => ({
+ organization: one(organizations, {
+ fields: [folders.organizationId],
+ references: [organizations.id],
+ }),
+ createdBy: one(users, {
+ fields: [folders.createdById],
+ references: [users.id],
+ }),
+ parentFolder: one(folders, {
+ fields: [folders.parentId],
+ references: [folders.id],
+ relationName: "parentChild"
+ }),
+ childFolders: many(folders, { relationName: "parentChild" }),
+ videos: many(videos),
+}));
diff --git a/packages/ui/src/components/Card.tsx b/packages/ui/src/components/Card.tsx
index c30869cda..139a61d78 100644
--- a/packages/ui/src/components/Card.tsx
+++ b/packages/ui/src/components/Card.tsx
@@ -9,7 +9,7 @@ const Card = forwardRef<
ref={ref}
className={classNames(
!noStyle &&
- "border p-5 bg-gray-1 rounded-2xl border-gray-3 text-card-foreground",
+ "border p-5 bg-gray-1 rounded-2xl border-gray-3 text-card-foreground",
className
)}
{...props}
@@ -36,7 +36,7 @@ const CardTitle = forwardRef<
<h3
ref={ref}
className={classNames(
- "text-lg font-semibold tracking-tight leading-none",
+ "text-lg font-semibold tracking-tight leading-none text-gray-12",
className
)}
{...props}