import{o as j,p as C,a as i,S as D,R as g,D as A,k as I,l as N,j as e,E as R,ao as P,a9 as o}from"./app-BgLa5dit.js";function L(a){var b,f,m,y,x;const s=j(C.getDashboard(a.dashboardId)),d=a.byPassValidation,S=i.getDashboardTargetInfo(s.data),n=i.isContentPartnerDashboard(S),c=j(s.data&&!n&&D.presentation(s.data.presentationId)),[k,r]=g.useState(!1),[t,l]=g.useState(),u=i.isType(s.data,A.Classification),h=u&&!((b=s.data)!=null&&b.isCurated)&&typeof t!="boolean",w=I(),p=N();function T(){h||(r(!0),w(C.publishTopicDashboard(s.data,t,d)).then(()=>{p.success(`Successfully published ${s.data.name}.`)}).catch(()=>{p.error(`Something went wrong while publishing ${s.data.name}. Please try again.`)}).finally(()=>{a.closePopup(),r(!1)}))}const v=s.hasCompleted&&(n||c.hasCompleted);return e.jsxs(R,{title:"Publish topic",closePopup:a.closePopup,showLoadingSpinner:!v,children:[e.jsxs("div",{children:[d?e.jsxs("p",{children:["The topic ",e.jsx("strong",{children:(m=s.data)==null?void 0:m.name})," ",e.jsx("span",{className:"text-danger",children:"has some validation issues, but you are bypassing these checks and publishing anyway"}),". Please ensure the content is ready for students and staff."]}):e.jsxs("p",{children:["The topic ",e.jsx("strong",{children:(f=s.data)==null?void 0:f.name})," has passed the check and includes all required information to be published."]}),!n&&e.jsxs("p",{children:["This will appear live on ClickView for staff and students in ",e.jsx("strong",{children:(y=c.data)==null?void 0:y.description}),"."]}),u&&!((x=s.data)!=null&&x.isCurated)&&e.jsxs("div",{className:"pb-3",children:[e.jsx("p",{children:"Previously, this topic was not curated. Should this be released as a curated topic?"}),e.jsx(P.Check,{type:"radio",label:"Yes, this is a curated topic",name:"is-curated",id:"is-curated",value:"is-curated",onChange:()=>l(!0),checked:t===!0,className:"mb-1"}),e.jsx(P.Check,{type:"radio",label:"No, this is NOT a curated topic yet",name:"is-not-curated",id:"is-not-curated",value:"is-not-curated",onChange:()=>l(!1),checked:t===!1})]})]}),e.jsxs(o,{children:[e.jsx(o.Cancel,{onClick:a.closePopup}),e.jsx(o.Submit,{text:"Publish topic",variant:"dark",onClick:T,showSpinner:k,type:"button",disabled:h})]})]})}export{L as AssemblyLinePublishTopicView};
//# sourceMappingURL=dtt4aCP9.chunk.js.map
