mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
Change default tab to frontend and add auth logic for web frontend
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user