Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: Implement Million.js

Richie McIlroy6dba38c65c07
diff --git a/apps/web/app/dashboard/caps/page.tsx b/apps/web/app/dashboard/caps/page.tsx
index b5323cc57..018a7e6be 100644
--- a/apps/web/app/dashboard/caps/page.tsx
+++ b/apps/web/app/dashboard/caps/page.tsx
@@ -1,10 +1,8 @@
-import "server-only";
+"use server";
import { Caps } from "./Caps";
import { DashboardTemplate } from "@/components/templates/DashboardTemplate";
import { createSupabaseServerClient } from "@/utils/database/supabase/server";
-export const revalidate = 0;
-
type Props = {
params: { [key: string]: string | string[] | undefined };
};
diff --git a/apps/web/app/dashboard/layout.tsx b/apps/web/app/dashboard/layout.tsx
index 61aac2b18..55d2e9659 100644
--- a/apps/web/app/dashboard/layout.tsx
+++ b/apps/web/app/dashboard/layout.tsx
@@ -1,4 +1,4 @@
-import "server-only";
+"use server";
import DynamicSharedLayout from "@/app/dashboard/_components/DynamicSharedLayout";
import {
createSupabaseServerClient,
@@ -8,8 +8,6 @@ import {
import SupabaseProvider from "@/utils/database/supabase/provider";
import SupabaseListener from "@/utils/database/supabase/listener";
-export const revalidate = 0;
-
export default async function DashboardLayout({
children,
}: {
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx
index 5426b78c4..b6b37c3e3 100644
--- a/apps/web/app/layout.tsx
+++ b/apps/web/app/layout.tsx
@@ -49,6 +49,11 @@ export default async function RootLayout({
{children}
<Footer />
</main>
+ <script
+ defer
+ data-domain="cap.so"
+ src="https://plausible.io/js/script.js"
+ ></script>
</body>
</html>
);
diff --git a/apps/web/app/login/page.tsx b/apps/web/app/login/page.tsx
index 01f0a83d6..3228ebf80 100644
--- a/apps/web/app/login/page.tsx
+++ b/apps/web/app/login/page.tsx
@@ -2,18 +2,28 @@
import { useSupabase } from "@/utils/database/supabase/provider";
import { LogoBadge } from "@cap/ui";
-import { Auth } from "@supabase/auth-ui-react";
+import dynamic from "next/dynamic";
+const Auth = dynamic(
+ () => import("@supabase/auth-ui-react").then((mod) => mod.Auth),
+ {
+ ssr: false,
+ }
+);
import { ThemeSupa } from "@supabase/auth-ui-shared";
import { useRouter } from "next/navigation";
import { supabase } from "@/utils/database/supabase/client";
+import { useEffect } from "react";
export default function AuthUI() {
- const { session } = useSupabase();
+ const supabaseHelper = useSupabase();
const router = useRouter();
- if (session) {
- router.replace("/dashboard/caps");
- }
+ useEffect(() => {
+ const session = supabaseHelper?.session;
+ if (session && typeof window !== "undefined") {
+ router.replace("/dashboard/caps");
+ }
+ }, [supabaseHelper?.session, router]);
return (
<div>
diff --git a/apps/web/app/share/[videoId]/Share.tsx b/apps/web/app/share/[videoId]/Share.tsx
index 2e2389574..52b1df37f 100644
--- a/apps/web/app/share/[videoId]/Share.tsx
+++ b/apps/web/app/share/[videoId]/Share.tsx
@@ -1,9 +1,7 @@
"use client";
-import { Button } from "@cap/ui";
import type { Database } from "@cap/utils";
-import { classNames } from "../../../../../packages/ui/src/utils/helpers";
-export const Share = ({
+export const Share = async ({
data,
}: {
data: Database["public"]["Tables"]["videos"]["Row"] | null;
diff --git a/apps/web/app/share/[videoId]/page.tsx b/apps/web/app/share/[videoId]/page.tsx
index be1a591e4..e8a302b9b 100644
--- a/apps/web/app/share/[videoId]/page.tsx
+++ b/apps/web/app/share/[videoId]/page.tsx
@@ -1,10 +1,8 @@
-import "server-only";
+"use server";
import { Share } from "./Share";
import { createSupabaseServerClient } from "@/utils/database/supabase/server";
import { uuidFormat } from "@cap/utils";
-export const revalidate = 0;
-
type Props = {
params: { [key: string]: string | string[] | undefined };
};
@@ -16,7 +14,5 @@ export default async function ShareVideoPage(props: Props) {
const video = await supabase.from("videos").select("*").eq("id", videoId);
- console.log(video);
-
return <Share data={video?.data ? video?.data[0] : null} />;
}
diff --git a/apps/web/app/share/page.tsx b/apps/web/app/share/page.tsx
index f954c8c46..09f1e670d 100644
--- a/apps/web/app/share/page.tsx
+++ b/apps/web/app/share/page.tsx
@@ -3,5 +3,7 @@ import { useRouter } from "next/navigation";
export default function SharePage() {
const router = useRouter();
- router.replace("/");
+ if (typeof window !== "undefined") {
+ router.replace("/");
+ }
}
diff --git a/apps/web/components/pages/FaqPage.tsx b/apps/web/components/pages/FaqPage.tsx
index fcbe5713a..5c3164942 100644
--- a/apps/web/components/pages/FaqPage.tsx
+++ b/apps/web/components/pages/FaqPage.tsx
@@ -1,3 +1,5 @@
+"use client";
+
const faqContent = [
{
title: "What is Cap?",
diff --git a/apps/web/components/templates/DashboardTemplate.tsx b/apps/web/components/templates/DashboardTemplate.tsx
index 7b00bec97..8aa4a9e21 100644
--- a/apps/web/components/templates/DashboardTemplate.tsx
+++ b/apps/web/components/templates/DashboardTemplate.tsx
@@ -1,3 +1,5 @@
+"use client";
+
export const DashboardTemplate = ({
title,
description,
diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs
index 426ca9ae9..6a84f7540 100644
--- a/apps/web/next.config.mjs
+++ b/apps/web/next.config.mjs
@@ -31,7 +31,9 @@ const nextConfig = {
};
const millionConfig = {
- auto: true,
+ auto: {
+ rsc: true,
+ },
};
export default million.next(nextConfig, millionConfig);