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 StackArchitect = () => {
const [stack, setStack] = useState<StackState>(DEFAULT_STACK); const [stack, setStack] = useState<StackState>(DEFAULT_STACK);
const [command, setCommand] = useState("npx create-better-t-stack my-app -y"); 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); const [copied, setCopied] = useState(false);
useEffect(() => { useEffect(() => {
@@ -453,16 +453,35 @@ const StackArchitect = () => {
return { return {
...prev, ...prev,
frontend: [], frontend: [],
auth: "false",
}; };
} }
if (currentSelection.includes(techId)) { 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 { return {
...prev, ...prev,
frontend: currentSelection.filter((id) => id !== techId), frontend: currentSelection.filter((id) => id !== techId),
}; };
} }
if (techId === "web") {
return {
...prev,
frontend: [...currentSelection, techId],
auth: "true",
};
}
return { return {
...prev, ...prev,
frontend: [...currentSelection, techId], frontend: [...currentSelection, techId],
@@ -598,7 +617,8 @@ const StackArchitect = () => {
const isDisabled = const isDisabled =
(activeTab === "orm" && stack.database === "none") || (activeTab === "orm" && stack.database === "none") ||
(activeTab === "turso" && stack.database !== "sqlite"); (activeTab === "turso" && stack.database !== "sqlite") ||
(activeTab === "auth" && !stack.frontend.includes("web"));
return ( return (
<motion.div <motion.div