Skip to content

Open source CapCut alternative.

TypeScript

fix(site): list only the shelves in the card rail

David Le74b91e72121f
diff --git a/site/src/cut/components/CardRail.tsx b/site/src/cut/components/CardRail.tsx
index 48bc3adc..9b5f99fd 100644
--- a/site/src/cut/components/CardRail.tsx
+++ b/site/src/cut/components/CardRail.tsx
@@ -3,9 +3,8 @@
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useTranslations } from "next-intl";
-import { Clapperboard, FolderOpen, Plus } from "lucide-react";
+import { Clapperboard, FolderOpen } from "lucide-react";
import { AppSidebar } from "@/cut/components/AppSidebar";
-import { useCardCreate } from "@/cut/components/EmbeddedNewProject";
import { useEnvironment } from "@/cut/lib/environment";
import { useHostReady } from "@/cut/lib/hostBridge";
import { homeHref, useCutBase, type CutTab } from "@/cut/lib/nav";
@@ -17,7 +16,7 @@ const CARD_TABS: { tab: CutTab; label: "projects" | "library"; icon: typeof Clap
];
// The editor rail's tile: an icon chip over a small label.
-const TILE = "flex w-full min-w-0 shrink-0 flex-col items-center gap-1 rounded-lg px-1 py-1.5 text-muted-foreground outline-none transition-colors hover:text-foreground disabled:opacity-50";
+const TILE = "flex w-full min-w-0 shrink-0 flex-col items-center gap-1 rounded-lg px-1 py-1.5 text-muted-foreground outline-none transition-colors hover:text-foreground";
const CHIP = "grid size-9 place-items-center rounded-lg transition-colors";
const LABEL = "w-full truncate text-center text-[10px] font-medium tracking-tight";
@@ -30,25 +29,17 @@ export function HomeNav() {
/**
* The projects home inside the ChatGPT card. The host draws the app's name and
- * owns the account, so the rail carries only the way to a new project and the
- * two shelves, in the editor rail's size.
+ * owns the account, so the rail carries only the two shelves, in the editor
+ * rail's size; each shelf has its own New project.
*/
function CardRail() {
const t = useTranslations("home");
const pathname = usePathname();
const base = useCutBase();
- const { create, busy, error } = useCardCreate();
useHostReady(true);
return (
- <nav className="relative flex w-[68px] shrink-0 flex-col items-center gap-1 border-r border-border bg-card px-1 py-3">
- <button type="button" className={TILE} disabled={busy} onClick={() => void create()}>
- <span className={cn(CHIP, "hover:bg-muted/60")}>
- <Plus className="size-4.5" />
- </span>
- <span className={LABEL}>{t("newProject.button")}</span>
- </button>
- <div aria-hidden className="my-1 h-px w-8 shrink-0 bg-border" />
+ <nav className="flex w-[68px] shrink-0 flex-col items-center gap-1 border-r border-border bg-card px-1 py-3">
{CARD_TABS.map(({ tab, label, icon: Icon }) => {
const href = homeHref(base, tab);
const active = pathname === href;
@@ -61,13 +52,6 @@ function CardRail() {
</Link>
);
})}
- {/* The rail is too narrow for a sentence, so a failed create speaks
- beside it. */}
- {error && (
- <p role="alert" className="absolute top-3 left-[76px] z-10 w-56 rounded-md border border-border bg-popover p-2 text-xs text-destructive shadow-md">
- {error}
- </p>
- )}
</nav>
);
}
diff --git a/site/src/cut/components/EmbeddedNewProject.tsx b/site/src/cut/components/EmbeddedNewProject.tsx
index 21cfe6a5..52f51b66 100644
--- a/site/src/cut/components/EmbeddedNewProject.tsx
+++ b/site/src/cut/components/EmbeddedNewProject.tsx
@@ -18,8 +18,8 @@ import { errorFromBody } from "@/cut/lib/userError";
import { useDescribeError } from "@/i18n/describeError";
import { track } from "@/lib/analytics";
-/** Make an untitled cloud project and open it in the card: the card rail's
- * New project, and the way forward from a project that can't be shown. */
+/** Make an untitled cloud project and open it in the card: the way forward
+ * from a project that can't be shown. */
export function useCardCreate() {
const t = useTranslations("home.embeddedNewProject");
const describeError = useDescribeError();