Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add isScreenshot support to dashboard video cards

Richie McIlroy7a2b9985f886
diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
index d20dec047..b3e59e439 100644
--- a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
+++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx
@@ -20,6 +20,7 @@ import {
faDownload,
faEllipsis,
faGear,
+ faImage,
faLink,
faLock,
faScissors,
@@ -754,7 +755,9 @@ export const CapCard = ({
<VideoThumbnail
videoDuration={
- hasVisibleUploadProgress ? undefined : cap.duration
+ hasVisibleUploadProgress || cap.isScreenshot
+ ? undefined
+ : cap.duration
}
imageClass={clsx(
anyCapSelected
@@ -769,6 +772,7 @@ export const CapCard = ({
alt={`${cap.name} Thumbnail`}
imageStatus={imageStatus}
setImageStatus={setImageStatus}
+ showPreview={cap.isScreenshot !== true}
hasActiveUpload={
uploadProgress !== null &&
uploadProgress.status !== "fetching" &&
@@ -776,6 +780,15 @@ export const CapCard = ({
uploadProgress.status !== "error"
}
/>
+ {cap.isScreenshot === true && !hasVisibleUploadProgress && (
+ <span
+ title="Screenshot"
+ className="absolute bottom-3 left-3 z-30 flex size-6 items-center justify-center rounded-full bg-black/60 text-white backdrop-blur-sm"
+ >
+ <FontAwesomeIcon icon={faImage} className="size-3" />
+ <span className="sr-only">Screenshot</span>
+ </span>
+ )}
{effectivePasswordProtected && (
<div
className="absolute right-2 top-2 z-10 flex size-7 items-center justify-center rounded-full bg-black/70 text-white"
diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx
index 967bfed80..f5d7aaa01 100644
--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx
+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/SharedCaps.tsx
@@ -53,6 +53,7 @@ type SharedVideoData = {
totalReactions: number;
ownerName: string | null;
metadata?: VideoMetadata;
+ isScreenshot: boolean;
hasPassword?: boolean;
hasInheritedPassword?: boolean;
inheritedPasswordSources?: SpaceRuleSource[];
@@ -420,7 +421,9 @@ export const SharedCaps = ({
{data.length > 0 && (
<>
- <h1 className="mb-4 text-2xl font-medium text-gray-12">Videos</h1>
+ <h1 className="mb-4 text-2xl font-medium text-gray-12">
+ Videos and screenshots
+ </h1>
<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) => {
const isOwner = cap.ownerId === currentUserId;
diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx
index 6cd4d1ce9..2e7651a50 100644
--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx
+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx
@@ -18,6 +18,7 @@ interface SharedCapCardProps {
totalReactions: number;
ownerName: string | null;
metadata?: VideoMetadata;
+ isScreenshot: boolean;
hasPassword?: boolean;
hasInheritedPassword?: boolean;
inheritedPasswordSources?: SpaceRuleSource[];
diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/VideoCard.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/VideoCard.tsx
index 884508aca..3edebb8ab 100644
--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/VideoCard.tsx
+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/VideoCard.tsx
@@ -1,4 +1,8 @@
-import { faHome, faRecordVinyl } from "@fortawesome/free-solid-svg-icons";
+import {
+ faHome,
+ faImage,
+ faRecordVinyl,
+} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Fit, Layout, useRive } from "@rive-app/react-canvas";
import clsx from "clsx";
@@ -52,18 +56,11 @@ const VideoCard: React.FC<VideoCardProps> = memo(
});
return (
- <div
+ <button
+ type="button"
onClick={onToggle}
- role="button"
- tabIndex={0}
- onKeyDown={(e) => {
- if (e.key === "Enter" || e.key === " ") {
- e.preventDefault();
- onToggle();
- }
- }}
className={clsx(
- "flex relative flex-col p-3 w-full h-full rounded-xl border transition-all duration-200 group",
+ "flex relative flex-col p-3 w-full h-full rounded-xl border text-left transition-all duration-200 group",
className,
isAlreadyInEntity && isSelected && "border-red-500",
isAlreadyInEntity && !isSelected && "border-blue-500",
@@ -143,7 +140,17 @@ const VideoCard: React.FC<VideoCardProps> = memo(
containerClass="!h-full !rounded-lg !border-b-0"
imageStatus={imageStatus}
setImageStatus={setImageStatus}
+ showPreview={video.isScreenshot !== true}
/>
+ {video.isScreenshot === true && (
+ <span
+ title="Screenshot"
+ className="absolute bottom-2 left-2 z-30 flex size-6 items-center justify-center rounded-full bg-black/60 text-white backdrop-blur-sm"
+ >
+ <FontAwesomeIcon icon={faImage} className="size-3" />
+ <span className="sr-only">Screenshot</span>
+ </span>
+ )}
</div>
<div className="space-y-2 min-h-fit">
@@ -192,7 +199,7 @@ const VideoCard: React.FC<VideoCardProps> = memo(
)}
</div>
</div>
- </div>
+ </button>
);
},
);