Change default tab to frontend and add auth logic for web frontend

This commit is contained in:
Aman Varshney
2025-03-29 16:52:11 +05:30
parent 3985603c43
commit bf0625ce08

View File

@@ -342,7 +342,7 @@ const DEFAULT_STACK: StackState = {
const StackArchitect = () => {
const [stack, setStack] = useState<StackState>(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 (
<motion.div