From bf0625ce08e2b46049cf5f8a719f648b2e99cd9d Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Sat, 29 Mar 2025 16:52:11 +0530 Subject: [PATCH] Change default tab to frontend and add auth logic for web frontend --- .../app/(home)/_components/StackArchitech.tsx | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/(home)/_components/StackArchitech.tsx b/apps/web/src/app/(home)/_components/StackArchitech.tsx index ad6fd64..03c2ff4 100644 --- a/apps/web/src/app/(home)/_components/StackArchitech.tsx +++ b/apps/web/src/app/(home)/_components/StackArchitech.tsx @@ -342,7 +342,7 @@ const DEFAULT_STACK: StackState = { const StackArchitect = () => { const [stack, setStack] = useState(DEFAULT_STACK); const [command, setCommand] = useState("npx create-better-t-stack my-app -y"); - const [activeTab, setActiveTab] = useState("database"); + const [activeTab, setActiveTab] = useState("frontend"); const [copied, setCopied] = useState(false); useEffect(() => { @@ -453,16 +453,35 @@ const StackArchitect = () => { return { ...prev, frontend: [], + auth: "false", }; } if (currentSelection.includes(techId)) { + if ( + techId === "web" && + currentSelection.filter((id) => id !== techId).length === 0 + ) { + return { + ...prev, + frontend: currentSelection.filter((id) => id !== techId), + auth: "false", + }; + } return { ...prev, frontend: currentSelection.filter((id) => id !== techId), }; } + if (techId === "web") { + return { + ...prev, + frontend: [...currentSelection, techId], + auth: "true", + }; + } + return { ...prev, frontend: [...currentSelection, techId], @@ -598,7 +617,8 @@ const StackArchitect = () => { const isDisabled = (activeTab === "orm" && stack.database === "none") || - (activeTab === "turso" && stack.database !== "sqlite"); + (activeTab === "turso" && stack.database !== "sqlite") || + (activeTab === "auth" && !stack.frontend.includes("web")); return (