Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

move provider (#733)

Ameer Al Ashhab69e3ad9582ae
diff --git a/apps/web/app/(org)/dashboard/caps/page.tsx b/apps/web/app/(org)/dashboard/caps/page.tsx
index f41bb5d2e..7c30fabc8 100644
--- a/apps/web/app/(org)/dashboard/caps/page.tsx
+++ b/apps/web/app/(org)/dashboard/caps/page.tsx
@@ -11,12 +11,6 @@ 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",
@@ -219,15 +213,13 @@ export default async function CapsPage({
});
return (
- <ClientCapsPage>
- <Caps
- data={processedVideoData}
- folders={foldersData}
- 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}
+ />
);
}
diff --git a/apps/web/app/(org)/dashboard/folder/[id]/page.tsx b/apps/web/app/(org)/dashboard/folder/[id]/page.tsx
index 70e06c6b3..22b93310d 100644
--- a/apps/web/app/(org)/dashboard/folder/[id]/page.tsx
+++ b/apps/web/app/(org)/dashboard/folder/[id]/page.tsx
@@ -5,13 +5,8 @@ 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([
@@ -21,57 +16,57 @@ const FolderPage = async ({ params }: { params: { id: string } }) => {
]);
return (
- <ClientFolderPage>
- <div>
- <div className="flex gap-2 items-center mb-10">
- <NewSubfolderButton parentFolderId={params.id} />
- <UploadCapButtonWithFolder folderId={params.id} />
+
+ <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 className="flex justify-between items-center mb-6 w-full">
- <div className="flex overflow-x-auto items-center font-medium">
- <ClientMyCapsLink />
+ </div>
- {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>
+ {/* 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>
- </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>
- {/* Display Videos */}
- <FolderVideosSection
- folderId={params.id}
- initialVideos={videosData}
- dubApiKeyEnabled={!!serverEnv().DUB_API_KEY}
- />
- </div>
- </ClientFolderPage>
);
};
diff --git a/apps/web/app/(org)/dashboard/layout.tsx b/apps/web/app/(org)/dashboard/layout.tsx
index a95e2b6f2..64c97a0da 100644
--- a/apps/web/app/(org)/dashboard/layout.tsx
+++ b/apps/web/app/(org)/dashboard/layout.tsx
@@ -9,6 +9,7 @@ import DesktopNav from "./_components/Navbar/Desktop";
import MobileNav from "./_components/Navbar/Mobile";
export const dynamic = "force-dynamic";
+import { UploadingProvider } from "./caps/UploadingContext";
export default async function DashboardLayout({
children,
@@ -54,26 +55,28 @@ export default async function DashboardLayout({
const sidebar = cookies().get("sidebarCollapsed")?.value ?? "false";
return (
- <DashboardContexts
- organizationData={organizationSelect}
- activeOrganization={activeOrganization || null}
- spacesData={spacesData}
- user={user}
- isSubscribed={isSubscribed}
- initialTheme={theme as "light" | "dark"}
- initialSidebarCollapsed={sidebar === "true"}
- >
- <div className="grid grid-cols-[auto,1fr] overflow-y-auto bg-gray-1 grid-rows-[auto,1fr] h-dvh min-h-dvh">
- <aside className="z-10 col-span-1 row-span-2">
- <DesktopNav />
- </aside>
- <div className="flex col-span-1 row-span-2 h-full custom-scroll focus:outline-none">
- <MobileNav />
- <div className="dashboard-page">
- <DashboardInner>{children}</DashboardInner>
+ <UploadingProvider>
+ <DashboardContexts
+ organizationData={organizationSelect}
+ activeOrganization={activeOrganization || null}
+ spacesData={spacesData}
+ user={user}
+ isSubscribed={isSubscribed}
+ initialTheme={theme as "light" | "dark"}
+ initialSidebarCollapsed={sidebar === "true"}
+ >
+ <div className="grid grid-cols-[auto,1fr] overflow-y-auto bg-gray-1 grid-rows-[auto,1fr] h-dvh min-h-dvh">
+ <aside className="z-10 col-span-1 row-span-2">
+ <DesktopNav />
+ </aside>
+ <div className="flex col-span-1 row-span-2 h-full custom-scroll focus:outline-none">
+ <MobileNav />
+ <div className="dashboard-page">
+ <DashboardInner>{children}</DashboardInner>
+ </div>
</div>
</div>
- </div>
- </DashboardContexts>
+ </DashboardContexts>
+ </UploadingProvider>
);
}