UNPKG

@baseplate-dev/project-builder-web

Version:

Web interface for constructing project builder JSON

3 lines (2 loc) 2.03 kB
import{i as t}from"./_virtual___federation_fn_import-DOo8C-zl.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{e as r,N as C,f as D,l as f}from"./index-DiAhmW9l.js";const{createPluginImplementationStoreWithNewPlugins:P,PluginUtils:g,webConfigSpec:m}=await t("@baseplate-dev/project-builder-lib"),{useProjectDefinition:v}=await t("@baseplate-dev/project-builder-lib/web"),{Button:y,DropdownMenu:S,DropdownMenuContent:N,DropdownMenuGroup:M,DropdownMenuItem:k,DropdownMenuTrigger:A,useConfirmDialog:F}=await t("@baseplate-dev/ui-components"),{useNavigate:E}=await t("@tanstack/react-router"),{useMemo:I}=await t("react");function z(){const{definitionContainer:o,pluginContainer:l,schemaParserContext:s,saveDefinitionWithFeedbackSync:x,isSavingDefinition:h}=v(),{key:i}=r.useParams(),{requestConfirm:b}=F(),c=E({from:r.fullPath}),{pluginMetadata:n}=r.useLoaderData(),a=g.byKey(o.definition,i),u=I(()=>{if(!i)return;const p=l.use(m).components.get(i);return p||P(s.pluginStore,[n],o.definition).use(m).components.get(i)},[i,s,o,l,n]);if(!u)return e.jsx(C,{});function w(){x(d=>{g.disablePlugin(d,n.key,s)},{successMessage:`Disabled ${n.displayName}!`,onSuccess:()=>{c({to:"/plugins"}).catch(f)}})}function j(){a||c({to:"/plugins"}).catch(f)}return e.jsx("div",{className:"relative flex h-full flex-1 flex-col gap-4 overflow-hidden",children:e.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h1",{children:[n.displayName," Plugin"]}),a&&e.jsxs(S,{children:[e.jsx(A,{asChild:!0,children:e.jsx(y,{variant:"ghost",size:"icon",children:e.jsx(D,{"aria-label":"More Actions"})})}),e.jsx(N,{children:e.jsx(M,{children:e.jsx(k,{disabled:h,onSelect:()=>{b({title:"Disable Plugin",content:`Are you sure you want to disable the ${n.displayName} plugin?`,onConfirm:w})},children:"Disable Plugin"})})})]})]}),e.jsx(u,{definition:a,metadata:n,onSave:j})]})})}export{z as component}; //# sourceMappingURL=edit._key-BVrQ5Qxr.js.map