Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

update caps page, cards

ameer24685c664cc0da2c
diff --git a/apps/desktop/src/routes/mode-select.tsx b/apps/desktop/src/routes/mode-select.tsx
index 08301818c..b82cb4f3f 100644
--- a/apps/desktop/src/routes/mode-select.tsx
+++ b/apps/desktop/src/routes/mode-select.tsx
@@ -7,7 +7,7 @@ const ModeSelectWindow = () => {
class="flex relative justify-center items-center p-4 min-h-screen bg-gray-50"
>
<div class="relative z-10 space-y-10 w-full max-w-3xl">
- <h2 class="text-[24px] font-semibold text-center text-gray-500">
+ <h2 class="text-[24px] font-medium text-center text-gray-500">
Select your recording mode
</h2>
<ModeSelect />
diff --git a/apps/desktop/src/styles/theme.css b/apps/desktop/src/styles/theme.css
index 0abdc3a72..5ccc914fc 100644
--- a/apps/desktop/src/styles/theme.css
+++ b/apps/desktop/src/styles/theme.css
@@ -174,19 +174,6 @@
border-radius: 500px;
}
-/* SVG path animation */
-
-@keyframes svgpathframes {
- 0% {
- stroke-dasharray: 100;
- stroke-dashoffset: 100;
- }
- 50% {
- }
- 100% {
- stroke-dashoffset: 0;
- }
-}
@keyframes bounce {
0%, 100% {
@@ -204,6 +191,20 @@
animation-iteration-count: infinite;
}
+/* SVG path animation */
+
+@keyframes svgpathframes {
+ 0% {
+ stroke-dasharray: 100;
+ stroke-dashoffset: 100;
+ }
+ 50% {
+ }
+ 100% {
+ stroke-dashoffset: 0;
+ }
+}
+
.svgpathanimation {
stroke-dasharray: 100;
stroke-dashoffset: 100;
diff --git a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
index 1917417f1..3b4e495b4 100644
--- a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
+++ b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
@@ -88,14 +88,18 @@ export const AdminNavItems = ({ collapsed }: { collapsed?: boolean }) => {
return (
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
- <Tooltip
- disable={collapsed === false}
- position="right"
- content={activeSpace?.space.name ?? "No space found"}
- >
- <div className="p-3 w-full rounded-xl border border-gray-200">
- <Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger asChild>
+ <Popover open={open} onOpenChange={setOpen}>
+ <Tooltip
+ disable={open || collapsed === false}
+ position="right"
+ content={activeSpace?.space.name ?? "No space found"}
+ >
+ <PopoverTrigger asChild>
+ <div
+ className={
+ "p-3 w-full rounded-xl border border-gray-200 cursor-pointer"
+ }
+ >
<div
className="flex justify-between items-center cursor-pointer"
role="combobox"
@@ -116,45 +120,51 @@ export const AdminNavItems = ({ collapsed }: { collapsed?: boolean }) => {
)}
</div>
</div>
- </PopoverTrigger>
- <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>
- <CommandGroup>
- {spaceData?.map((space) => {
- const isSelected = activeSpace?.space.id === space.space.id;
- return (
- <CommandItem
- key={space.space.name + "-space"}
- onSelect={async () => {
- await updateActiveSpace(space.space.id);
- setOpen(false);
- }}
- >
- {space.space.name}
- <Check
- size={18}
- className={classNames(
- "ml-auto",
- isSelected ? "opacity-100" : "opacity-0"
- )}
- />
+ <PopoverContent
+ className={clsx(
+ "p-0 w-[calc(100%-12px)] bg-white z-[60]",
+ collapsed ? "ml-3" : "mx-auto"
+ )}
+ >
+ <Command>
+ <CommandInput placeholder="Search spaces..." />
+ <CommandEmpty>No spaces found</CommandEmpty>
+ <CommandGroup>
+ {spaceData?.map((space) => {
+ const isSelected =
+ activeSpace?.space.id === space.space.id;
+ return (
+ <CommandItem
+ key={space.space.name + "-space"}
+ onSelect={async () => {
+ await updateActiveSpace(space.space.id);
+ setOpen(false);
+ }}
+ >
+ {space.space.name}
+ <Check
+ size={18}
+ className={classNames(
+ "ml-auto",
+ isSelected ? "opacity-100" : "opacity-0"
+ )}
+ />
+ </CommandItem>
+ );
+ })}
+ <DialogTrigger className="w-full">
+ <CommandItem className="bg-gray-100 rounded-lg border border-gray-200 aria-selected:bg-gray-200">
+ <Plus className="mr-1 w-4 h-auto" />
+ <span className="text-sm">Add new space</span>
</CommandItem>
- );
- })}
- <DialogTrigger className="w-full">
- <CommandItem className="bg-gray-100 rounded-lg border border-gray-200 aria-selected:bg-gray-200">
- <Plus className="mr-1 w-4 h-auto" />
- <span className="text-sm">Add new space</span>
- </CommandItem>
- </DialogTrigger>
- </CommandGroup>
- </Command>
- </PopoverContent>
- </Popover>
- </div>
- </Tooltip>
+ </DialogTrigger>
+ </CommandGroup>
+ </Command>
+ </PopoverContent>
+ </div>
+ </PopoverTrigger>
+ </Tooltip>
+ </Popover>
<nav
className="flex flex-col justify-between w-full h-full"
aria-label="Sidebar"
diff --git a/apps/web/app/dashboard/caps/Caps.tsx b/apps/web/app/dashboard/caps/Caps.tsx
index cef24e8e6..1f98ce7fd 100644
--- a/apps/web/app/dashboard/caps/Caps.tsx
+++ b/apps/web/app/dashboard/caps/Caps.tsx
@@ -87,7 +87,7 @@ export const Caps = ({
emptyComponent={<EmptyCapState userName={user?.name || ""} />}
>
<div className="flex flex-col w-full">
- <div className="grid grid-cols-1 gap-4 sm:gap-6 sm:grid-cols-2 lg: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-2 xl:grid-cols-3 2xl:grid-cols-4">
{data.map((cap) => (
<CapCard
key={cap.id}
diff --git a/apps/web/app/dashboard/caps/components/CapCard.tsx b/apps/web/app/dashboard/caps/components/CapCard.tsx
index 0a669e60b..9c0eee5b1 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 { faLink, faTrash } from "@fortawesome/free-solid-svg-icons";
+import { faCopy, faLink, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import moment from "moment";
import Link from "next/link";
@@ -50,6 +50,7 @@ export const CapCard: React.FC<CapCardProps> = ({
const [isSharingDialogOpen, setIsSharingDialogOpen] = useState(false);
const [sharedSpaces, setSharedSpaces] = useState(cap.sharedSpaces);
const [isDateEditing, setIsDateEditing] = useState(false);
+ const [copyPressed, setCopyPressed] = useState(false);
const [dateValue, setDateValue] = useState(
moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss")
);
@@ -156,6 +157,14 @@ export const CapCard: React.FC<CapCardProps> = ({
}
};
+ const handleCopy = (text: string) => {
+ navigator.clipboard.writeText(text);
+ setCopyPressed(true);
+ setTimeout(() => {
+ setCopyPressed(false);
+ }, 2000);
+ };
+
return (
<>
<SharingDialog
@@ -243,15 +252,15 @@ export const CapCard: React.FC<CapCardProps> = ({
totalReactions={cap.totalReactions}
/>
</div>
- <div className="flex flex-wrap gap-3 items-center mt-auto w-full">
+ <div className="flex flex-wrap gap-5 justify-between items-center mt-auto w-full">
<Button
onClick={() => setIsSharingDialogOpen(true)}
className="flex-1 h-10 rounded-xl"
- variant="white"
+ variant="dark"
size="sm"
>
<FontAwesomeIcon
- className="mr-1 text-gray-400 size-4"
+ className="mr-1 text-gray-300 size-4"
icon={faLink}
/>
{isOwner
@@ -260,18 +269,60 @@ export const CapCard: React.FC<CapCardProps> = ({
: "Shared"
: "Shared with you"}
</Button>
- <Button
- onClick={() => onDelete?.(cap.id)}
- className="flex-1 h-10 rounded-xl"
- variant="white"
- size="sm"
- >
- <FontAwesomeIcon
- className="mr-1 text-gray-400 size-4"
- icon={faTrash}
- />
- Delete
- </Button>
+ <div className="flex flex-1 gap-3 justify-end">
+ <Tooltip content="Copy link">
+ <Button
+ onClick={() =>
+ handleCopy(
+ activeSpace?.space.customDomain
+ ? `https://${activeSpace.space.customDomain}/s/${cap.id}`
+ : clientEnv.NEXT_PUBLIC_IS_CAP &&
+ NODE_ENV === "production"
+ ? `https://cap.link/${cap.id}`
+ : `${clientEnv.NEXT_PUBLIC_WEB_URL}/s/${cap.id}`
+ )
+ }
+ className="h-10 rounded-xl min-w-fit"
+ variant="white"
+ size="sm"
+ >
+ {!copyPressed ? (
+ <FontAwesomeIcon
+ className="mr-1 text-gray-400 size-4"
+ icon={faCopy}
+ />
+ ) : (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ className="text-gray-400 size-5 svgpathanimation"
+ >
+ <path d="M20 6 9 17l-5-5" />
+ </svg>
+ )}
+ </Button>
+ </Tooltip>
+ <Tooltip content="Delete Cap">
+ <Button
+ onClick={() => onDelete?.(cap.id)}
+ className="h-10 rounded-xl min-w-fit"
+ variant="white"
+ size="sm"
+ >
+ <FontAwesomeIcon
+ className="mr-1 text-gray-400 size-4"
+ icon={faTrash}
+ />
+ </Button>
+ </Tooltip>
+ </div>
</div>
</div>
</>
diff --git a/apps/web/app/dashboard/caps/components/SharingDialog.tsx b/apps/web/app/dashboard/caps/components/SharingDialog.tsx
index 8fc51a266..2897f0634 100644
--- a/apps/web/app/dashboard/caps/components/SharingDialog.tsx
+++ b/apps/web/app/dashboard/caps/components/SharingDialog.tsx
@@ -1,5 +1,5 @@
import { Button, Input } from "@cap/ui";
-import { faBuilding, faShareNodes } from "@fortawesome/free-solid-svg-icons";
+import { faShareNodes } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Dialog, Transition } from "@headlessui/react";
import clsx from "clsx";
@@ -165,11 +165,7 @@ export const SharingDialog: React.FC<SharingDialogProps> = ({
))
) : (
<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>
+ <p className="font-medium text-gray-500">No spaces found</p>
</div>
)}
</div>
diff --git a/apps/web/app/dashboard/settings/workspace/Workspace.tsx b/apps/web/app/dashboard/settings/workspace/Workspace.tsx
index 1d71207e4..8f48e8f2c 100644
--- a/apps/web/app/dashboard/settings/workspace/Workspace.tsx
+++ b/apps/web/app/dashboard/settings/workspace/Workspace.tsx
@@ -264,7 +264,7 @@ export const Workspace = () => {
<Button
type="button"
size="sm"
- variant="gray"
+ variant="white"
onClick={() => {
if (!isOwner) {
showOwnerToast();
diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css
index 7fb82a738..0866a9ac6 100644
--- a/apps/web/app/globals.css
+++ b/apps/web/app/globals.css
@@ -141,6 +141,32 @@ a.bg-primary:hover {
}
}
+/* SVG path animation */
+
+@keyframes svgpathframes {
+ 0% {
+ stroke-dasharray: 100;
+ stroke-dashoffset: 100;
+ }
+ 50% {
+ }
+ 100% {
+ stroke-dashoffset: 0;
+ }
+}
+
+.svgpathanimation {
+ stroke-dasharray: 100;
+ stroke-dashoffset: 100;
+ animation: svgpathframes 0.5s ease-in-out forwards;
+}
+
+.svgpathanimationrepeat {
+ animation: svgpathframes 0.5s ease-in-out forwards;
+ animation-iteration-count: infinite;
+}
+
+
@keyframes slideLeft {
from {
opacity: 0;
@@ -501,7 +527,7 @@ footer a {
@keyframes slideUp {
from {
opacity: 0;
- transform: translateY(20px);
+ transform: translateY(5px);
}
to {
opacity: 1;
diff --git a/apps/web/public/icons/check.svg b/apps/web/public/icons/check.svg
new file mode 100644
index 000000000..6e390aaca
--- /dev/null
+++ b/apps/web/public/icons/check.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check-icon lucide-check"><path d="M20 6 9 17l-5-5"/></svg>
\ No newline at end of file
diff --git a/packages/ui/src/components/Button.tsx b/packages/ui/src/components/Button.tsx
index 1f2e0af1f..60245d729 100644
--- a/packages/ui/src/components/Button.tsx
+++ b/packages/ui/src/components/Button.tsx
@@ -21,13 +21,13 @@ 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-100 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-gray-200 border",
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 border shadow-[0_0_0_1px] shadow-blue-400 disabled:bg-gray-100 border-0 [background:radial-gradient(90%_100%_at_15%_12%,#9BC4FF_0%,#3588FF_100%)] border-transparent hover:opacity-80",
},
size: {
- xs: "text-[0.75rem] h-[32px] px-[0.5rem] ",
+ xs: "text-sm h-[32px] px-[0.5rem] ",
sm: "text-sm h-[40px] px-[0.75rem]",
md: "text-sm px-[1rem] h-[48px]",
lg: "text-md h-[48px] px-[1.25em]",
diff --git a/packages/ui/src/components/Card.tsx b/packages/ui/src/components/Card.tsx
index 71830ce89..feecf6753 100644
--- a/packages/ui/src/components/Card.tsx
+++ b/packages/ui/src/components/Card.tsx
@@ -35,7 +35,7 @@ const CardTitle = forwardRef<
<h3
ref={ref}
className={classNames(
- "text-lg font-semibold leading-none tracking-tight",
+ "text-lg font-semibold tracking-tight leading-none",
className
)}
{...props}
@@ -59,7 +59,14 @@ const CardContent = forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
- <div ref={ref} className={classNames("p-6 pt-0", className)} {...props} />
+ <div
+ ref={ref}
+ className={classNames(
+ "p-6 pt-0 bg-gray-50 border border-gray-200",
+ className
+ )}
+ {...props}
+ />
));
CardContent.displayName = "CardContent";
@@ -69,7 +76,7 @@ const CardFooter = forwardRef<
>(({ className, ...props }, ref) => (
<div
ref={ref}
- className={classNames(" flex items-center p-6 pt-0", className)}
+ className={classNames("flex items-center p-6 pt-0", className)}
{...props}
/>
));
diff --git a/packages/ui/src/components/input/Input.tsx b/packages/ui/src/components/input/Input.tsx
index c38335365..d7a759476 100644
--- a/packages/ui/src/components/input/Input.tsx
+++ b/packages/ui/src/components/input/Input.tsx
@@ -12,7 +12,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
type={type}
className={classNames(
"flex px-4 w-full text-sm font-thin text-gray-500 bg-gray-50 border-gray-200 transition-all duration-300 outline-0 focus:bg-gray-50",
- "hover:bg-gray-100 h-[48px] placeholder:text-gray-400 py-[14px] rounded-[16px] border-[1px] focus:border-gray-500",
+ "rounded-2xl hover:bg-gray-100 h-[48px] placeholder:text-gray-400 py-[14px] border-[1px] focus:border-gray-500",
"file:border-0 file:bg-transparent file:text-sm file:font-medium",
"disabled:cursor-not-allowed disabled:opacity-50 placeholder:transition-all",
"ring-0 focus:ring-2 focus:ring-gray-300 focus:ring-offset-2 placeholder:duration-300 hover:placeholder:text-gray-500",