diff --git a/frontend/src/resources/builder/index.tsx b/frontend/src/resources/builder/index.tsx index aaa02578d..a6791a36b 100644 --- a/frontend/src/resources/builder/index.tsx +++ b/frontend/src/resources/builder/index.tsx @@ -1,9 +1,22 @@ import { ResourceCard } from "@layouts/card"; -import { Bot, Cloud, Factory } from "lucide-react"; +import { Bot, Cloud, Factory, History, Settings } from "lucide-react"; import { ResourceUpdates } from "@components/updates/resource"; -import { useAddRecentlyViewed, useRead } from "@hooks"; +import { useAddRecentlyViewed, useRead, useWrite } from "@hooks"; import { Resource } from "@layouts/resource"; import { Link, useParams } from "react-router-dom"; +import { Types } from "@monitor/client"; +import { useState } from "react"; +import { Section } from "@layouts/page"; +import { Button } from "@ui/button"; +import { ConfirmUpdate } from "@components/config/confirm-update"; +import { Configuration } from "@components/config"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@ui/select"; export const BuilderName = ({ id }: { id: string }) => { const builders = useRead("ListBuilders", {}).data; @@ -11,20 +24,6 @@ export const BuilderName = ({ id }: { id: string }) => { return <>{builder?.name}; }; -export const BuilderPage = () => { - const id = useParams().builderId; - - if (!id) return null; - useAddRecentlyViewed("Builder", id); - - return ( - } info={<>} actions={<>}> - -
builder page
-
- ); -}; - export const BuilderCard = ({ id }: { id: string }) => { const builders = useRead("ListBuilders", {}).data; const builder = builders?.find((b) => b.id === id); @@ -50,3 +49,82 @@ export const BuilderCard = ({ id }: { id: string }) => { ); }; + +const BuilderTypeSelector = ({ + selected, + onSelect, +}: { + selected: Types.BuilderConfig["type"] | undefined; + onSelect: (type: Types.BuilderConfig["type"]) => void; +}) => ( + +); + +const BuilderConfig = ({ id }: { id: string }) => { + const builder = useRead("GetBuilder", { id }).data; + const [update, set] = useState>({}); + const { mutate, isLoading } = useWrite("UpdateBuilder"); + + if (!builder?.config) return null; + + return ( +
} + actions={ +
+ + mutate({ config: update as any, id })} + /> +
+ } + > + set((update) => ({ ...update, ...input }))} + layout={{ + general: ["type", "params"], + }} + overrides={{ + type: (type, set) => ( + set({ ...builder, type })} + /> + ), + // params: (params, set) =>
+ // {params.} + //
+ }} + /> +
+ ); +}; + +export const BuilderPage = () => { + const id = useParams().builderId; + + if (!id) return null; + useAddRecentlyViewed("Builder", id); + + return ( + } info={<>} actions={<>}> + + + + ); +};