Skip to content

Commit df98f25

Browse files
fix some CapCard states
1 parent f05f2e4 commit df98f25

File tree

1 file changed

+11
-3
lines changed
  • apps/web/app/(org)/dashboard/caps/components/CapCard

1 file changed

+11
-3
lines changed

apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { SharingDialog } from "../SharingDialog";
4343
import { CapCardAnalytics } from "./CapCardAnalytics";
4444
import { CapCardButton } from "./CapCardButton";
4545
import { CapCardContent } from "./CapCardContent";
46+
import { useFeatureFlag } from "@/app/Layout/features";
4647

4748
export interface CapCardProps extends PropsWithChildren {
4849
cap: {
@@ -175,6 +176,7 @@ export const CapCard = ({
175176
cap.id,
176177
cap.hasActiveUpload || false,
177178
);
179+
const enableBetaUploadProgress = useFeatureFlag("enableUploadProgress");
178180
const [imageStatus, setImageStatus] = useState<ImageLoadingStatus>("loading");
179181

180182
// Helper function to create a drag preview element
@@ -367,7 +369,10 @@ export const CapCard = ({
367369
e.stopPropagation();
368370
handleDownload();
369371
}}
370-
disabled={downloadMutation.isPending || cap.hasActiveUpload}
372+
disabled={
373+
downloadMutation.isPending ||
374+
(enableBetaUploadProgress && cap.hasActiveUpload)
375+
}
371376
className="delay-25"
372377
icon={() => {
373378
return downloadMutation.isPending ? (
@@ -425,7 +430,10 @@ export const CapCard = ({
425430
error: "Failed to duplicate cap",
426431
});
427432
}}
428-
disabled={duplicateMutation.isPending || cap.hasActiveUpload}
433+
disabled={
434+
duplicateMutation.isPending ||
435+
(enableBetaUploadProgress && cap.hasActiveUpload)
436+
}
429437
className="flex gap-2 items-center rounded-lg"
430438
>
431439
<FontAwesomeIcon className="size-3" icon={faCopy} />
@@ -514,7 +522,7 @@ export const CapCard = ({
514522
href={`/s/${cap.id}`}
515523
>
516524
{imageStatus !== "success" && uploadProgress ? (
517-
<div className="absolute inset-0 w-full h-full z-20">
525+
<div className="relative inset-0 w-full h-full z-20">
518526
<div className="overflow-hidden relative mx-auto w-full h-full rounded-t-xl border-b border-gray-3 aspect-video bg-black z-5">
519527
<div className="flex absolute inset-0 justify-center items-center rounded-t-xl">
520528
{uploadProgress.status === "failed" ? (

0 commit comments

Comments
 (0)