Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Update cards, workspace page, and more

ameer2468f525e46fb847
diff --git a/apps/web/app/dashboard/caps/Caps.tsx b/apps/web/app/dashboard/caps/Caps.tsx
index 1f98ce7fd..9ed45c834 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-2 xl:grid-cols-3 2xl: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 2xl:grid-cols-5">
{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 627045b94..ee7cb046d 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 { faLink, faTrash, faUserPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import moment from "moment";
import Link from "next/link";
@@ -58,7 +58,8 @@ export const CapCard: React.FC<CapCardProps> = ({
const router = useRouter();
const { activeSpace } = useSharedContext();
- const handleTitleBlur = async () => {
+ const handleTitleBlur = async (capName: string) => {
+ if (capName === title) return;
if (!title) {
setIsEditing(false);
return;
@@ -78,20 +79,11 @@ export const CapCard: React.FC<CapCardProps> = ({
}
};
- const handleTitleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
- if (e.key === "Enter") {
- e.preventDefault();
- handleTitleBlur();
- }
- };
-
const displayCount =
analytics === 0
? Math.max(cap.totalComments, cap.totalReactions)
: analytics;
- const isOwner = userId === cap.ownerId;
-
const handleSharingUpdated = (updatedSharedSpaces: string[]) => {
setSharedSpaces(
userSpaces.filter((space) => updatedSharedSpaces.includes(space.id))
@@ -165,6 +157,16 @@ export const CapCard: React.FC<CapCardProps> = ({
}, 2000);
};
+ const handleTitleKeyDown = (
+ e: React.KeyboardEvent<HTMLTextAreaElement>,
+ capName: string
+ ) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ handleTitleBlur(capName);
+ }
+ };
+
return (
<>
<SharingDialog
@@ -176,7 +178,73 @@ export const CapCard: React.FC<CapCardProps> = ({
userSpaces={userSpaces}
onSharingUpdated={handleSharingUpdated}
/>
- <div className="relative rounded-2xl flex flex-col gap-4 w-full h-full p-4 border-gray-200 bg-gray-50 border-[1px]">
+ <div className="flex relative flex-col gap-4 p-4 w-full h-full bg-gray-50 rounded-2xl border-gray-200 transition-colors duration-300 group hover:border-blue-300 border-[1px]">
+ <div className="flex absolute duration-200 group-hover:opacity-100 opacity-0 top-6 right-6 z-[20] flex-col gap-2">
+ <Tooltip disable={isSharingDialogOpen} content="Share to spaces">
+ <Button
+ onClick={() => setIsSharingDialogOpen(true)}
+ className="!size-8 delay-0 hover:opacity-80 rounded-full min-w-fit !p-0"
+ variant="white"
+ size="sm"
+ >
+ <FontAwesomeIcon
+ className="text-gray-400 size-3.5"
+ icon={faUserPlus}
+ />
+ </Button>
+ </Tooltip>
+ <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="!size-8 delay-0 hover:opacity-80 rounded-full min-w-fit !p-0"
+ variant="white"
+ size="sm"
+ >
+ {!copyPressed ? (
+ <FontAwesomeIcon
+ className="text-gray-400 size-4"
+ icon={faLink}
+ />
+ ) : (
+ <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="!size-8 delay-100 hover:opacity-80 rounded-full min-w-fit !p-0"
+ variant="white"
+ size="sm"
+ >
+ <FontAwesomeIcon
+ className="text-gray-400 size-2.5"
+ icon={faTrash}
+ />
+ </Button>
+ </Tooltip>
+ </div>
<Link
className="block group"
href={
@@ -188,22 +256,23 @@ export const CapCard: React.FC<CapCardProps> = ({
}
>
<VideoThumbnail
+ imageClass="group-hover:opacity-50 transition-opacity duration-200"
userId={cap.ownerId}
videoId={cap.id}
alt={`${cap.name} Thumbnail`}
/>
</Link>
- <div className="flex flex-col flex-grow gap-3 w-full">
+ <div className="flex flex-col flex-grow gap-3 w-full cursor-pointer">
<div>
{isEditing ? (
<textarea
rows={1}
value={title}
onChange={(e) => setTitle(e.target.value)}
- onBlur={handleTitleBlur}
- onKeyDown={handleTitleKeyDown}
+ onBlur={() => handleTitleBlur(cap.name)}
+ onKeyDown={(e) => handleTitleKeyDown(e, cap.name)}
autoFocus
- className="text-md truncate leading-[1.25rem] text-gray-500 font-medium box-border mb-1"
+ className="text-md resize-none truncate w-full border-0 outline-0 leading-[1.25rem] text-gray-500 font-medium mb-1"
/>
) : (
<p
@@ -252,78 +321,6 @@ export const CapCard: React.FC<CapCardProps> = ({
totalReactions={cap.totalReactions}
/>
</div>
- <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="dark"
- size="sm"
- >
- <FontAwesomeIcon
- className="mr-1 text-gray-300 size-4"
- icon={faLink}
- />
- {isOwner
- ? cap.sharedSpaces.length === 0
- ? "Not shared"
- : "Shared"
- : "Shared with you"}
- </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={faLink}
- />
- ) : (
- <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/settings/workspace/Workspace.tsx b/apps/web/app/dashboard/settings/workspace/Workspace.tsx
index 974b3e139..01d515e9a 100644
--- a/apps/web/app/dashboard/settings/workspace/Workspace.tsx
+++ b/apps/web/app/dashboard/settings/workspace/Workspace.tsx
@@ -27,11 +27,7 @@ import {
TableHeader,
TableRow,
} from "@cap/ui";
-import {
- faChair,
- faCloudUpload,
- faUserGroup,
-} from "@fortawesome/free-solid-svg-icons";
+import { faChair, faUserGroup } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format } from "date-fns";
import { useRouter } from "next/navigation";
@@ -257,15 +253,15 @@ export const Workspace = () => {
<CustomDomain />
</div>
</div>
- <div className="flex-1">
- <div className="space-y-1">
+ {/* <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
+ </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"
>
@@ -276,8 +272,8 @@ export const Workspace = () => {
<p className="text-xs text-gray-400 truncate">
Choose a file or drag & drop it here
</p>
- </div>
- <Input
+ </div> */}
+ {/* <Input
className="hidden"
type="file"
ref={fileInputRef}
@@ -288,7 +284,7 @@ export const Workspace = () => {
}}
name="icon"
/>
- </div>
+ </div> */}
</CardContent>
</div>
diff --git a/apps/web/app/dashboard/shared-caps/SharedCaps.tsx b/apps/web/app/dashboard/shared-caps/SharedCaps.tsx
index bbd0ec74d..3cd766b60 100644
--- a/apps/web/app/dashboard/shared-caps/SharedCaps.tsx
+++ b/apps/web/app/dashboard/shared-caps/SharedCaps.tsx
@@ -57,7 +57,7 @@ export const SharedCaps = ({
}
>
<div className="flex flex-col w-full h-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-3 xl:grid-cols-4 2xl:grid-cols-5">
{data.map((cap) => (
<SharedCapCard
key={cap.id}
diff --git a/apps/web/app/login/form.tsx b/apps/web/app/login/form.tsx
index 502d88eca..2f60a3eeb 100644
--- a/apps/web/app/login/form.tsx
+++ b/apps/web/app/login/form.tsx
@@ -360,6 +360,7 @@ const NormalLogin = ({
<>
<Button
variant="red"
+ type="button"
className="flex justify-center items-center space-x-2 w-full text-sm"
onClick={handleGoogleSignIn}
disabled={loading}
diff --git a/packages/ui/src/components/Button.tsx b/packages/ui/src/components/Button.tsx
index 60245d729..7e1702a1f 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-xl",
+ "flex items-center justify-center cursor-pointer ring-offset-transparent relative min-w-[100px] gap-1 rounded-xl",
{
defaultVariants: {
variant: "primary",
@@ -13,18 +13,18 @@ const buttonVariants = cva(
variants: {
variant: {
primary:
- "bg-gradient-to-t from-blue-300 to-[#75A3FF] shadow-[0_0_0_1px] hover:brightness-110 shadow-blue-400 text-gray-50 hover:bg-blue-400 disabled:bg-blue-200",
- red: "bg-gradient-to-t from-[#772828] to-[#9F3C3C] shadow-[0_0_0_1px] hover:brightness-110 shadow-red-900 text-gray-50 hover:bg-red-400 disabled:bg-red-200",
+ "bg-gradient-to-t button-gradient-border from-blue-300 to-[#75A3FF] shadow-[0_0_0_1px] hover:brightness-110 shadow-blue-400 text-gray-50 hover:bg-blue-400 disabled:bg-blue-200",
+ red: "bg-gradient-to-t button-gradient-border from-[#772828] to-[#9F3C3C] shadow-[0_0_0_1px] hover:brightness-110 shadow-red-900 text-gray-50 hover:bg-red-400 disabled:bg-red-200",
secondary:
"bg-blue-400 text-gray-50 hover:bg-blue-500 disabled:bg-blue-200 disabled:text-gray-400 border-blue-300",
destructive:
- "bg-red-300 text-gray-50 hover:bg-red-400 disabled:bg-red-200 border-red-300",
+ "bg-red-300 text-gray-50 button-gradient-border 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-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",
+ dark: "bg-gradient-to-t button-gradient-border 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",
+ "text-gray-50 border button-gradient-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-sm h-[32px] px-[0.5rem] ",