"use strict";var S=Object.create;var n=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var _=Object.getPrototypeOf;var P=Object.prototype.hasOwnProperty;var h=(t,s)=>n(t,"name",{value:s,configurable:true});var O=(t,s)=>{for(var o in s)n(t,o,{get:s[o],enumerable:true})};var W=(t,s,o,r)=>{if(s&&typeof s==="object"||typeof s==="function"){for(let a of E(s))if(!P.call(t,a)&&a!==o)n(t,a,{get:()=>s[a],enumerable:!(r=y(s,a))||r.enumerable})}return t};var c=(t,s,o)=>(o=t!=null?S(_(t)):{},W(s||!t||!t.__esModule?n(o,"default",{value:t,enumerable:true}):o,t));var T=t=>W(n({},"__esModule",{value:true}),t);var R=(t,s,o,r)=>{var a=r>1?void 0:r?y(s,o):s;for(var i=t.length-1,m;i>=0;i--)if(m=t[i])a=(r?m(s,o,a):m(a))||a;if(r&&a)n(s,o,a);return a};var H={};O(H,{default:()=>U});module.exports=T(H);var e=require("react/jsx-runtime");var b=require("mobx-react");var v=require("react");var k=require("react-intl");var I=c(require("react-jss"));var g=c(require("../../../components/ui/effects/Appear"));var q=require("../../../components/ui/headline");var u=c(require("../../../components/ui/infobox/index"));var M=c(require("../../../components/ui/loader"));var x=c(require("./CreateWorkspaceForm"));var N=c(require("./WorkspaceItem"));const d=(0,k.defineMessages)({headline:{id:"settings.workspaces.headline",defaultMessage:"Your workspaces"},noServicesAdded:{id:"settings.workspaces.noWorkspacesAdded",defaultMessage:"You haven't created any workspaces yet."},workspacesRequestFailed:{id:"settings.workspaces.workspacesRequestFailed",defaultMessage:"Could not load your workspaces"},tryReloadWorkspaces:{id:"settings.workspaces.tryReloadWorkspaces",defaultMessage:"Try again"},updatedInfo:{id:"settings.workspaces.updatedInfo",defaultMessage:"Your changes have been saved"},deletedInfo:{id:"settings.workspaces.deletedInfo",defaultMessage:"Workspace has been deleted"},workspaceFeatureInfo:{id:"settings.workspaces.workspaceFeatureInfo",defaultMessage:"Ferdium Workspaces let you focus on what\u2019s important right now. Set up different sets of services and easily switch between them at any time. You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want."},workspaceFeatureHeadline:{id:"settings.workspaces.workspaceFeatureHeadline",defaultMessage:"Less is More: Introducing Ferdium Workspaces"}});const A={table:{width:"100%","& td":{padding:"10px"}},createForm:{height:"auto"},appear:{height:"auto"},teaserImage:{width:250,margin:[-8,0,0,20],alignSelf:"center"}};let l=class extends v.Component{render(){const{classes:s,getUserWorkspacesRequest:o,createWorkspaceRequest:r,deleteWorkspaceRequest:a,updateWorkspaceRequest:i,onCreateWorkspaceSubmit:m,onWorkspaceClick:C,workspaces:f}=this.props;const{intl:p}=this.props;return(0,e.jsxs)("div",{className:"settings__main",children:[(0,e.jsx)("div",{className:"settings__header",children:(0,e.jsx)(q.H1,{children:p.formatMessage(d.headline)})}),(0,e.jsxs)("div",{className:"settings__body",children:[i.wasExecuted&&i.result?(0,e.jsx)(g.default,{className:s.appear,children:(0,e.jsx)(u.default,{type:"success",icon:"checkbox-marked-circle-outline",dismissible:true,onUnmount:i.reset,children:p.formatMessage(d.updatedInfo)})}):null,a.wasExecuted&&a.result?(0,e.jsx)(g.default,{className:s.appear,children:(0,e.jsx)(u.default,{type:"success",icon:"checkbox-marked-circle-outline",dismissible:true,onUnmount:a.reset,children:p.formatMessage(d.deletedInfo)})}):null,(0,e.jsx)("div",{className:s.createForm,children:(0,e.jsx)(x.default,{isSubmitting:r.isExecuting,onSubmit:m})}),o.isExecuting?(0,e.jsx)(M.default,{}):(0,e.jsx)(e.Fragment,{children:o.error?(0,e.jsx)(u.default,{icon:"alert",type:"danger",ctaLabel:p.formatMessage(d.tryReloadWorkspaces),ctaOnClick:o.retry,children:p.formatMessage(d.workspacesRequestFailed)}):(0,e.jsx)(e.Fragment,{children:f.length===0?(0,e.jsx)("div",{className:"align-middle settings__empty-state",children:(0,e.jsxs)("p",{className:"settings__empty-text",children:[(0,e.jsx)("span",{className:"emoji",children:(0,e.jsx)("img",{src:"./assets/images/emoji/sad.png",alt:""})}),p.formatMessage(d.noServicesAdded)]})}):(0,e.jsx)("table",{className:s.table,children:(0,e.jsx)("tbody",{children:f.map(w=>(0,e.jsx)(N.default,{workspace:w,onItemClick:F=>C(F)},w.id))})})})})]})]})}};h(l,"WorkspacesDashboard");l=R([b.observer],l);var U=(0,k.injectIntl)((0,I.default)(A,{injectTheme:true})(l));
