Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

wip

ameer2468c4db8ad5f687
diff --git a/apps/web/app/dashboard/caps/components/CapCard.tsx b/apps/web/app/dashboard/caps/components/CapCard.tsx
index 9c0eee5b1..627045b94 100644
--- a/apps/web/app/dashboard/caps/components/CapCard.tsx
+++ b/apps/web/app/dashboard/caps/components/CapCard.tsx
@@ -8,7 +8,7 @@ import { VideoThumbnail } from "@/components/VideoThumbnail";
import { VideoMetadata } from "@cap/database/types";
import { clientEnv, NODE_ENV } from "@cap/env";
import { Button } from "@cap/ui";
-import { faCopy, faLink, faTrash } from "@fortawesome/free-solid-svg-icons";
+import { faLink, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import moment from "moment";
import Link from "next/link";
@@ -289,7 +289,7 @@ export const CapCard: React.FC<CapCardProps> = ({
{!copyPressed ? (
<FontAwesomeIcon
className="mr-1 text-gray-400 size-4"
- icon={faCopy}
+ icon={faLink}
/>
) : (
<svg
diff --git a/apps/web/app/dashboard/settings/layout.tsx b/apps/web/app/dashboard/settings/layout.tsx
index 5bbbc6b83..5ce1df5a7 100644
--- a/apps/web/app/dashboard/settings/layout.tsx
+++ b/apps/web/app/dashboard/settings/layout.tsx
@@ -1,8 +1,5 @@
"use client";
-import { CardHeader } from "@cap/ui";
-import Link from "next/link";
-import { usePathname } from "next/navigation";
import DashboardInner from "../_components/DashboardInner";
export default function DashboardLayout({
@@ -10,36 +7,5 @@ export default function DashboardLayout({
}: {
children: React.ReactNode;
}) {
- const pathname = usePathname();
-
- const secondaryNavigation = [
- { name: "Account", href: "/dashboard/settings" },
- { name: "Workspace", href: "/dashboard/settings/workspace" },
- ];
-
- return (
- <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>
- );
+ return <DashboardInner title="Settings">{children}</DashboardInner>;
}
diff --git a/apps/web/app/dashboard/settings/workspace/Workspace.tsx b/apps/web/app/dashboard/settings/workspace/Workspace.tsx
index 8f48e8f2c..974b3e139 100644
--- a/apps/web/app/dashboard/settings/workspace/Workspace.tsx
+++ b/apps/web/app/dashboard/settings/workspace/Workspace.tsx
@@ -10,7 +10,6 @@ import {
Button,
CardContent,
CardDescription,
- CardFooter,
CardHeader,
CardTitle,
Dialog,
@@ -28,6 +27,12 @@ import {
TableHeader,
TableRow,
} from "@cap/ui";
+import {
+ faChair,
+ faCloudUpload,
+ faUserGroup,
+} from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format } from "date-fns";
import { useRouter } from "next/navigation";
import { useRef, useState } from "react";
@@ -35,7 +40,7 @@ import toast from "react-hot-toast";
import { CustomDomain } from "./components/CustomDomain";
export const Workspace = () => {
- const { spaceData, activeSpace, user } = useSharedContext();
+ const { activeSpace, user } = useSharedContext();
const workspaceName = activeSpace?.space.name;
const router = useRouter();
const [loading, setLoading] = useState(false);
@@ -44,6 +49,7 @@ export const Workspace = () => {
const [inviteEmails, setInviteEmails] = useState<string[]>([]);
const [emailInput, setEmailInput] = useState("");
const ownerToastShown = useRef(false);
+ const fileInputRef = useRef<HTMLInputElement>(null);
const showOwnerToast = () => {
if (!ownerToastShown.current) {
@@ -155,136 +161,183 @@ export const Workspace = () => {
</CardDescription>
</CardContent>
)}
- <CardContent>
- <CardTitle>Workspace Details</CardTitle>
- <CardDescription>
- Changing the name and image will update how your workspace appears to
- others members.
- </CardDescription>
- </CardContent>
- <CardContent>
- <div className="space-y-3">
- <div>
- <Label htmlFor="workspaceName">Workspace name</Label>
- <Input
- type="text"
- defaultValue={workspaceName as string}
- id="workspaceName"
- name="workspaceName"
- disabled={!isOwner}
- onChange={() => {
- if (!isOwner) showOwnerToast();
- }}
- />
+
+ <div className="flex flex-col flex-1 gap-6 justify-center lg:flex-row">
+ <CardContent className="flex flex-col flex-1 gap-3 justify-center items-center">
+ <FontAwesomeIcon className="text-gray-400 size-5" icon={faChair} />
+ <p>
+ Seats Remaining
+ <span className="ml-2 font-bold text-gray-500">
+ {activeSpace?.inviteQuota ?? 1 - (activeSpace?.totalInvites ?? 1)}
+ </span>
+ </p>
+ </CardContent>
+ <CardContent className="flex flex-col flex-1 gap-3 justify-center items-center">
+ <FontAwesomeIcon
+ className="text-gray-400 size-5"
+ icon={faUserGroup}
+ />
+ <p>
+ Seats Capacity
+ <span className="ml-2 font-bold text-gray-500">
+ {activeSpace?.inviteQuota}
+ </span>
+ </p>
+ </CardContent>
+ </div>
+
+ <div className="flex flex-col flex-1 gap-6 justify-center items-center mt-6 xl:flex-row">
+ <CardContent className="flex-1 w-full">
+ <div className="flex flex-col gap-6 justify-center items-center lg:flex-row">
+ <div className="flex-1 w-full">
+ <div className="space-y-1">
+ <Label htmlFor="workspaceName">Name</Label>
+ <p className="text-sm text-gray-400">
+ Changing the name will update how your workspace appears to
+ others members.
+ </p>
+ </div>
+ <Input
+ className="mt-4"
+ type="text"
+ defaultValue={workspaceName as string}
+ id="workspaceName"
+ name="workspaceName"
+ disabled={!isOwner}
+ onChange={() => {
+ if (!isOwner) showOwnerToast();
+ }}
+ />
+ </div>
+ <div className="flex-1 w-full">
+ <div className="space-y-1">
+ <Label htmlFor="allowedEmailDomain">Access email domain</Label>
+ <p className="mt-1 text-sm text-gray-400">
+ Only emails from this domain can access shared videos.{" "}
+ <b>Leave blank to allow everyone.</b>
+ </p>
+ </div>
+ <Input
+ type="text"
+ placeholder="e.g. company.com"
+ defaultValue={activeSpace?.space.allowedEmailDomain || ""}
+ id="allowedEmailDomain"
+ name="allowedEmailDomain"
+ disabled={!isOwner}
+ className="mt-4"
+ onChange={() => {
+ if (!isOwner) showOwnerToast();
+ }}
+ />
+ </div>
+ </div>
+ <Button
+ className="mt-8"
+ type="submit"
+ size="sm"
+ variant="dark"
+ disabled={!isOwner}
+ onClick={() => {
+ if (!isOwner) showOwnerToast();
+ }}
+ >
+ Save
+ </Button>
+ </CardContent>
+ <CardContent className="flex flex-col flex-1 gap-6 w-full lg:flex-row">
+ <div className="flex-1">
+ <div className="space-y-1">
+ <Label htmlFor="customDomain">Custom Domain</Label>
+ <CardDescription className="w-full max-w-[400px]">
+ Set up a custom domain for your workspace’s shared caps and make
+ it unique.
+ </CardDescription>
+ </div>
+ <div className="mt-4">
+ <CustomDomain />
+ </div>
</div>
- <div>
- <Label htmlFor="allowedEmailDomain">
- Workspace Access Requirements
- </Label>
+ <div className="flex-1">
+ <div className="space-y-1">
+ <Label htmlFor="icon">Icon</Label>
+ <CardDescription className="w-full max-w-[400px]">
+ Upload a custom logo or icon for your workspace and make it
+ unique.
+ </CardDescription>
+ </div>
+ <div
+ onClick={() => fileInputRef.current?.click()}
+ className="w-full hover:bg-gray-100 transition-all duration-300 gap-3 border-gray-300 mt-4 border px-4 flex items-center justify-center py-[14px] border-dashed rounded-2xl"
+ >
+ <FontAwesomeIcon
+ className="text-gray-400 size-5"
+ icon={faCloudUpload}
+ />
+ <p className="text-xs text-gray-400 truncate">
+ Choose a file or drag & drop it here
+ </p>
+ </div>
<Input
- type="text"
- placeholder="e.g. company.com"
- defaultValue={activeSpace?.space.allowedEmailDomain || ""}
- id="allowedEmailDomain"
- name="allowedEmailDomain"
+ className="hidden"
+ type="file"
+ ref={fileInputRef}
+ id="icon"
disabled={!isOwner}
onChange={() => {
if (!isOwner) showOwnerToast();
}}
+ name="icon"
/>
- <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.
- </p>
- </div>
- </div>
- </CardContent>
- <CardFooter className="px-6 pt-0 pb-6 border-b">
- <Button
- type="submit"
- size="sm"
- variant="dark"
- disabled={!isOwner}
- onClick={() => {
- if (!isOwner) showOwnerToast();
- }}
- >
- Save
- </Button>
- </CardFooter>
- <>
- <CardContent className="pt-6">
- <CardTitle>Custom Domain</CardTitle>
- <CardDescription>
- Configure a custom domain for your workspace's shared caps.
- </CardDescription>
- <div className="mt-4">
- <CustomDomain />
</div>
</CardContent>
- <CardFooter className="px-6 pt-0 pb-2 border-b"></CardFooter>
- </>
- <CardHeader>
- <div className="flex justify-between items-center">
- <div>
- <CardTitle>Workspace Members</CardTitle>
+ </div>
+
+ <CardContent className="mt-6">
+ <div className="flex flex-wrap gap-6 justify-between items-center w-full">
+ <CardHeader>
+ <CardTitle>Members</CardTitle>
<CardDescription>Manage your workspace members.</CardDescription>
- <CardDescription>
- Current seats capacity:{" "}
- {`${activeSpace?.inviteQuota} paid ${
- activeSpace && activeSpace?.inviteQuota > 1
- ? "subscriptions"
- : "subscription"
- } across all of your workspaces`}
- </CardDescription>
- <CardDescription>
- Seats remaining:{" "}
- {activeSpace?.inviteQuota ?? 1 - (activeSpace?.totalInvites ?? 1)}
- </CardDescription>
- </div>
- </div>
- </CardHeader>
- <CardContent>
- <div className="flex items-center space-x-2">
- <Tooltip
- position="top"
- content="Once inside the Stripe dashboard, click 'Manage Plan', then increase quantity of subscriptions to purchase more seats"
- >
+ </CardHeader>
+ <div className="flex flex-wrap gap-3">
+ <Tooltip
+ position="top"
+ content="Once inside the Stripe dashboard, click 'Manage Plan', then increase quantity of subscriptions to purchase more seats"
+ >
+ <Button
+ type="button"
+ size="sm"
+ variant="primary"
+ disabled={!isOwner || loading}
+ onClick={handleManageBilling}
+ >
+ {loading ? "Loading..." : "+ Purchase more seats"}
+ </Button>
+ </Tooltip>
<Button
type="button"
size="sm"
- variant="primary"
- disabled={!isOwner || loading}
- onClick={handleManageBilling}
+ variant="white"
+ onClick={() => {
+ if (!isOwner) {
+ showOwnerToast();
+ } else if (
+ activeSpace &&
+ activeSpace.inviteQuota <= activeSpace.totalInvites
+ ) {
+ toast.error(
+ "Invite limit reached, please purchase more seats"
+ );
+ } else {
+ setIsInviteDialogOpen(true);
+ }
+ }}
+ disabled={!isOwner}
>
- {loading ? "Loading..." : "+ Purchase more seats"}
+ Invite users
</Button>
- </Tooltip>
- <Button
- type="button"
- size="sm"
- variant="white"
- onClick={() => {
- if (!isOwner) {
- showOwnerToast();
- } else if (
- activeSpace &&
- activeSpace.inviteQuota <= activeSpace.totalInvites
- ) {
- toast.error("Invite limit reached, please purchase more seats");
- } else {
- setIsInviteDialogOpen(true);
- }
- }}
- disabled={!isOwner}
- >
- Invite users
- </Button>
+ </div>
</div>
- </CardContent>
- <CardContent>
- <Table>
+ <Table className="mt-5">
<TableHeader>
<TableRow>
<TableHead>{"Member"}</TableHead>
@@ -343,25 +396,23 @@ export const Workspace = () => {
</TableBody>
</Table>
</CardContent>
- <CardHeader>
- <CardTitle>View and manage your billing details</CardTitle>
- <CardDescription>
- View and edit your billing details, as well as manage your
- subscription.
- </CardDescription>
- </CardHeader>
- <CardContent>
- <CardDescription className="mt-1">
- <Button
- type="button"
- size="sm"
- variant="gray"
- onClick={handleManageBilling}
- disabled={!isOwner}
- >
- {loading ? "Loading..." : "Manage Billing"}
- </Button>
- </CardDescription>
+ <CardContent className="flex flex-wrap gap-6 justify-between items-center mt-6 w-full">
+ <CardHeader>
+ <CardTitle>View and manage your billing details</CardTitle>
+ <CardDescription>
+ View and edit your billing details, as well as manage your
+ subscription.
+ </CardDescription>
+ </CardHeader>
+ <Button
+ type="button"
+ size="sm"
+ variant="gray"
+ onClick={handleManageBilling}
+ disabled={!isOwner}
+ >
+ {loading ? "Loading..." : "Manage Billing"}
+ </Button>
</CardContent>
<Dialog open={isInviteDialogOpen} onOpenChange={setIsInviteDialogOpen}>
diff --git a/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx b/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx
index fc3e0b052..713091e3a 100644
--- a/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx
+++ b/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx
@@ -6,7 +6,7 @@ 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 { Button, Input } from "@cap/ui";
import { Check, CheckCircle, Copy, RefreshCw, XCircle } from "lucide-react";
import { useRouter } from "next/navigation";
import { useEffect, useRef, useState } from "react";
@@ -275,10 +275,7 @@ export function CustomDomain() {
return (
<div className="space-y-6">
<div>
- <Label htmlFor="customDomain" className="text-sm font-medium">
- Add your custom domain here
- </Label>
- <div className="flex gap-2 items-center mt-2">
+ <div className="flex flex-col items-start mt-2">
<Input
type="text"
id="customDomain"
@@ -289,8 +286,10 @@ export function CustomDomain() {
className="flex-1"
/>
<Button
+ className="mt-8"
+ type="submit"
+ size="sm"
variant="dark"
- type="button"
onClick={handleSubmit}
disabled={loading}
>
diff --git a/packages/ui/src/components/Card.tsx b/packages/ui/src/components/Card.tsx
index feecf6753..eb80ae289 100644
--- a/packages/ui/src/components/Card.tsx
+++ b/packages/ui/src/components/Card.tsx
@@ -22,7 +22,7 @@ const CardHeader = forwardRef<
>(({ className, ...props }, ref) => (
<div
ref={ref}
- className={classNames("flex flex-col space-y-1.5 p-6", className)}
+ className={classNames("flex flex-col space-y-1.5", className)}
{...props}
/>
));
@@ -62,7 +62,7 @@ const CardContent = forwardRef<
<div
ref={ref}
className={classNames(
- "p-6 pt-0 bg-gray-50 border border-gray-200",
+ "p-5 bg-gray-50 rounded-2xl border border-gray-200",
className
)}
{...props}
diff --git a/packages/ui/src/components/input/Label.tsx b/packages/ui/src/components/input/Label.tsx
index 8a0f56d59..269206007 100644
--- a/packages/ui/src/components/input/Label.tsx
+++ b/packages/ui/src/components/input/Label.tsx
@@ -1,14 +1,12 @@
"use client";
-import * as React from "react";
import * as LabelPrimitive from "@radix-ui/react-label";
import { cva, type VariantProps } from "class-variance-authority";
+import * as React from "react";
import { classNames } from "@cap/utils";
-const labelVariants = cva(
- "text-[14px] font-normal text-gray-400 leading-[20px] peer-disabled:cursor-not-allowed peer-disabled:opacity-70 mb-1.5"
-);
+const labelVariants = cva("text-md text-gray-500 font-medium");
const Label = React.forwardRef<
React.ElementRef<typeof LabelPrimitive.Root>,