Skip to content

Open source CapCut alternative.

TypeScript

feat(site): collapse the storage upsell into a single row

David Le9a7a47583696
diff --git a/site/src/cut/components/NavStorage.tsx b/site/src/cut/components/NavStorage.tsx
index a18c469c..c362dd8c 100644
--- a/site/src/cut/components/NavStorage.tsx
+++ b/site/src/cut/components/NavStorage.tsx
@@ -1,14 +1,12 @@
"use client";
-// The free tier's cloud storage meter, pinned above the account row: how much
+// The free tier's cloud storage row, pinned above the account row: how much
// of the quota this account has used, and the one thing that buys more. The
// quota belongs to the account, not to the backend the app happens to be
// running against, so this shows in local mode too — a local editor still has
// cloud projects, and the number is the same either way. Pro accounts see
// nothing here — 50 GB is enough that a meter would only take up room.
-import { Loader2 } from "lucide-react";
-import { Button } from "@/components/ui/button";
-import { Meter } from "@/components/ui/meter";
+import { Cloud, Loader2 } from "lucide-react";
import { useCloudUsage } from "@/cut/lib/backend/hooks";
import { useUpgradeToPro } from "@/cut/lib/proUpgrade";
import { cn } from "@/lib/utils";
@@ -30,39 +28,29 @@ export function NavStorage() {
const frac = u.bytes / u.quotaBytes;
return (
- <div className="flex flex-col gap-2 px-2 py-3">
- <div className="flex items-baseline justify-between gap-2 text-xs">
- <span className="font-medium">Cloud storage</span>
- <span
- className={cn(
- "tabular-nums",
- frac >= 1 ? "text-destructive" : "text-muted-foreground"
- )}
- >
- {usageLabel(u.bytes, u.quotaBytes)}
+ <div className="flex flex-col border-b">
+ <div className="flex items-center justify-between gap-2 px-2 py-2.5 text-xs">
+ <span className="flex items-center gap-1.5 text-muted-foreground">
+ <Cloud className="size-4" />
+ <span className={cn("tabular-nums", frac >= 1 && "text-destructive")}>
+ {usageLabel(u.bytes, u.quotaBytes)}
+ </span>
</span>
+ <button
+ type="button"
+ className="flex items-center gap-1.5 font-bold text-foreground disabled:opacity-50"
+ disabled={upgrade.isPending}
+ onClick={upgrade.start}
+ >
+ {upgrade.isPending && <Loader2 className="size-3 animate-spin" />}
+ Get 50 GB
+ </button>
</div>
- <Meter
- value={Math.min(u.bytes, u.quotaBytes)}
- max={u.quotaBytes}
- aria-label="Cloud storage used"
- indicatorClassName={frac >= 1 ? "bg-destructive" : undefined}
- />
- <p className="text-xs leading-snug text-muted-foreground">
- {u.grace
- ? `Your Pro plan ended. Upgrade or free ${formatBytes(u.grace.overBytes)} before your oldest projects are deleted.`
- : "Pro gives you 50 GB."}
- </p>
- <Button
- variant="outline"
- size="sm"
- className="w-full"
- disabled={upgrade.isPending}
- onClick={upgrade.start}
- >
- {upgrade.isPending && <Loader2 className="animate-spin" data-icon="inline-start" />}
- Upgrade to Pro
- </Button>
+ {u.grace && (
+ <p className="px-2 pb-2.5 text-xs leading-snug text-muted-foreground">
+ {`Your Pro plan ended. Upgrade or free ${formatBytes(u.grace.overBytes)} before your oldest projects are deleted.`}
+ </p>
+ )}
</div>
);
}