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 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
|
||||||
|
|||||||
Reference in New Issue
Block a user