From e7329a727fde1491e1dabb069fdc1d47123b09bd Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 18 Jan 2025 23:49:47 -0600 Subject: [PATCH] refactor: use stepper --- .../dashboard/project/ai/step-one.tsx | 26 +- .../dashboard/project/ai/step-three.tsx | 15 +- .../dashboard/project/ai/step-two.tsx | 157 ++++---- .../project/ai/template-generator.tsx | 374 +++++++++++------- apps/dokploy/server/api/routers/ai.ts | 240 +++++------ 5 files changed, 454 insertions(+), 358 deletions(-) diff --git a/apps/dokploy/components/dashboard/project/ai/step-one.tsx b/apps/dokploy/components/dashboard/project/ai/step-one.tsx index 0c80ec1d..109ad441 100644 --- a/apps/dokploy/components/dashboard/project/ai/step-one.tsx +++ b/apps/dokploy/components/dashboard/project/ai/step-one.tsx @@ -24,23 +24,12 @@ const examples = [ ]; export const StepOne = ({ nextStep, setTemplateInfo, templateInfo }: any) => { - const [userInput, setUserInput] = useState(templateInfo.userInput); - // Get servers from the API const { data: servers } = api.server.withSSHKey.useQuery(); - const handleNext = () => { - setTemplateInfo({ - ...templateInfo, - userInput, - }); - nextStep(); - }; - const handleExampleClick = (example: string) => { - setUserInput(example); + setTemplateInfo({ ...templateInfo, userInput: example }); }; - return (
@@ -51,8 +40,10 @@ export const StepOne = ({ nextStep, setTemplateInfo, templateInfo }: any) => {