Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

grid layout for dashboard, update some dialogs, shared caps, and more

ameer2468be8f2bbbc05d
diff --git a/apps/web/app/dashboard/_components/AdminNavbar/AdminDesktopNav.tsx b/apps/web/app/dashboard/_components/AdminNavbar/AdminDesktopNav.tsx
index b70d26679..04faaaf8f 100644
--- a/apps/web/app/dashboard/_components/AdminNavbar/AdminDesktopNav.tsx
+++ b/apps/web/app/dashboard/_components/AdminNavbar/AdminDesktopNav.tsx
@@ -3,65 +3,91 @@ import { Tooltip } from "@/components/Tooltip";
import { Logo } from "@cap/ui";
import clsx from "clsx";
import { motion } from "framer-motion";
+import { useDetectPlatform } from "hooks/useDetectPlatform";
import { ChevronLeft, ChevronRight } from "lucide-react";
import Link from "next/link";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { AdminNavItems } from "./AdminNavItems";
export const AdminDesktopNav = () => {
- const [collapsed, setCollapsed] = useState(
+ const { platform } = useDetectPlatform();
+ const [sidebarCollapsed, setSidebarCollapsed] = useState(
localStorage.getItem("sidebarCollapsed") === "true"
);
const toggleCollapse = () => {
- setCollapsed(!collapsed);
- localStorage.setItem("sidebarCollapsed", String(!collapsed));
+ setSidebarCollapsed(!sidebarCollapsed);
+ localStorage.setItem("sidebarCollapsed", String(!sidebarCollapsed));
};
+ const cmdSymbol = platform === "macos" ? "⌘" : "Ctrl";
+
+ useEffect(() => {
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (
+ event.key === "s" &&
+ (event.metaKey || event.ctrlKey) &&
+ event.shiftKey
+ ) {
+ event.preventDefault();
+ toggleCollapse();
+ }
+ };
+
+ window.addEventListener("keydown", handleKeyDown);
+
+ return () => {
+ window.removeEventListener("keydown", handleKeyDown);
+ };
+ }, [toggleCollapse]);
return (
<>
<motion.div
initial={{
- width: collapsed ? "70px" : "250px",
+ width: sidebarCollapsed ? "70px" : "250px",
}}
animate={{
- width: collapsed ? "70px" : "250px",
+ width: sidebarCollapsed ? "70px" : "250px",
transition: {
duration: 0.4,
type: "spring",
- bounce: 0.25
+ bounce: 0.25,
},
}}
- className={clsx(
- "hidden h-full lg:flex lg:flex-shrink-0 group",
- "relative"
- )}
+ className={clsx("hidden z-50 h-full lg:flex group", "relative")}
>
<div className="flex flex-col w-full max-w-[220px] mx-auto">
<div className="flex overflow-hidden flex-col flex-grow h-full">
- <div className="flex flex-col flex-shrink-0 items-start px-3 w-full h-full justify-top">
- <div className="truncate items-center flex justify-center w-full h-[10vh]">
+ <div className="flex flex-col flex-shrink-0 items-start px-3 pt-5 w-full h-full justify-top">
+ <div className="flex justify-center items-center mb-3.5 w-full truncate min-h-8">
<Link href="/dashboard">
<Logo
- className={clsx("flex-shrink-0 mx-auto w-[120px]", collapsed ? "ml-1" : "ml-0")}
+ className={clsx(
+ "flex-shrink-0 mx-auto w-[120px]",
+ sidebarCollapsed ? "ml-1" : "ml-0"
+ )}
/>
</Link>
</div>
- <AdminNavItems collapsed={collapsed} />
+ <AdminNavItems collapsed={sidebarCollapsed} />
</div>
</div>
{/* Collapse toggle button - moved outside the overflow container */}
- <Tooltip kbd={['⌘', 'S']} position="right" content="Toggle collapse">
+ <Tooltip
+ kbd={[cmdSymbol, "Shift", "S"]}
+ position="right"
+ content="Toggle collapse"
+ >
<button
onClick={toggleCollapse}
className="absolute right-[-12px] hover:border-gray-400 top-[50%] transform -translate-y-1/2 bg-gray-50 rounded-full p-1 border border-gray-200 hover:bg-gray-50 transition-colors z-10"
>
- {collapsed ? (
- <ChevronRight size={16} className="text-gray-500" />
- ) : (
- <ChevronLeft size={16} className="text-gray-500" />
- )}
- </button>
+ {sidebarCollapsed ? (
+ <ChevronRight size={16} className="text-gray-500" />
+ ) : (
+ <ChevronLeft size={16} className="text-gray-500" />
+ )}
+ </button>
</Tooltip>
</div>
</motion.div>
diff --git a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
index 49c6a9ea1..1917417f1 100644
--- a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
+++ b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
@@ -117,7 +117,7 @@ export const AdminNavItems = ({ collapsed }: { collapsed?: boolean }) => {
</div>
</div>
</PopoverTrigger>
- <PopoverContent className="z-[60] p-0 mt-2 w-[calc(100%-12px)] mx-auto bg-white">
+ <PopoverContent className="z-[60] p-0 mt-3 w-[calc(100%-12px)] mx-auto bg-white">
<Command>
<CommandInput placeholder="Search spaces..." />
<CommandEmpty>No spaces found</CommandEmpty>
diff --git a/apps/web/app/dashboard/_components/DashboardInner.tsx b/apps/web/app/dashboard/_components/DashboardInner.tsx
index 6203b1e0b..3bd22c3e5 100644
--- a/apps/web/app/dashboard/_components/DashboardInner.tsx
+++ b/apps/web/app/dashboard/_components/DashboardInner.tsx
@@ -13,6 +13,7 @@ import { useState } from "react";
import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
import { Avatar } from "@/app/s/[videoId]/_components/tabs/Activity";
+import clsx from "clsx";
import { signOut } from "next-auth/react";
import Link from "next/link";
@@ -23,19 +24,27 @@ export default function DashboardInner({
emptyComponent,
}: {
children: React.ReactNode;
- title: string;
+ title?: string;
emptyCondition?: boolean;
emptyComponent?: React.ReactNode;
}) {
return (
- <div className="flex flex-col gap-5 pt-5 min-h-screen">
+ <div className="flex flex-col pt-5 min-h-screen lg:gap-5">
{/* Top Bar */}
- <div className="h-[8vh] lg:h-[5vh] border-b lg:border-0 border-gray-200 w-full mt-4 lg:mt-0 fixed top-12 lg:top-0 bg-gray-50 z-10 lg:relative flex items-center justify-between px-5 lg:pr-8 lg:pl-0">
- <p className="text-xl text-gray-500">{title}</p>
+ <div
+ className={clsx(
+ "flex sticky z-10 justify-between items-center px-5 mt-10 w-full h-16 bg-gray-50 border-b border-gray-200 lg:border-b-0 lg:pl-0 lg:pr-5 lg:top-0 lg:relative top-[64px] lg:mt-0 lg:h-8"
+ )}
+ >
+ <p className="relative text-xl text-gray-500 lg:text-2xl">{title}</p>
<User />
</div>
{/* Content Area */}
- <div className="flex overflow-auto flex-col flex-1 p-5 pb-5 bg-gray-100 border border-gray-200 mt-[120px] lg:mt-0 lg:rounded-tl-2xl lg:p-8">
+ <div
+ className={clsx(
+ "flex overflow-auto flex-col flex-1 p-5 pb-5 bg-gray-100 border border-gray-200 lg:rounded-tl-2xl lg:p-8"
+ )}
+ >
{emptyCondition ? (
emptyComponent
) : (
@@ -57,7 +66,7 @@ const User = () => {
<Avatar
letterClass="text-xs lg:text-md"
name={user.name ?? "User"}
- className="size-[24px] lg:size-[36px]"
+ className="size-[24px]"
/>
<span className="ml-2 text-sm lg:ml-3 lg:text-md">
{user.name ?? "User"}
@@ -66,12 +75,12 @@ const User = () => {
<MoreVertical className="w-5 h-5 text-gray-400 group-hover:text-gray-500" />
</div>
</PopoverTrigger>
- <PopoverContent className="p-1 w-48 bg-gray-100">
+ <PopoverContent className="p-1 w-48 bg-gray-50">
<Command>
<CommandGroup>
<Link href="/dashboard/settings">
<CommandItem
- className="px-2 py-2 rounded-lg cursor-pointer hover:bg-gray-200 group"
+ className="px-2 py-2 rounded-lg transition-colors duration-300 cursor-pointer hover:bg-gray-100 group"
onSelect={() => {
setMenuOpen(false);
}}
@@ -83,7 +92,7 @@ const User = () => {
</CommandItem>
</Link>
<CommandItem
- className="px-2 py-2 rounded-lg cursor-pointer hover:bg-gray-200 group"
+ className="px-2 py-2 rounded-lg transition-colors duration-300 cursor-pointer hover:bg-gray-100 group"
onSelect={() => window.open("https://cap.link/discord", "_blank")}
>
<MessageSquare className="mr-2 w-4 h-4 text-gray-400 group-hover:text-gray-500" />
@@ -92,7 +101,7 @@ const User = () => {
</span>
</CommandItem>
<CommandItem
- className="px-2 py-2 rounded-lg cursor-pointer hover:bg-gray-200 group"
+ className="px-2 py-2 rounded-lg transition-colors duration-300 cursor-pointer hover:bg-gray-100 group"
onSelect={() => signOut()}
>
<LogOut className="mr-2 w-4 h-4 text-gray-400 group-hover:text-gray-500" />
diff --git a/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx b/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx
index a8536650e..4ab1b63dc 100644
--- a/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx
+++ b/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx
@@ -2,7 +2,7 @@
import AdminMobileNav from "@/app/dashboard/_components/AdminNavbar/AdminMobileNav";
import { Space } from "@/app/dashboard/layout";
import { users } from "@cap/database/schema";
-import { createContext, useContext } from "react";
+import React, { createContext, useContext } from "react";
import AdminDesktopNav from "./AdminNavbar/AdminDesktopNav";
type SharedContext = {
@@ -28,13 +28,26 @@ export default function DynamicSharedLayout({
isSubscribed: SharedContext["isSubscribed"];
}) {
return (
- <Context.Provider value={{ spaceData, activeSpace, user, isSubscribed }}>
- <div className="flex h-screen min-h-full dashboard-layout">
- <AdminDesktopNav />
- <div className="flex-1 focus:outline-none">
+ <Context.Provider
+ value={{
+ spaceData,
+ activeSpace,
+ user,
+ isSubscribed,
+ }}
+ >
+ {/* CSS Grid layout for dashboard */}
+ <div className="grid grid-cols-[auto,1fr] grid-rows-[auto,1fr] h-screen min-h-screen">
+ {/* Sidebar */}
+ <aside className="z-10 col-span-1 row-span-2">
+ <AdminDesktopNav />
+ </aside>
+ {/* Header/topbar is now expected to be rendered by children if needed */}
+ {/* Main content area */}
+ <main className="overflow-y-auto col-span-1 row-span-2 focus:outline-none">
<AdminMobileNav />
- <main className="w-full min-h-screen">{children}</main>
- </div>
+ {children}
+ </main>
</div>
</Context.Provider>
);
diff --git a/apps/web/app/dashboard/caps/Caps.tsx b/apps/web/app/dashboard/caps/Caps.tsx
index c583d6121..cef24e8e6 100644
--- a/apps/web/app/dashboard/caps/Caps.tsx
+++ b/apps/web/app/dashboard/caps/Caps.tsx
@@ -31,11 +31,11 @@ export const Caps = ({
count: number;
userSpaces: { id: string; name: string }[];
}) => {
- const { refresh, replace } = useRouter();
+ const { refresh } = useRouter();
const params = useSearchParams();
const page = Number(params.get("page")) || 1;
const [analytics, setAnalytics] = useState<Record<string, number>>({});
- const { user, activeSpace } = useSharedContext();
+ const { user } = useSharedContext();
const limit = 15;
const totalPages = Math.ceil(count / limit);
@@ -100,7 +100,7 @@ export const Caps = ({
))}
</div>
{(data.length > limit || data.length === limit || page !== 1) && (
- <div className="mt-4">
+ <div className="mt-10">
<CapPagination currentPage={page} totalPages={totalPages} />
</div>
)}
diff --git a/apps/web/app/dashboard/caps/components/CapCard.tsx b/apps/web/app/dashboard/caps/components/CapCard.tsx
index c11c2b1c5..0a669e60b 100644
--- a/apps/web/app/dashboard/caps/components/CapCard.tsx
+++ b/apps/web/app/dashboard/caps/components/CapCard.tsx
@@ -261,7 +261,7 @@ export const CapCard: React.FC<CapCardProps> = ({
: "Shared with you"}
</Button>
<Button
- onClick={() => onDelete(cap.id)}
+ onClick={() => onDelete?.(cap.id)}
className="flex-1 h-10 rounded-xl"
variant="white"
size="sm"
diff --git a/apps/web/app/dashboard/caps/components/CapPagination.tsx b/apps/web/app/dashboard/caps/components/CapPagination.tsx
index 50d17245d..2426c54af 100644
--- a/apps/web/app/dashboard/caps/components/CapPagination.tsx
+++ b/apps/web/app/dashboard/caps/components/CapPagination.tsx
@@ -1,3 +1,4 @@
+import { clientEnv } from "@cap/env";
import {
Pagination,
PaginationContent,
@@ -7,7 +8,6 @@ import {
PaginationNext,
PaginationPrevious,
} from "@cap/ui";
-import { clientEnv } from "@cap/env";
interface CapPaginationProps {
currentPage: number;
@@ -32,6 +32,7 @@ export const CapPagination: React.FC<CapPaginationProps> = ({
)}
<PaginationItem>
<PaginationLink
+ className="min-w-[54px]"
href={`${clientEnv.NEXT_PUBLIC_WEB_URL}/dashboard/caps?page=1`}
isActive={currentPage === 1}
>
diff --git a/apps/web/app/dashboard/caps/components/SharingDialog.tsx b/apps/web/app/dashboard/caps/components/SharingDialog.tsx
index f3a83981f..8fc51a266 100644
--- a/apps/web/app/dashboard/caps/components/SharingDialog.tsx
+++ b/apps/web/app/dashboard/caps/components/SharingDialog.tsx
@@ -1,8 +1,11 @@
-import { useState, useEffect } from "react";
-import { Dialog } from "@headlessui/react";
+import { Button, Input } from "@cap/ui";
+import { faBuilding, faShareNodes } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { Dialog, Transition } from "@headlessui/react";
+import clsx from "clsx";
+import { Plus, Search } from "lucide-react";
+import { Fragment, useEffect, useState } from "react";
import { toast } from "react-hot-toast";
-import { Search, Plus } from "lucide-react";
-import { Button } from "@cap/ui";
interface SharingDialogProps {
isOpen: boolean;
@@ -73,63 +76,115 @@ export const SharingDialog: React.FC<SharingDialogProps> = ({
);
return (
- <Dialog open={isOpen} onClose={onClose} className="relative z-50">
- <div className="fixed inset-0 bg-black/30" aria-hidden="true" />
- <div className="fixed inset-0 flex items-center justify-center p-4">
- <Dialog.Panel className="w-full max-w-md rounded-lg bg-white p-6">
- <Dialog.Title className="text-xl font-semibold mb-4">
- Share {capName} to Spaces
- </Dialog.Title>
- <div className="relative mb-4">
- <input
- type="text"
- placeholder="Search"
- value={searchTerm}
- onChange={(e) => setSearchTerm(e.target.value)}
- className="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-full focus:outline-none focus:ring-2 focus:ring-blue-500"
- />
- <Search
- className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"
- size={20}
- />
- </div>
- <div className="space-y-2 max-h-60 overflow-y-auto">
- {filteredSpaces.map((space) => (
- <div
- key={space.id}
- className={`flex items-center justify-between p-3 rounded-lg cursor-pointer ${
- selectedSpaces.has(space.id)
- ? "bg-gray-200"
- : "hover:bg-gray-100"
- }`}
- onClick={() => handleToggleSpace(space.id)}
- >
- <div className="flex items-center">
- <div className="w-8 h-8 bg-blue-500 rounded-md flex items-center justify-center text-white font-semibold mr-3">
- {space.name.charAt(0).toUpperCase()}
- </div>
- <span className="text-sm font-medium">{space.name}</span>
- </div>
- {selectedSpaces.has(space.id) ? (
- <span className="text-blue-500 font-medium text-sm">
- Added
- </span>
+ <Transition appear show={isOpen} as={Fragment}>
+ <Dialog
+ as="div"
+ open={isOpen}
+ onClose={onClose}
+ className="relative z-50"
+ >
+ <Transition.Child
+ enter="duration-300 ease-out"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="duration-200 ease-in"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
+ className="fixed inset-0 bg-black/30"
+ />
+ <Transition.Child
+ enter="ease-out duration-300"
+ enterFrom="opacity-0 scale-95"
+ enterTo="opacity-100 scale-100"
+ leave="ease-in duration-200"
+ leaveFrom="opacity-100 scale-100"
+ leaveTo="opacity-0 scale-95"
+ className="flex fixed inset-0 justify-center items-center p-4"
+ >
+ <Dialog.Panel className="w-full max-w-md bg-white rounded-xl">
+ <Dialog.Title className="p-5 font-semibold border-b flex items-center gap-3 border-gray-200 text-[16px]">
+ <div className="flex justify-center items-center bg-gray-100 rounded-full border border-gray-200 size-10">
+ <FontAwesomeIcon
+ className="text-gray-400 size-3"
+ icon={faShareNodes}
+ />
+ </div>
+ <div className="flex flex-col">
+ <p className="text-gray-500 text-md">
+ Share{" "}
+ <span className="font-bold text-gray-500">{capName}</span>
+ </p>
+ <p className="text-sm text-gray-400">
+ Select the spaces you would like to share with
+ </p>
+ </div>
+ </Dialog.Title>
+ <div className="p-5">
+ <div className="relative mb-4">
+ <Input
+ type="text"
+ placeholder="Search..."
+ value={searchTerm}
+ className="pr-8"
+ onChange={(e) => setSearchTerm(e.target.value)}
+ />
+ <Search
+ className="absolute right-3 top-1/2 text-gray-400 transform -translate-y-1/2"
+ size={20}
+ />
+ </div>
+ <div className="overflow-y-auto max-h-60">
+ {filteredSpaces.length > 0 ? (
+ filteredSpaces.map((space) => (
+ <div
+ key={space.id}
+ className={clsx(
+ `flex items-center border group transition-colors duration-300 border-gray-200 justify-between p-3 rounded-2xl cursor-pointer`,
+ selectedSpaces.has(space.id)
+ ? "bg-gray-100"
+ : "hover:bg-gray-100"
+ )}
+ onClick={() => handleToggleSpace(space.id)}
+ >
+ <div className="flex items-center">
+ <div className="flex justify-center items-center mr-3 w-8 h-8 font-semibold text-white bg-blue-500 rounded-md">
+ {space.name.charAt(0).toUpperCase()}
+ </div>
+ <span className="text-sm transition-colors duration-300 group-hover:text-gray-500">
+ {space.name}
+ </span>
+ </div>
+ {selectedSpaces.has(space.id) ? (
+ <span className="text-sm font-medium text-blue-500">
+ Added
+ </span>
+ ) : (
+ <Plus className="text-gray-400" size={20} />
+ )}
+ </div>
+ ))
) : (
- <Plus className="text-gray-400" size={20} />
+ <div className="flex gap-2 justify-center items-center pt-2 text-sm">
+ <FontAwesomeIcon
+ className="text-gray-400 size-3"
+ icon={faBuilding}
+ />
+ <p className="text-gray-500">No spaces found</p>
+ </div>
)}
</div>
- ))}
- </div>
- <div className="mt-6 flex justify-end space-x-2">
- <Button size="sm" variant="gray" onClick={onClose}>
- Cancel
- </Button>
- <Button size="sm" variant="primary" onClick={handleSave}>
- Share
- </Button>
- </div>
- </Dialog.Panel>
- </div>
- </Dialog>
+ </div>
+ <div className="flex justify-end p-5 space-x-2 border-t border-gray-200">
+ <Button size="sm" variant="gray" onClick={onClose}>
+ Cancel
+ </Button>
+ <Button size="sm" variant="dark" onClick={handleSave}>
+ Save
+ </Button>
+ </div>
+ </Dialog.Panel>
+ </Transition.Child>
+ </Dialog>
+ </Transition>
);
};
diff --git a/apps/web/app/dashboard/loading.tsx b/apps/web/app/dashboard/loading.tsx
index 972527c43..247a2c9af 100644
--- a/apps/web/app/dashboard/loading.tsx
+++ b/apps/web/app/dashboard/loading.tsx
@@ -1,7 +1,5 @@
"use client";
-import { SkeletonPage } from "@cap/ui";
-
export default function Loading() {
- return <SkeletonPage />;
+ return null;
}
diff --git a/apps/web/app/dashboard/settings/layout.tsx b/apps/web/app/dashboard/settings/layout.tsx
index 5c0dc3183..5bbbc6b83 100644
--- a/apps/web/app/dashboard/settings/layout.tsx
+++ b/apps/web/app/dashboard/settings/layout.tsx
@@ -1,8 +1,9 @@
"use client";
-import { Card, CardHeader } from "@cap/ui";
+import { CardHeader } from "@cap/ui";
import Link from "next/link";
import { usePathname } from "next/navigation";
+import DashboardInner from "../_components/DashboardInner";
export default function DashboardLayout({
children,
@@ -17,30 +18,28 @@ export default function DashboardLayout({
];
return (
- <div>
- <Card>
- <CardHeader>
- <nav>
- <ul className="inline-flex rounded-lg bg-gray-50 p-1 border-[1px] border-gray-200">
- {secondaryNavigation.map((item) => (
- <li key={item.name}>
- <Link
- href={item.href}
- className={`block rounded-md px-3 py-2 text-xs ${
- item.href === pathname
- ? "bg-gray-200 text-gray-900"
- : "text-gray-500 hover:bg-gray-100 hover:text-gray-900"
- }`}
- >
- {item.name}
- </Link>
- </li>
- ))}
- </ul>
- </nav>
- </CardHeader>
- {children}
- </Card>
- </div>
+ <DashboardInner title="Settings">
+ <CardHeader className="pt-0">
+ <nav>
+ <ul className="inline-flex rounded-lg bg-gray-50 p-1 border-[1px] border-gray-200">
+ {secondaryNavigation.map((item) => (
+ <li key={item.name}>
+ <Link
+ href={item.href}
+ className={`block rounded-md px-3 py-2 text-xs ${
+ item.href === pathname
+ ? "bg-gray-200 text-gray-900"
+ : "text-gray-500 hover:bg-gray-100 hover:text-gray-900"
+ }`}
+ >
+ {item.name}
+ </Link>
+ </li>
+ ))}
+ </ul>
+ </nav>
+ </CardHeader>
+ {children}
+ </DashboardInner>
);
}
diff --git a/apps/web/app/dashboard/settings/workspace/Workspace.tsx b/apps/web/app/dashboard/settings/workspace/Workspace.tsx
index ff89986ac..1d71207e4 100644
--- a/apps/web/app/dashboard/settings/workspace/Workspace.tsx
+++ b/apps/web/app/dashboard/settings/workspace/Workspace.tsx
@@ -1,13 +1,24 @@
"use client";
+import { manageBilling } from "@/actions/workspace/manage-billing";
+import { removeWorkspaceInvite } from "@/actions/workspace/remove-invite";
+import { sendWorkspaceInvites } from "@/actions/workspace/send-invites";
+import { updateWorkspaceDetails } from "@/actions/workspace/update-details";
+import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
+import { Tooltip } from "@/components/Tooltip";
import {
- Card,
+ Button,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
- Button,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
Input,
Label,
Table,
@@ -16,24 +27,12 @@ import {
TableHead,
TableHeader,
TableRow,
- Dialog,
- DialogContent,
- DialogHeader,
- DialogTitle,
- DialogDescription,
- DialogFooter,
} from "@cap/ui";
+import { format } from "date-fns";
import { useRouter } from "next/navigation";
-import { useState, useRef } from "react";
+import { useRef, useState } from "react";
import toast from "react-hot-toast";
-import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
-import { format } from "date-fns";
-import { Tooltip } from "react-tooltip";
import { CustomDomain } from "./components/CustomDomain";
-import { updateWorkspaceDetails } from "@/actions/workspace/update-details";
-import { sendWorkspaceInvites } from "@/actions/workspace/send-invites";
-import { removeWorkspaceInvite } from "@/actions/workspace/remove-invite";
-import { manageBilling } from "@/actions/workspace/manage-billing";
export const Workspace = () => {
const { spaceData, activeSpace, user } = useSharedContext();
@@ -193,7 +192,7 @@ export const Workspace = () => {
if (!isOwner) showOwnerToast();
}}
/>
- <p className="text-sm text-gray-400 mt-1">
+ <p className="mt-1 text-sm text-gray-400">
Only users with email addresses from this domain will be able to
access videos shared in this workspace. Leave empty to allow all
users.
@@ -201,11 +200,11 @@ export const Workspace = () => {
</div>
</div>
</CardContent>
- <CardFooter className="border-b px-6 pt-0 pb-6">
+ <CardFooter className="px-6 pt-0 pb-6 border-b">
<Button
type="submit"
size="sm"
- variant="gray"
+ variant="dark"
disabled={!isOwner}
onClick={() => {
if (!isOwner) showOwnerToast();
@@ -224,10 +223,10 @@ export const Workspace = () => {
<CustomDomain />
</div>
</CardContent>
- <CardFooter className="border-b px-6 pt-0 pb-2"></CardFooter>
+ <CardFooter className="px-6 pt-0 pb-2 border-b"></CardFooter>
</>
<CardHeader>
- <div className="flex items-center justify-between">
+ <div className="flex justify-between items-center">
<div>
<CardTitle>Workspace Members</CardTitle>
<CardDescription>Manage your workspace members.</CardDescription>
@@ -248,18 +247,20 @@ export const Workspace = () => {
</CardHeader>
<CardContent>
<div className="flex items-center space-x-2">
- <Button
- type="button"
- size="sm"
- variant="primary"
- disabled={!isOwner || loading}
- onClick={handleManageBilling}
- data-tooltip-id="purchase-seats-tooltip"
- data-tooltip-content='Once inside the Stripe dashboard, click "Manage Plan", then increase quantity of subscriptions to purchase more seats.'
+ <Tooltip
+ position="top"
+ content="Once inside the Stripe dashboard, click 'Manage Plan', then increase quantity of subscriptions to purchase more seats"
>
- {loading ? "Loading..." : "Purchase more seats"}
- </Button>
- <Tooltip id="purchase-seats-tooltip" place="top" />
+ <Button
+ type="button"
+ size="sm"
+ variant="primary"
+ disabled={!isOwner || loading}
+ onClick={handleManageBilling}
+ >
+ {loading ? "Loading..." : "+ Purchase more seats"}
+ </Button>
+ </Tooltip>
<Button
type="button"
size="sm"
@@ -392,7 +393,7 @@ export const Workspace = () => {
{inviteEmails.map((email) => (
<div
key={email}
- className="flex items-center justify-between bg-gray-100 p-2 rounded"
+ className="flex justify-between items-center p-2 bg-gray-100 rounded"
>
<span>{email}</span>
<Button
diff --git a/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx b/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx
index 7f48c18e4..fc3e0b052 100644
--- a/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx
+++ b/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx
@@ -2,15 +2,15 @@ export const dynamic = "force-dynamic";
export const revalidate = 0;
export const fetchCache = "force-no-store";
-import { useState, useEffect, useRef } from "react";
-import { Button, Input, Label } from "@cap/ui";
-import { toast } from "react-hot-toast";
-import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
-import { RefreshCw, CheckCircle, XCircle, Copy, Check } from "lucide-react";
-import { useRouter } from "next/navigation";
-import { updateDomain } from "@/actions/workspace/update-domain";
import { checkWorkspaceDomain } from "@/actions/workspace/check-domain";
import { removeWorkspaceDomain } from "@/actions/workspace/remove-domain";
+import { updateDomain } from "@/actions/workspace/update-domain";
+import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
+import { Button, Input, Label } from "@cap/ui";
+import { Check, CheckCircle, Copy, RefreshCw, XCircle } from "lucide-react";
+import { useRouter } from "next/navigation";
+import { useEffect, useRef, useState } from "react";
+import { toast } from "react-hot-toast";
type DomainVerification = {
type: string;
@@ -165,7 +165,7 @@ export function CustomDomain() {
Please upgrade to{" "}
<a
href="/pricing"
- className="text-blue-500 font-medium hover:text-blue-600"
+ className="font-medium text-blue-500 hover:text-blue-600"
onClick={(e) => {
e.preventDefault();
toast.dismiss(t.id);
@@ -230,7 +230,7 @@ export function CustomDomain() {
Please upgrade to{" "}
<a
href="/pricing"
- className="text-blue-500 font-medium hover:text-blue-600"
+ className="font-medium text-blue-500 hover:text-blue-600"
onClick={(e) => {
e.preventDefault();
toast.dismiss(t.id);
@@ -278,7 +278,7 @@ export function CustomDomain() {
<Label htmlFor="customDomain" className="text-sm font-medium">
Add your custom domain here
</Label>
- <div className="mt-2 flex gap-2">
+ <div className="flex gap-2 items-center mt-2">
<Input
type="text"
id="customDomain"
@@ -288,7 +288,12 @@ export function CustomDomain() {
disabled={loading}
className="flex-1"
/>
- <Button type="button" onClick={handleSubmit} disabled={loading}>
+ <Button
+ variant="dark"
+ type="button"
+ onClick={handleSubmit}
+ disabled={loading}
+ >
{loading ? "Saving..." : "Save"}
</Button>
{activeSpace?.space.customDomain && (
@@ -300,9 +305,9 @@ export function CustomDomain() {
className="w-[105px]"
>
{verifying ? (
- <RefreshCw className="mr-2 h-6 w-6 animate-spin" />
+ <RefreshCw className="mr-2 w-6 h-6 animate-spin" />
) : (
- <RefreshCw className="mr-2 h-6 w-6" />
+ <RefreshCw className="mr-2 w-6 h-6" />
)}
Refresh
</Button>
@@ -320,12 +325,12 @@ export function CustomDomain() {
</div>
{activeSpace?.space.customDomain && (
<div className="mt-4 space-y-4">
- <div className="flex items-center gap-2">
+ <div className="flex gap-2 items-center">
{isVerified ? (
<>
<div className="flex items-center gap-1.5 text-green-500 bg-green-100 px-2.5 py-1.5 rounded-md text-sm">
- <CheckCircle className="h-4 w-4" />
- <span className="font-medium text-green-500 text-sm">
+ <CheckCircle className="w-4 h-4" />
+ <span className="text-sm font-medium text-green-500">
Domain verified
</span>
</div>
@@ -333,8 +338,8 @@ export function CustomDomain() {
) : (
<>
<div className="flex items-center gap-1.5 text-red-600 bg-red-50 px-2.5 py-1.5 rounded-md text-sm">
- <XCircle className="h-4 w-4" />
- <span className="font-medium text-red-500 text-sm">
+ <XCircle className="w-4 h-4" />
+ <span className="text-sm font-medium text-red-500">
Domain not verified
</span>
</div>
@@ -342,7 +347,7 @@ export function CustomDomain() {
)}
</div>
{!isVerified && domainConfig?.verification?.[0] && (
- <div className="rounded-lg border border-gray-200 overflow-hidden">
+ <div className="overflow-hidden rounded-lg border border-gray-200">
<div className="px-4 py-3 bg-gray-50 border-b border-gray-200">
<h4 className="font-medium text-gray-900">
DNS Configuration Required
@@ -366,7 +371,7 @@ export function CustomDomain() {
<dt className="text-sm font-medium text-gray-500">
Name
</dt>
- <dd className="flex items-center gap-2 text-sm text-gray-900">
+ <dd className="flex gap-2 items-center text-sm text-gray-900">
<div className="flex items-center gap-1.5 bg-gray-50 px-2 py-1 rounded flex-1 min-w-0">
<code className="truncate">
{domainConfig?.verification?.[0]?.domain}
@@ -379,13 +384,13 @@ export function CustomDomain() {
domainConfig?.verification?.[0]?.domain;
if (domain) handleCopy(domain, "name");
}}
- className="p-1 hover:bg-gray-100 rounded-md transition-colors shrink-0"
+ className="p-1 rounded-md transition-colors hover:bg-gray-100 shrink-0"
title="Copy to clipboard"
>
{copiedField === "name" ? (
- <Check className="h-4 w-4 text-green-500" />
+ <Check className="w-4 h-4 text-green-500" />
) : (
- <Copy className="h-4 w-4 text-gray-500" />
+ <Copy className="w-4 h-4 text-gray-500" />
)}
</button>
)}
@@ -396,7 +401,7 @@ export function CustomDomain() {
<dt className="text-sm font-medium text-gray-500">
Value
</dt>
- <dd className="flex items-center gap-2 text-sm text-gray-900">
+ <dd className="flex gap-2 items-center text-sm text-gray-900">
<div className="flex items-center gap-1.5 bg-gray-50 p-2 rounded flex-1 min-w-0">
<code className="font-mono text-xs break-all">
{domainConfig?.verification?.[0]?.value}
@@ -409,13 +414,13 @@ export function CustomDomain() {
domainConfig?.verification?.[0]?.value;
if (value) handleCopy(value, "value");
}}
- className="p-1 hover:bg-gray-100 rounded-md transition-colors shrink-0"
+ className="p-1 rounded-md transition-colors hover:bg-gray-100 shrink-0"
title="Copy to clipboard"
>
{copiedField === "value" ? (
- <Check className="h-4 w-4 text-green-500" />
+ <Check className="w-4 h-4 text-green-500" />
) : (
- <Copy className="h-4 w-4 text-gray-500" />
+ <Copy className="w-4 h-4 text-gray-500" />
)}
</button>
)}
@@ -430,7 +435,7 @@ export function CustomDomain() {
{!isVerified &&
!domainConfig?.verification?.[0] &&
domainConfig?.requiredAValue && (
- <div className="rounded-lg border border-gray-200 overflow-hidden mt-4">
+ <div className="overflow-hidden mt-4 rounded-lg border border-gray-200">
<div className="px-4 py-3 bg-gray-50 border-b border-gray-200">
<h4 className="font-medium text-gray-900">
DNS Configuration Required
@@ -483,7 +488,7 @@ export function CustomDomain() {
<dt className="text-sm font-medium text-gray-500">
Required
</dt>
- <dd className="flex items-center gap-2">
+ <dd className="flex gap-2 items-center">
<div className="flex items-center gap-1.5 bg-gray-50 px-2 py-1 rounded flex-1 min-w-0">
<code className="text-sm text-gray-900">
{domainConfig.requiredAValue || "Loading..."}
@@ -498,13 +503,13 @@ export function CustomDomain() {
"value"
)
}
- className="p-1 hover:bg-gray-100 rounded-md transition-colors shrink-0"
+ className="p-1 rounded-md transition-colors hover:bg-gray-100 shrink-0"
title="Copy to clipboard"
>
{copiedField === "value" ? (
- <Check className="h-4 w-4 text-green-500" />
+ <Check className="w-4 h-4 text-green-500" />
) : (
- <Copy className="h-4 w-4 text-gray-500" />
+ <Copy className="w-4 h-4 text-gray-500" />
)}
</button>
)}
diff --git a/apps/web/app/dashboard/shared-caps/SharedCaps.tsx b/apps/web/app/dashboard/shared-caps/SharedCaps.tsx
index 3f2793ea5..bbd0ec74d 100644
--- a/apps/web/app/dashboard/shared-caps/SharedCaps.tsx
+++ b/apps/web/app/dashboard/shared-caps/SharedCaps.tsx
@@ -2,7 +2,7 @@
import { getVideoAnalytics } from "@/actions/videos/get-analytics";
import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
import { VideoMetadata } from "@cap/database/types";
-import { useRouter, useSearchParams } from "next/navigation";
+import { useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import DashboardInner from "../_components/DashboardInner";
import { CapPagination } from "../caps/components/CapPagination";
@@ -23,17 +23,14 @@ type SharedVideoData = {
export const SharedCaps = ({
data,
count,
- activeSpaceId,
}: {
data: SharedVideoData;
count: number;
- activeSpaceId: string;
}) => {
- const { refresh } = useRouter();
const params = useSearchParams();
const page = Number(params.get("page")) || 1;
const [analytics, setAnalytics] = useState<Record<string, number>>({});
- const { user, activeSpace } = useSharedContext();
+ const { activeSpace } = useSharedContext();
const limit = 15;
const totalPages = Math.ceil(count / limit);
@@ -60,7 +57,7 @@ export const SharedCaps = ({
}
>
<div className="flex flex-col w-full h-full">
- <div className="grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-4">
+ <div className="grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
{data.map((cap) => (
<SharedCapCard
key={cap.id}
diff --git a/apps/web/app/dashboard/shared-caps/components/SharedCapCard.tsx b/apps/web/app/dashboard/shared-caps/components/SharedCapCard.tsx
index 5ae361166..9a1136ec1 100644
--- a/apps/web/app/dashboard/shared-caps/components/SharedCapCard.tsx
+++ b/apps/web/app/dashboard/shared-caps/components/SharedCapCard.tsx
@@ -1,11 +1,12 @@
-import { useState } from "react";
-import { VideoThumbnail } from "@/components/VideoThumbnail";
-import { CapCardAnalytics } from "@/app/dashboard/caps/components/CapCardAnalytics";
-import moment from "moment";
-import { Tooltip } from "react-tooltip";
-import { serverEnv, clientEnv, NODE_ENV } from "@cap/env";
import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
+import { CapCardAnalytics } from "@/app/dashboard/caps/components/CapCardAnalytics";
+import { Tooltip } from "@/components/Tooltip";
+import { VideoThumbnail } from "@/components/VideoThumbnail";
import { VideoMetadata } from "@cap/database/types";
+import { clientEnv, NODE_ENV } from "@cap/env";
+import { faBuilding, faUser } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import moment from "moment";
interface SharedCapCardProps {
cap: {
@@ -32,8 +33,6 @@ export const SharedCapCard: React.FC<SharedCapCardProps> = ({
? new Date(cap.metadata.customCreatedAt)
: cap.createdAt;
- const [isEditing, setIsEditing] = useState(false);
- const [title, setTitle] = useState(cap.name);
const { activeSpace } = useSharedContext();
const displayCount =
@@ -42,12 +41,9 @@ export const SharedCapCard: React.FC<SharedCapCardProps> = ({
: analytics;
return (
- <div
- className="rounded-xl border-[1px] border-gray-200 relative"
- style={{ boxShadow: "0px 8px 16px rgba(18, 22, 31, 0.04)" }}
- >
+ <div className="relative rounded-2xl flex flex-col gap-4 w-full h-full p-4 border-gray-200 bg-gray-50 border-[1px]">
<a
- className="group block"
+ className="block group"
href={
activeSpace?.space.customDomain && activeSpace.space.domainVerified
? `https://${activeSpace.space.customDomain}/s/${cap.id}`
@@ -62,34 +58,37 @@ export const SharedCapCard: React.FC<SharedCapCardProps> = ({
alt={`${cap.name} Thumbnail`}
/>
</a>
- <div className="flex flex-col p-4">
- <div className="mb-2">
+ <div className="flex flex-col flex-grow gap-3 w-full">
+ <div className="flex flex-col gap-1">
+ <p className="text-md truncate leading-[1.25rem] text-gray-500 font-medium">
+ {cap.name}
+ </p>
+ <Tooltip content={`Cap created at ${effectiveDate}`}>
+ <span className="text-sm truncate leading-[1.25rem] text-gray-400 cursor-pointer flex items-center">
+ {moment(effectiveDate).fromNow()}
+ </span>
+ </Tooltip>
+ </div>
+ <div className="mb-2 space-y-1">
{cap.ownerName && (
- <div>
- <span className="text-[0.875rem] leading-[1.25rem] text-gray-400">
- {cap.ownerName}
- </span>
+ <div className="flex gap-2 items-center">
+ <FontAwesomeIcon icon={faUser} className="text-gray-400 size-3" />
+ <span className="text-sm text-gray-400">{cap.ownerName}</span>
</div>
)}
- <div>
- <span className="text-[0.875rem] leading-[1.25rem] text-gray-400">
- Shared with {spaceName}
- </span>
+ <div className="flex gap-2 items-center">
+ <FontAwesomeIcon
+ icon={faBuilding}
+ className="text-gray-400 size-2.5"
+ />
+ <p className="text-sm text-gray-400">
+ Shared with{" "}
+ <span className="text-sm font-medium text-gray-500">
+ {spaceName}
+ </span>
+ </p>
</div>
</div>
- <p className="text-[0.875rem] leading-[1.25rem] text-gray-500 font-medium">
- {title}
- </p>
- <p>
- <span
- className="text-[0.875rem] leading-[1.25rem] text-gray-400"
- data-tooltip-id={cap.id + "_createdAt"}
- data-tooltip-content={`Cap created at ${effectiveDate}`}
- >
- {moment(effectiveDate).fromNow()}
- </span>
- <Tooltip id={cap.id + "_createdAt"} />
- </p>
<CapCardAnalytics
capId={cap.id}
displayCount={displayCount}
diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css
index 2031a5c02..7fb82a738 100644
--- a/apps/web/app/globals.css
+++ b/apps/web/app/globals.css
@@ -180,7 +180,7 @@ a.bg-primary:hover {
position: absolute;
inset: 0;
padding: 1px;
- border-radius: 16px;
+ border-radius: 12px;
background: linear-gradient(to bottom, #ffffff40 70%, #ffffff00 100%);
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
diff --git a/apps/web/components/Tooltip.tsx b/apps/web/components/Tooltip.tsx
index cbfc5a38e..446454983 100644
--- a/apps/web/components/Tooltip.tsx
+++ b/apps/web/components/Tooltip.tsx
@@ -1,6 +1,5 @@
"use client";
-import { detectPlatform } from "@/utils/platform";
import { classNames } from "@cap/utils";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import * as React from "react";
@@ -25,14 +24,12 @@ const Tooltip = ({
}
return (
<TooltipPrimitive.Root>
- <TooltipPrimitive.Trigger asChild>
- {children}
- </TooltipPrimitive.Trigger>
+ <TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
<TooltipPrimitive.Portal>
<TooltipPrimitive.Content
side={position}
className={classNames(
- "select-none rounded-lg flex items-center gap-2 TooltipContent bg-gray-50 border border-gray-200 px-3 py-2 text-xs leading-none shadow-sm shadow-gray-300/50 data-[state=delayed-open]:data-[side=bottom]:animate-slideUpAndFade data-[state=delayed-open]:data-[side=left]:animate-slideRightAndFade data-[state=delayed-open]:data-[side=right]:animate-slideLeftAndFade data-[state=delayed-open]:data-[side=top]:animate-slideDownAndFade",
+ "select-none rounded-lg z-[60] flex items-center gap-2 TooltipContent bg-gray-50 border border-gray-200 px-3 py-2 text-xs leading-none shadow-sm shadow-gray-300/50 data-[state=delayed-open]:data-[side=bottom]:animate-slideUpAndFade data-[state=delayed-open]:data-[side=left]:animate-slideRightAndFade data-[state=delayed-open]:data-[side=right]:animate-slideLeftAndFade data-[state=delayed-open]:data-[side=top]:animate-slideDownAndFade",
className
)}
sideOffset={5}
@@ -41,8 +38,11 @@ const Tooltip = ({
{kbd && (
<div className="flex gap-1 items-center">
{kbd.map((key, index) => (
- <div className="flex justify-center items-center bg-gray-100 rounded-md border border-gray-300 shadow-sm size-5 shadow-gray-300/50" key={index}>
- <kbd className="text-xs text-gray-400">{key}</kbd>
+ <div
+ className="flex justify-center items-center px-1 bg-gray-100 rounded-md border border-gray-300 shadow-sm size-5 min-w-fit shadow-gray-300/50"
+ key={index}
+ >
+ <kbd className="text-[11px] text-gray-400">{key}</kbd>
</div>
))}
</div>
diff --git a/apps/web/components/pages/DownloadPage.tsx b/apps/web/components/pages/DownloadPage.tsx
index e0c9a25b0..083206546 100644
--- a/apps/web/components/pages/DownloadPage.tsx
+++ b/apps/web/components/pages/DownloadPage.tsx
@@ -1,42 +1,20 @@
"use client";
-import { Button, LogoBadge } from "@cap/ui";
-import { useEffect, useState } from "react";
import {
- detectPlatform,
getDownloadButtonText,
getDownloadUrl,
getPlatformIcon,
getVersionText,
PlatformIcons,
} from "@/utils/platform";
+import { Button } from "@cap/ui";
+import { useDetectPlatform } from "hooks/useDetectPlatform";
+import { useState } from "react";
export const DownloadPage = () => {
- const [loading, setLoading] = useState(true);
- const [platform, setPlatform] = useState<string | null>(null);
- const [isIntel, setIsIntel] = useState(false);
+ const { platform, isIntel } = useDetectPlatform();
const [showDebug, setShowDebug] = useState(false);
-
- useEffect(() => {
- const detectUserPlatform = async () => {
- try {
- const { platform, isIntel } = await detectPlatform();
- setPlatform(platform);
- setIsIntel(isIntel);
- } catch (error) {
- console.error("Error detecting platform:", error);
- } finally {
- setLoading(false);
- }
- };
-
- detectUserPlatform();
- }, []);
-
- const simulatePlatform = (newPlatform: string, newIsIntel: boolean) => {
- setPlatform(newPlatform);
- setIsIntel(newIsIntel);
- };
+ const loading = platform === null;
return (
<div className="pt-32 pb-16 wrapper wrapper-sm md:py-32">
@@ -44,18 +22,17 @@ export const DownloadPage = () => {
{/* Debug toggle button in top-right corner */}
<button
onClick={() => setShowDebug(!showDebug)}
- className="absolute top-4 right-4 text-xs text-gray-400 hover:text-gray-300 bg-gray-800 px-2 py-1 rounded"
+ className="absolute top-4 right-4 px-2 py-1 text-xs text-gray-400 bg-gray-800 rounded hover:text-gray-300"
>
{showDebug ? "Hide Debug" : "Debug"}
</button>
{/* Debug panel */}
{showDebug && (
- <div className="fixed top-10 right-4 bg-gray-800 p-3 rounded shadow-lg z-50 text-left">
- <div className="text-xs text-gray-300 mb-2">Platform Simulator</div>
+ <div className="fixed right-4 top-10 z-50 p-3 text-left bg-gray-800 rounded shadow-lg">
+ <div className="mb-2 text-xs text-gray-300">Platform Simulator</div>
<div className="space-y-2">
<button
- onClick={() => simulatePlatform("windows", false)}
className={`text-xs px-2 py-1 rounded w-full text-left ${
platform === "windows"
? "bg-blue-600"
@@ -65,7 +42,6 @@ export const DownloadPage = () => {
Windows (Beta)
</button>
<button
- onClick={() => simulatePlatform("macos", true)}
className={`text-xs px-2 py-1 rounded w-full text-left ${
platform === "macos" && isIntel
? "bg-blue-600"
@@ -75,7 +51,6 @@ export const DownloadPage = () => {
macOS (Intel)
</button>
<button
- onClick={() => simulatePlatform("macos", false)}
className={`text-xs px-2 py-1 rounded w-full text-left ${
platform === "macos" && !isIntel
? "bg-blue-600"
@@ -84,7 +59,7 @@ export const DownloadPage = () => {
>
macOS (Apple Silicon)
</button>
- <div className="text-xs text-gray-400 mt-2">
+ <div className="mt-2 text-xs text-gray-400">
Current: {platform}{" "}
{platform === "macos" &&
(isIntel ? "(Intel)" : "(Apple Silicon)")}
@@ -106,7 +81,7 @@ export const DownloadPage = () => {
variant="radialblue"
size="lg"
href={getDownloadUrl(platform, isIntel)}
- className="font-medium flex items-center justify-center text-white py-6"
+ className="flex justify-center items-center py-6 font-medium text-white"
>
{!loading && getPlatformIcon(platform)}
{getDownloadButtonText(platform, loading, isIntel)}
@@ -125,10 +100,10 @@ export const DownloadPage = () => {
loop
muted
playsInline
- className="w-full rounded-md shadow-md mx-auto"
+ className="mx-auto w-full rounded-md shadow-md"
style={{ maxWidth: "300px" }}
/>
- <p className="text-sm text-gray-400 mt-2">
+ <p className="mt-2 text-sm text-gray-400">
Whilst Cap for Windows is in early beta, after downloading and
running the app, follow the steps above to whitelist Cap on
your PC.
@@ -140,15 +115,15 @@ export const DownloadPage = () => {
<PlatformIcons />
- <div className="mt-6 pb-4 fade-in-up animate-delay-2">
- <h3 className="text-sm font-medium mb-2 text-gray-400">
+ <div className="pb-4 mt-6 fade-in-up animate-delay-2">
+ <h3 className="mb-2 text-sm font-medium text-gray-400">
Other download options:
</h3>
- <div className="flex flex-col md:flex-row justify-center items-center gap-3">
+ <div className="flex flex-col gap-3 justify-center items-center md:flex-row">
{platform !== "windows" && (
<a
href="/download/windows"
- className="text-sm text-gray-400 hover:underline transition-all"
+ className="text-sm text-gray-400 transition-all hover:underline"
>
Windows (Beta)
</a>
@@ -156,7 +131,7 @@ export const DownloadPage = () => {
{platform === "macos" && isIntel && (
<a
href="/download/apple-silicon"
- className="text-sm text-gray-400 hover:underline transition-all"
+ className="text-sm text-gray-400 transition-all hover:underline"
>
Apple Silicon
</a>
@@ -164,7 +139,7 @@ export const DownloadPage = () => {
{platform === "macos" && !isIntel && (
<a
href="/download/apple-intel"
- className="text-sm text-gray-400 hover:underline transition-all"
+ className="text-sm text-gray-400 transition-all hover:underline"
>
Apple Intel
</a>
@@ -173,13 +148,13 @@ export const DownloadPage = () => {
<>
<a
href="/download/apple-silicon"
- className="text-sm text-gray-400 hover:underline transition-all"
+ className="text-sm text-gray-400 transition-all hover:underline"
>
Apple Silicon
</a>
<a
href="/download/apple-intel"
- className="text-sm text-gray-400 hover:underline transition-all"
+ className="text-sm text-gray-400 transition-all hover:underline"
>
Apple Intel
</a>
@@ -189,39 +164,39 @@ export const DownloadPage = () => {
</div>
{/* Discreet SEO Links */}
- <div className="mt-32 pt-8 border-t border-gray-200 text-xs text-gray-500 opacity-70">
- <div className="flex flex-wrap justify-center gap-x-4 gap-y-2 max-w-lg mx-auto">
+ <div className="pt-8 mt-32 text-xs text-gray-500 border-t border-gray-200 opacity-70">
+ <div className="flex flex-wrap gap-y-2 gap-x-4 justify-center mx-auto max-w-lg">
<a
href="/screen-recorder"
- className="hover:text-gray-400 hover:underline text-xs"
+ className="text-xs hover:text-gray-400 hover:underline"
>
Screen Recorder
</a>
<span className="hidden md:inline">•</span>
<a
href="/free-screen-recorder"
- className="hover:text-gray-400 hover:underline text-xs"
+ className="text-xs hover:text-gray-400 hover:underline"
>
Free Screen Recorder
</a>
<span className="hidden md:inline">•</span>
<a
href="/screen-recorder-mac"
- className="hover:text-gray-400 hover:underline text-xs"
+ className="text-xs hover:text-gray-400 hover:underline"
>
Mac Screen Recorder
</a>
<span className="hidden md:inline">•</span>
<a
href="/screen-recorder-windows"
- className="hover:text-gray-400 hover:underline text-xs"
+ className="text-xs hover:text-gray-400 hover:underline"
>
Windows Screen Recorder
</a>
<span className="hidden md:inline">•</span>
<a
href="/screen-recording-software"
- className="hover:text-gray-400 hover:underline text-xs"
+ className="text-xs hover:text-gray-400 hover:underline"
>
Recording Software
</a>
diff --git a/apps/web/components/pages/HomePage/index.tsx b/apps/web/components/pages/HomePage/index.tsx
index 4093b9f17..e9b3a24e4 100644
--- a/apps/web/components/pages/HomePage/index.tsx
+++ b/apps/web/components/pages/HomePage/index.tsx
@@ -4,7 +4,6 @@
import { ReadyToGetStarted } from "@/components/ReadyToGetStarted";
import {
- detectPlatform,
getDownloadButtonText,
getDownloadUrl,
getPlatformIcon,
@@ -16,34 +15,18 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import MuxPlayer from "@mux/mux-player-react";
import { useClickAway } from "@uidotdev/usehooks";
import { AnimatePresence, motion } from "framer-motion";
+import { useDetectPlatform } from "hooks/useDetectPlatform";
import Link from "next/link";
-import React, { useEffect, useState } from "react";
+import React, { useState } from "react";
import { Parallax, ParallaxProvider } from "react-scroll-parallax";
import { LogoSection } from "../_components/LogoSection";
+import { FeatureCard } from "../SelfHostingPage";
import LeftBlueHue from "./LeftBlueHue";
import PowerfulFeaturesSVG from "./PowerfulFeaturesSVG";
-import { FeatureCard } from "../SelfHostingPage";
export const HomePage = () => {
const [videoToggled, setVideoToggled] = useState(false);
- const [loading, setLoading] = useState(true);
- const [platform, setPlatform] = useState<string | null>(null);
- const [isIntel, setIsIntel] = useState(false);
-
- useEffect(() => {
- const detectUserPlatform = async () => {
- try {
- const { platform, isIntel } = await detectPlatform();
- setPlatform(platform);
- setIsIntel(isIntel);
- } catch (error) {
- console.error("Error detecting platform:", error);
- } finally {
- setLoading(false);
- }
- };
-
- detectUserPlatform();
- }, []);
+ const { platform, isIntel } = useDetectPlatform();
+ const loading = platform === null;
return (
<ParallaxProvider>
diff --git a/apps/web/hooks/useDetectPlatform.ts b/apps/web/hooks/useDetectPlatform.ts
new file mode 100644
index 000000000..3462505ac
--- /dev/null
+++ b/apps/web/hooks/useDetectPlatform.ts
@@ -0,0 +1,109 @@
+import { useEffect, useState } from "react";
+
+export interface PlatformInfo {
+ platform: string | null;
+ isIntel: boolean;
+}
+
+export const useDetectPlatform = (): PlatformInfo => {
+ const [platform, setPlatform] = useState<string | null>(null);
+ const [isIntel, setIsIntel] = useState(false);
+
+ useEffect(() => {
+ let isMounted = true;
+ const detect = async () => {
+ // First try to use the newer navigator.userAgentData API (Chrome, Edge)
+ if (
+ typeof navigator !== "undefined" &&
+ "userAgentData" in navigator &&
+ "getHighEntropyValues" in (navigator as any).userAgentData
+ ) {
+ try {
+ const uaData = await (
+ navigator as any
+ ).userAgentData.getHighEntropyValues(["architecture", "platform"]);
+ if (!isMounted) return;
+ if (uaData.platform === "macOS") {
+ setPlatform("macos");
+ setIsIntel(
+ uaData.architecture !== "arm" && uaData.architecture !== "arm64"
+ );
+ return;
+ } else if (uaData.platform === "Windows") {
+ setPlatform("windows");
+ setIsIntel(false);
+ return;
+ }
+ } catch (e) {
+ console.log("Error getting high entropy values:", e);
+ }
+ }
+
+ // Fallback to user agent detection
+ if (typeof navigator !== "undefined") {
+ const userAgent = navigator.userAgent;
+
+ if (userAgent.includes("Windows")) {
+ setPlatform("windows");
+ setIsIntel(false);
+ return;
+ } else if (userAgent.includes("Mac")) {
+ setPlatform("macos");
+
+ // For Macs, we need to do additional detection for Apple Silicon vs Intel
+ try {
+ // Try WebGL renderer detection (works in Chrome, Firefox)
+ const canvas = document.createElement("canvas");
+ const gl = canvas.getContext("webgl");
+
+ if (gl) {
+ const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
+ if (debugInfo) {
+ const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
+
+ // Apple Silicon Macs typically show "Apple GPU" in renderer
+ if (renderer.match(/Apple/) && !renderer.match(/Apple GPU/)) {
+ setIsIntel(true); // Likely Intel
+ return;
+ }
+
+ // For Safari which hides GPU info, check for specific extensions
+ if (renderer.match(/Apple GPU/)) {
+ // Check for specific WebGL extensions that might differ between architectures
+ const extensions = gl.getSupportedExtensions() || [];
+ // This is a heuristic and may need adjustment over time
+ if (
+ extensions.indexOf("WEBGL_compressed_texture_s3tc_srgb") ===
+ -1
+ ) {
+ setIsIntel(false); // Likely Apple Silicon
+ return;
+ }
+ }
+ }
+ }
+ // If we get here and it's a Mac, default to Intel for older Macs
+ setIsIntel(true);
+ } catch (e) {
+ console.log("Error detecting Mac architecture:", e);
+ setIsIntel(true);
+ }
+ } else if (userAgent.includes("Linux")) {
+ setPlatform("linux");
+ setIsIntel(false);
+ return;
+ } else {
+ // Default to macOS if we can't detect
+ setPlatform("macos");
+ setIsIntel(false);
+ }
+ }
+ };
+ detect();
+ return () => {
+ isMounted = false;
+ };
+ }, []);
+
+ return { platform, isIntel };
+};
\ No newline at end of file
diff --git a/apps/web/utils/platform.tsx b/apps/web/utils/platform.tsx
index 786e3e20c..f54558e79 100644
--- a/apps/web/utils/platform.tsx
+++ b/apps/web/utils/platform.tsx
@@ -1,104 +1,5 @@
import React from "react";
-export interface PlatformInfo {
- platform: string | null;
- isIntel: boolean;
-}
-
-export const detectPlatform = async (): Promise<PlatformInfo> => {
- let platform: string | null = null;
- let isIntel = false;
-
- // First try to use the newer navigator.userAgentData API (Chrome, Edge)
- if (
- typeof navigator !== "undefined" &&
- "userAgentData" in navigator &&
- "getHighEntropyValues" in (navigator as any).userAgentData
- ) {
- try {
- const uaData = await (
- navigator as any
- ).userAgentData.getHighEntropyValues(["architecture", "platform"]);
- if (uaData.platform === "macOS") {
- platform = "macos";
- isIntel =
- uaData.architecture !== "arm" && uaData.architecture !== "arm64";
- return { platform, isIntel };
- } else if (uaData.platform === "Windows") {
- platform = "windows";
- return { platform, isIntel };
- }
- } catch (e) {
- console.log("Error getting high entropy values:", e);
- }
- }
-
- // Fallback to user agent detection
- if (typeof navigator !== "undefined") {
- const userAgent = navigator.userAgent;
-
- if (userAgent.includes("Windows")) {
- platform = "windows";
- return { platform, isIntel };
- } else if (userAgent.includes("Mac")) {
- platform = "macos";
-
- // For Macs, we need to do additional detection for Apple Silicon vs Intel
- try {
- // Try WebGL renderer detection (works in Chrome, Firefox)
- const canvas = document.createElement("canvas");
- const gl = canvas.getContext("webgl");
-
- if (gl) {
- const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
- if (debugInfo) {
- const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
-
- if (renderer) {
- // Apple Silicon Macs typically show "Apple GPU" in renderer
- if (renderer.match(/Apple/) && !renderer.match(/Apple GPU/)) {
- isIntel = true; // Likely Intel
- return { platform, isIntel };
- }
-
- // For Safari which hides GPU info, check for specific extensions
- if (renderer.match(/Apple GPU/)) {
- // Check for specific WebGL extensions that might differ between architectures
- const extensions = gl.getSupportedExtensions() || [];
- // This is a heuristic and may need adjustment over time
- if (
- extensions.indexOf("WEBGL_compressed_texture_s3tc_srgb") ===
- -1
- ) {
- isIntel = false; // Likely Apple Silicon
- return { platform, isIntel };
- }
- }
- }
- }
- }
-
- // If we get here and it's a Mac, default to Intel for older Macs
- // This is a fallback and may not be 100% accurate
- isIntel = true;
- } catch (e) {
- console.log("Error detecting Mac architecture:", e);
- // Default to Intel as a safer fallback for older Macs
- isIntel = true;
- }
- } else if (userAgent.includes("Linux")) {
- platform = "linux";
- } else {
- // Default to macOS if we can't detect
- platform = "macos";
- // Default to Apple Silicon for newer Macs
- isIntel = false;
- }
- }
-
- return { platform, isIntel };
-};
-
export const getDownloadUrl = (
platform: string | null,
isIntel: boolean
@@ -132,13 +33,13 @@ export const getDownloadButtonText = (
export const getPlatformIcon = (platform: string | null): React.ReactNode => {
if (platform === "windows") {
return (
- <svg className="w-5 h-5 mr-2" viewBox="0 0 24 24" fill="currentColor">
+ <svg className="mr-2 w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M0,0H11.377V11.372H0ZM12.623,0H24V11.372H12.623ZM0,12.623H11.377V24H0Zm12.623,0H24V24H12.623" />
</svg>
);
} else if (platform === "macos") {
return (
- <svg className="w-5 h-5 mr-2" viewBox="0 0 24 24" fill="currentColor">
+ <svg className="mr-2 w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M18.71,19.5C17.88,20.74 17,21.95 15.66,21.97C14.32,22 13.89,21.18 12.37,21.18C10.84,21.18 10.37,21.95 9.1,22C7.79,22.05 6.8,20.68 5.96,19.47C4.25,17 2.94,12.45 4.7,9.39C5.57,7.87 7.13,6.91 8.82,6.88C10.1,6.86 11.32,7.75 12.11,7.75C12.89,7.75 14.37,6.68 15.92,6.84C16.57,6.87 18.39,7.1 19.56,8.82C19.47,8.88 17.39,10.1 17.41,12.63C17.44,15.65 20.06,16.66 20.09,16.67C20.06,16.74 19.67,18.11 18.71,19.5M13,3.5C13.73,2.67 14.94,2.04 15.94,2C16.07,3.17 15.6,4.35 14.9,5.19C14.21,6.04 13.07,6.7 11.95,6.61C11.8,5.46 12.36,4.26 13,3.5Z" />
</svg>
);
@@ -159,7 +60,7 @@ export const getVersionText = (platform: string | null): React.ReactNode => {
export const PlatformIcons: React.FC = () => {
return (
- <div className="relative z-10 mt-5 flex justify-center gap-3 animate-delay-2 fade-in-up">
+ <div className="flex relative z-10 gap-3 justify-center mt-5 animate-delay-2 fade-in-up">
<div>
<button
onClick={() => {
diff --git a/packages/ui/src/components/Button.tsx b/packages/ui/src/components/Button.tsx
index 922d63f41..46c665ba5 100644
--- a/packages/ui/src/components/Button.tsx
+++ b/packages/ui/src/components/Button.tsx
@@ -4,7 +4,7 @@ import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";
const buttonVariants = cva(
- "flex items-center justify-center cursor-pointer ring-offset-transparent relative min-w-[100px] button-gradient-border gap-1 rounded-[16px]",
+ "flex items-center justify-center cursor-pointer ring-offset-transparent relative min-w-[100px] button-gradient-border gap-1 rounded-xl",
{
defaultVariants: {
variant: "primary",
@@ -21,7 +21,7 @@ const buttonVariants = cva(
"bg-red-300 text-gray-50 hover:bg-red-400 disabled:bg-red-200 border-red-300",
white:
"bg-gray-50 text-gray-500 hover:bg-gray-100 border disabled:bg-gray-100 border-gray-200",
- gray: "bg-gray-200 text-gray-500 hover:bg-gray-200 disabled:bg-gray-100 border-transparent",
+ gray: "bg-gray-100 text-gray-500 hover:bg-gray-200 disabled:bg-gray-100 border-transparent",
dark: "bg-gradient-to-t from-[#0f0f0f] to-[#404040] shadow-[0_0_0_1px] hover:brightness-110 shadow-[#383838] text-gray-50 hover:bg-[#383838] disabled:bg-[#383838] border-transparent",
radialblue:
"text-gray-50 disabled:bg-gray-100 border-0 [background:radial-gradient(90%_100%_at_15%_12%,#9BC4FF_0%,#3588FF_100%)] border-transparent hover:opacity-80",
diff --git a/packages/ui/src/components/Card.tsx b/packages/ui/src/components/Card.tsx
index 225d19d54..71830ce89 100644
--- a/packages/ui/src/components/Card.tsx
+++ b/packages/ui/src/components/Card.tsx
@@ -1,5 +1,5 @@
-import { forwardRef } from "react";
import { classNames } from "@cap/utils";
+import { forwardRef } from "react";
const Card = forwardRef<
HTMLDivElement,
@@ -77,9 +77,9 @@ CardFooter.displayName = "CardFooter";
export {
Card,
- CardHeader,
+ CardContent,
+ CardDescription,
CardFooter,
+ CardHeader,
CardTitle,
- CardDescription,
- CardContent,
};
diff --git a/packages/ui/src/components/Pagination.tsx b/packages/ui/src/components/Pagination.tsx
index 953029046..ee21fc967 100644
--- a/packages/ui/src/components/Pagination.tsx
+++ b/packages/ui/src/components/Pagination.tsx
@@ -1,5 +1,5 @@
-import * as React from "react";
import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react";
+import * as React from "react";
import { classNames } from "@cap/utils";
import { ButtonProps, buttonVariants } from "./Button";
@@ -8,7 +8,7 @@ const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
<nav
role="navigation"
aria-label="pagination"
- className={classNames("mx-auto flex w-full justify-center", className)}
+ className={classNames("flex justify-center mx-auto w-full", className)}
{...props}
/>
);
@@ -20,7 +20,7 @@ const PaginationContent = React.forwardRef<
>(({ className, ...props }, ref) => (
<ul
ref={ref}
- className={classNames("flex flex-row items-center gap-1", className)}
+ className={classNames("flex flex-row gap-2 items-center", className)}
{...props}
/>
));
@@ -49,7 +49,7 @@ const PaginationLink = ({
aria-current={isActive ? "page" : undefined}
className={classNames(
buttonVariants({
- variant: isActive ? "primary" : "white",
+ variant: isActive ? "dark" : "white",
size,
}),
className
@@ -69,7 +69,7 @@ const PaginationPrevious = ({
className={classNames("gap-1 pl-2.5", className)}
{...props}
>
- <ChevronLeft className="h-4 w-4" />
+ <ChevronLeft className="w-4 h-4" />
<span>Previous</span>
</PaginationLink>
);
@@ -86,7 +86,7 @@ const PaginationNext = ({
{...props}
>
<span>Next</span>
- <ChevronRight className="h-4 w-4" />
+ <ChevronRight className="w-4 h-4" />
</PaginationLink>
);
PaginationNext.displayName = "PaginationNext";
@@ -98,12 +98,12 @@ const PaginationEllipsis = ({
<span
aria-hidden
className={classNames(
- "flex h-9 w-9 items-center justify-center",
+ "flex justify-center items-center w-9 h-9",
className
)}
{...props}
>
- <MoreHorizontal className="h-4 w-4" />
+ <MoreHorizontal className="w-4 h-4" />
<span className="sr-only">More pages</span>
</span>
);
diff --git a/packages/ui/src/components/SkeletonRows.tsx b/packages/ui/src/components/SkeletonRows.tsx
index 38379b54b..a12b6086b 100644
--- a/packages/ui/src/components/SkeletonRows.tsx
+++ b/packages/ui/src/components/SkeletonRows.tsx
@@ -5,28 +5,37 @@ import "react-loading-skeleton/dist/skeleton.css";
export const SkeletonRows = () => {
return (
- <div className="dashboard-page">
- <div className="space-y-6">
- <div className="w-full">
- <Skeleton
- count={3}
- containerClassName="w-full flex gap-6"
- className="bg-gray-500 h-[280px]"
- />
- </div>
- <div className="w-full">
- <Skeleton
- count={3}
- containerClassName="w-full flex gap-6"
- className="bg-gray-500 h-[280px]"
- />
- </div>
- <div className="w-full">
- <Skeleton
- count={3}
- containerClassName="w-full flex gap-6"
- className="bg-gray-500 h-[280px]"
- />
+ <div className="flex flex-col gap-5 pt-5 min-h-screen">
+ <div className="h-[8vh] lg:h-[5vh] border-b lg:border-0 border-gray-200 w-full mt-4 lg:mt-0 fixed top-12 lg:top-0 bg-gray-50 z-10 lg:relative flex items-center justify-between px-5 lg:pr-8 lg:pl-0">
+ <Skeleton
+ count={1}
+ containerClassName="w-full"
+ className="bg-gray-500 h-[30px] w-full max-w-[200px]"
+ />
+ </div>
+ <div className="flex overflow-auto flex-col flex-1 p-5 pb-5 bg-gray-100 border border-gray-200 mt-[120px] lg:mt-0 lg:rounded-tl-2xl lg:p-8">
+ <div className="space-y-6">
+ <div className="w-full">
+ <Skeleton
+ count={3}
+ containerClassName="w-full flex gap-6"
+ className="bg-gray-500 h-[280px]"
+ />
+ </div>
+ <div className="w-full">
+ <Skeleton
+ count={3}
+ containerClassName="w-full flex gap-6"
+ className="bg-gray-500 h-[280px]"
+ />
+ </div>
+ <div className="w-full">
+ <Skeleton
+ count={3}
+ containerClassName="w-full flex gap-6"
+ className="bg-gray-500 h-[280px]"
+ />
+ </div>
</div>
</div>
</div>