Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
wip: Caps page
Richie McIlroy6e43956fe626
diff --git a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsxindex d095b575b..dc543ce04 100644--- a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx+++ b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx@@ -50,7 +50,7 @@ export const AdminNavItems = () => {];const navItemClass =- "flex items-center justify-start p-2 rounded-lg outline-none w-full";+ "flex items-center justify-start p-2 rounded-lg outline-none tracking-tight w-full";return (<Dialog>@@ -116,7 +116,7 @@ export const AdminNavItems = () => {href={item.href}className={classNames(pathname == item.href- ? "bg-gradient-to-l from-tertiary to-tertiary-3"+ ? "bg-gradient-to-l from-tertiary to-tertiary-3 ring-4 ring-tertiary-3": "opacity-75 hover:opacity-100",navItemClass)}diff --git a/apps/web/app/dashboard/caps/Caps.tsx b/apps/web/app/dashboard/caps/Caps.tsxindex f851bf9e0..aba3a308a 100644--- a/apps/web/app/dashboard/caps/Caps.tsx+++ b/apps/web/app/dashboard/caps/Caps.tsx@@ -1,15 +1,11 @@"use client";import { Button } from "@cap/ui";-import type { Database } from "@cap/utils";+import { videos } from "@cap/database/schema";-export const Caps = ({- data,-}: {- data: Database["public"]["Tables"]["videos"]["Row"][] | null;-}) => {+export const Caps = ({ data }: { data: (typeof videos.$inferSelect)[] }) => {return (<div className="py-12">- {data?.length === 0 || data === null ? (+ {data.length === 0 ? (<div className="min-h-full h-full flex flex-col items-center justify-center"><div className="w-full max-w-md mx-auto"><img@@ -19,28 +15,36 @@ export const Caps = ({/></div><div className="text-center">- <h2 className="text-2xl font-semibold mb-3">+ <h1 className="text-2xl font-semibold mb-3">Record your first Cap.- </h2>+ </h1><p className="text-xl max-w-md">Craft your narrative with a Cap—get projects done quicker.</p>- <Button size="lg" className="mt-8" variant="default">+ <Button size="default" className="mt-8" variant="default">Record a Cap</Button></div></div>) : (- <div className="border-subtle bg-default mb-16 rounded-lg border bg-white subtle-shadow">- <ul- className="divide-subtle divide-y"- style={{ position: "relative" }}- >- {data?.map((cap, index) => {- return <li key={index}>{cap.name}</li>;+ <>+ <div className="mb-8">+ <h1 className="text-2xl font-semibold mb-1">My Caps</h1>+ <p>These are all of your videos created with Cap.</p>+ </div>+ <div className="grid grid-cols-2 md:grid-cols-3 gap-6">+ {data.map((cap, index) => {+ return (+ <div key={index}>+ <a href={`/share/${cap.id}`}>+ <div className="aspect-video bg-gray-100 rounded-lg mb-1"></div>+ <p>{cap.name}</p>+ </a>+ </div>+ );})}- </ul>- </div>+ </div>+ </>)}</div>);diff --git a/apps/web/app/dashboard/caps/loading.tsx b/apps/web/app/dashboard/caps/loading.tsxnew file mode 100644index 000000000..972527c43--- /dev/null+++ b/apps/web/app/dashboard/caps/loading.tsx@@ -0,0 +1,7 @@+"use client";++import { SkeletonPage } from "@cap/ui";++export default function Loading() {+ return <SkeletonPage />;+}diff --git a/apps/web/app/dashboard/caps/page.tsx b/apps/web/app/dashboard/caps/page.tsxindex 0a1c356d5..6c0ecf8ed 100644--- a/apps/web/app/dashboard/caps/page.tsx+++ b/apps/web/app/dashboard/caps/page.tsx@@ -1,24 +1,11 @@-"use server";import { Caps } from "./Caps";-import { DashboardTemplate } from "@/components/templates/DashboardTemplate";-// import { createSupabaseServerClient } from "@/utils/database/supabase/server";+import { db } from "@cap/database";+import { videos } from "@cap/database/schema";-type Props = {- params: { [key: string]: string | string[] | undefined };-};+export const revalidate = 0;-//TODO: Auth+export default async function CapsPage() {+ const videoData = await db.select().from(videos);-export default async function DocumentsPage(props: Props) {- // const supabase = await createSupabaseServerClient();- // const caps = await supabase- // .from("videos")- // .select("*")- // .order("created_at", { ascending: true });-- return (- <DashboardTemplate>- <Caps data={null} />- </DashboardTemplate>- );+ return <Caps data={videoData} />;}diff --git a/apps/web/app/dashboard/layout.tsx b/apps/web/app/dashboard/layout.tsxindex cecd8302e..33a2a3086 100644--- a/apps/web/app/dashboard/layout.tsx+++ b/apps/web/app/dashboard/layout.tsx@@ -9,6 +9,7 @@ import DynamicSharedLayout from "@/app/dashboard/_components/DynamicSharedLayout// import SupabaseListener from "@/utils/database/supabase/listener";import { getCurrentUser } from "@cap/database/auth/session";import { redirect } from "next/navigation";+import { DashboardTemplate } from "@/components/templates/DashboardTemplate";//TODO: Auth@@ -35,7 +36,9 @@ export default async function DashboardLayout({return (<DynamicSharedLayout spaceData={null} activeSpace={null}>- <div className="full-layout">{children}</div>+ <div className="full-layout">+ <DashboardTemplate>{children}</DashboardTemplate>+ </div></DynamicSharedLayout>);}diff --git a/packages/ui/src/components/Button.tsx b/packages/ui/src/components/Button.tsxindex c13533b8c..ca1bcf422 100644--- a/packages/ui/src/components/Button.tsx+++ b/packages/ui/src/components/Button.tsx@@ -5,20 +5,20 @@ import { cva, type VariantProps } from "class-variance-authority";import { classNames } from "@cap/utils";const buttonVariants = cva(- "inline-flex items-center justify-center rounded-full text-base ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",+ "inline-flex items-center justify-center rounded-full text-base transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 tracking-tight",{variants: {variant: {default:- "group relative isolate inline-flex items-center justify-center overflow-hidden text-sm transition duration-300 ease-[cubic-bezier(0.4,0.36,0,1)] before:duration-300 before:ease-[cubic-bezier(0.4,0.36,0,1)] before:transtion-opacity rounded-md px-3 py-[0.1875rem] shadow-[0_1px_theme(colors.white/0.07)_inset,0_1px_3px_theme(colors.gray.900/0.2)] ring-1 before:pointer-events-none before:absolute before:inset-0 before:-z-10 before:rounded-md before:bg-gradient-to-b before:from-white/20 before:opacity-50 hover:before:opacity-100 after:pointer-events-none after:absolute after:inset-0 after:-z-10 after:rounded-md after:bg-gradient-to-b after:from-white/10 after:from-[46%] after:to-[54%] after:mix-blend-overlay dark:ring-0 bg-primary text-white ring-primary-2",+ "group relative isolate inline-flex items-center justify-center overflow-hidden text-sm transition duration-300 ease-[cubic-bezier(0.4,0.36,0,1)] before:duration-300 before:ease-[cubic-bezier(0.4,0.36,0,1)] before:transtion-opacity rounded-md ring-1 before:pointer-events-none before:absolute before:inset-0 before:-z-10 before:rounded-md before:bg-gradient-to-b before:from-white/20 before:opacity-50 hover:before:opacity-100 after:pointer-events-none after:absolute after:inset-0 after:-z-10 after:rounded-md after:bg-gradient-to-b after:from-white/10 after:from-[46%] after:to-[54%] after:mix-blend-overlay dark:ring-0 bg-primary ring-2 text-white ring-primary",destructive: "bg-red-500 text-red-900 hover:bg-red-600",outline: "border border-input bg-white text-primary hover:bg-gray-50",secondary: "bg-secondary text-white hover:bg-secondary-1",},size: {- default: "h-10 px-4 py-2",+ default: "h-9 px-5 text-base",sm: "h-8 rounded-lg px-3 text-sm",- lg: "h-10 px-5 text-base",+ lg: "h-10 px-5 text-lg",icon: "h-10 w-10",},},