UNPKG

@baseplate-dev/project-builder-web

Version:

Web interface for constructing project builder JSON

3 lines (2 loc) 2.06 kB
import{i as t}from"./_virtual___federation_fn_import-C4el_tlG.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{d as l,N as j,e as P,l as g}from"./index-BsqYBobW.js";const{createPluginImplementationStoreWithNewPlugins:D,PluginUtils:f,webConfigSpec:m}=await t("@baseplate-dev/project-builder-lib"),{useProjectDefinition:v}=await t("@baseplate-dev/project-builder-lib/web"),{Button:S,DropdownMenu:y,DropdownMenuContent:N,DropdownMenuGroup:M,DropdownMenuItem:k,DropdownMenuTrigger:W,useConfirmDialog:A}=await t("@baseplate-dev/ui-components"),{useNavigate:F}=await t("@tanstack/react-router"),{useMemo:E}=await t("react"),B=function(){const{definitionContainer:o,pluginContainer:r,schemaParserContext:a,saveDefinitionWithFeedbackSync:x,isSavingDefinition:b}=v(),{key:i}=l.useParams(),{requestConfirm:h}=A(),c=F({from:l.fullPath}),{pluginMetadata:n}=l.useLoaderData(),s=f.byKey(o.definition,i),u=E(()=>{if(!i)return;const p=r.getPluginSpec(m).getWebConfigComponent(i);return p||D(a.pluginStore,[n],o.definition).getPluginSpec(m).getWebConfigComponent(i)},[i,a,o,r,n]);if(!u)return e.jsx(j,{});function C(){x(d=>{f.disablePlugin(d,n.key,a)},{successMessage:`Disabled ${n.displayName}!`,onSuccess:()=>{c({to:"/plugins"}).catch(g)}})}function w(){s||c({to:"/plugins"}).catch(g)}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"]}),s&&e.jsxs(y,{children:[e.jsx(W,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"icon",children:e.jsx(P,{"aria-label":"More Actions"})})}),e.jsx(N,{children:e.jsx(M,{children:e.jsx(k,{disabled:b,onSelect:()=>{h({title:"Disable Plugin",content:`Are you sure you want to disable the ${n.displayName} plugin?`,onConfirm:C})},children:"Disable Plugin"})})})]})]}),e.jsx(u,{definition:s,metadata:n,onSave:w})]})})};export{B as component}; //# sourceMappingURL=edit._key-BRdERycq.js.map