client-web/build/static/js/588.1df1cd15.chunk.js
"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[588],{59715:function(e,n,t){t.d(n,{A:function(){return d}});t(72791);var o=t(17205),r=t(60788),i=t(77248),a=t(8440),l=t(39571),s=t(40464),c=t(80184);function d(e){var n=e.open,t=e.onClose,d=e.onDeletePress,u=e.loading,f=e.title,p=e.description,h=e.deleteButtonTitle,x=e.cancelButtonTitle;return(0,c.jsxs)(r.Z,{open:n,onClose:t,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,c.jsx)(s.Z,{id:"alert-dialog-title",children:f}),(0,c.jsx)(a.Z,{children:(0,c.jsx)(l.Z,{id:"alert-dialog-description",children:p})}),(0,c.jsxs)(i.Z,{children:[(0,c.jsx)(o.Z,{disabled:u,onClick:t,children:x||"Cancel"}),(0,c.jsx)(o.Z,{disabled:u,onClick:d,autoFocus:!0,color:"error",children:h||"Delete"})]})]})}},77588:function(e,n,t){t.r(n),t.d(n,{default:function(){return _}});var o=t(72791),r=t(20803),i=t(74165),a=t(15861),l=t(70885),s=t(50228),c=t(13811),d=t(96580),u=t(73978),f=t(4565),p=t(91803),h=t(59911),x=t(17205),Z=t(64880),m=t(11210),v=t(85554),j=t(41286),g=t(75426),b=t(60340),y=t(68438),w=t(27247),C=t(50705),S=t(59715),D=t(52775),k=t(47409),R=t(80184);function I(){var e,n=(0,Z.UO)().roomJID,t=(0,o.useState)(""),I=(0,l.Z)(t,2),P=I[0],z=I[1],L=(0,o.useState)(""),N=(0,l.Z)(L,2),T=N[0],A=N[1],_=(0,o.useState)(!1),K=(0,l.Z)(_,2),O=K[0],U=K[1],H=(0,o.useState)(!1),J=(0,l.Z)(H,2),V=J[0],W=J[1],B=(0,o.useState)(!1),E=(0,l.Z)(B,2),F=E[0],$=E[1],q=(0,o.useState)(!1),Y=(0,l.Z)(q,2),G=Y[0],Q=Y[1],X=(0,m.K)((function(e){return e.userChatRooms})).find((function(e){return(null===e||void 0===e?void 0:e.jid)===n})),ee=(0,m.K)((function(e){return e.updateUserChatRoom})),ne=(0,m.K)((function(e){return e.roomRoles})),te=(0,D.D)().showSnackbar,oe=(0,Z.k6)(),re=(0,o.useRef)(null),ie=null===(e=ne.find((function(e){return e.roomJID===(null===X||void 0===X?void 0:X.jid)})))||void 0===e?void 0:e.role,ae="moderator"===ie||"owner"===ie||"admin"===ie,le=X&&(X.group===y.hx.official||X.group===y.hx.favourite),se=function(e){var n=Object.assign({},X);n.group=e,ee(n)},ce=function(){W(!1)},de=function(){var e=(0,a.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:v.ZP.leaveTheRoom(n),v.ZP.unsubscribe(n),ce(),oe.push("/chat/none");case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ue=function(){var e=(0,a.Z)((0,i.Z)().mark((function e(t){var o,r,a,l;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(o=new FormData).append("files",t),Q("chatIcon"),e.prev=3,e.next=6,(0,k.cT)(o);case 6:r=e.sent,a=n.split("@")[0],v.ZP.setRoomImage(a,r.data.results[0].location,X.room_background,"icon"),(l=Object.assign({},X)).room_thumbnail=r.data.results[0].location,ee(l),te("success","Success! The chat icon was set"),e.next=19;break;case 15:e.prev=15,e.t0=e.catch(3),console.log(e.t0),te("error","An error occurred while loading the image. ( "+e.t0.message+" "+e.t0.response.data+" )");case 19:Q(!1);case 20:case"end":return e.stop()}}),e,null,[[3,15]])})));return function(n){return e.apply(this,arguments)}}();return(0,R.jsxs)(r.Z,{style:{justifyContent:"center",alignItems:"center",display:"flex",flexDirection:"column"},children:[(0,R.jsx)("div",{style:{cursor:"pointer"},children:(0,R.jsxs)(s.Z,{sx:{width:200,height:200,margin:5,backgroundColor:"primary.dark",justifyContent:"center",alignItems:"center",display:"flex",borderRadius:"10px",position:"relative"},children:[(0,R.jsxs)(s.Z,{sx:{position:"absolute",top:0,right:0,display:"flex",flexDirection:"column",zIndex:99999},children:[(0,R.jsx)(c.Z,{sx:{color:"white"},onClick:function(){return se(le?"":y.hx.favourite)},children:le?(0,R.jsx)(b.Z,{}):(0,R.jsx)(g.Z,{})}),ae&&(0,R.jsxs)(c.Z,{sx:{color:"white"},onClick:function(){var e;return null===(e=re.current)||void 0===e?void 0:e.click()},children:[(0,R.jsx)("input",{type:"file",name:"file",id:"file",onChange:function(e){return ue(e.target.files[0])},ref:re,style:{display:"none"},accept:"image/*"}),"chatIcon"===G?(0,R.jsx)(d.Z,{style:{color:"white"},size:24}):(0,R.jsx)(C.Z,{})]}),ae&&(0,R.jsx)(c.Z,{sx:{color:"red"},onClick:function(){return W(!0)},children:(0,R.jsx)(w.Z,{})})]}),(0,R.jsx)(c.Z,{disableRipple:!0,onClick:function(e){ae&&oe.push("/changebg/"+n)},children:null!==X&&void 0!==X&&X.room_thumbnail&&"none"!==(null===X||void 0===X?void 0:X.room_thumbnail)?(0,R.jsx)(u.Z,{sx:{width:200,height:200,borderRadius:"10px"},variant:"square",src:X.room_thumbnail}):(0,R.jsx)(f.Z,{color:"white",fontSize:"120px",children:null===X||void 0===X?void 0:X.name[0]})})]})}),(0,R.jsxs)(s.Z,{flexDirection:"row",display:"flex",children:[(0,R.jsx)(f.Z,{fontSize:"20px",fontWeight:"bold",children:null===X||void 0===X?void 0:X.name}),ae&&(0,R.jsx)(c.Z,{onClick:function(){return $(!0)},style:{marginLeft:10},children:(0,R.jsx)(j.Z,{fontSize:"small"})})]}),(0,R.jsxs)(r.Z,{style:{flexDirection:"row",justifyContent:"center",alignItems:"center",display:"flex"},children:[(0,R.jsx)(f.Z,{fontSize:"20px",children:null!==X&&void 0!==X&&X.description?X.description:"No description"}),ae&&(0,R.jsx)(c.Z,{onClick:function(){return U(!0)},style:{marginLeft:10},children:(0,R.jsx)(j.Z,{fontSize:"small"})})]}),(0,R.jsx)(p.Z,{open:O,onClose:function(){return U(!1)},"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",children:(0,R.jsxs)(s.Z,{sx:M,children:[(0,R.jsx)(f.Z,{id:"modal-modal-title",variant:"h6",component:"h2",children:"Set new description"}),(0,R.jsx)(h.Z,{onChange:function(e){return z(e.target.value)},margin:"normal",id:"outlined-basic",label:"Description",variant:"outlined"}),(0,R.jsx)(x.Z,{onClick:function(){U(!1),function(e){v.ZP.changeRoomDescription(n,e)}(P)},style:{justifyContent:"center",alignItems:"center",display:"flex"},variant:"outlined",children:(0,R.jsx)(f.Z,{id:"modal-modal-description",children:"Submit"})})]})}),(0,R.jsx)(p.Z,{open:F,onClose:function(){return $(!1)},"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",children:(0,R.jsxs)(s.Z,{sx:M,children:[(0,R.jsx)(f.Z,{id:"modal-modal-title",variant:"h6",component:"h2",children:"Set new room name"}),(0,R.jsx)(h.Z,{onChange:function(e){return A(e.target.value)},margin:"normal",id:"outlined-basic",label:"Room Name",variant:"outlined"}),(0,R.jsx)(x.Z,{onClick:function(){$(!1),function(e){v.ZP.changeRoomName(n,e)}(T)},style:{justifyContent:"center",alignItems:"center",display:"flex"},variant:"outlined",children:(0,R.jsx)(f.Z,{id:"modal-modal-description",children:"Submit"})})]})}),(0,R.jsx)(S.A,{open:V,title:"Delete",description:"Do you want to delete this room?",onDeletePress:de,onClose:ce})]})}var M={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:400,bgcolor:"background.paper",border:"2px solid #000",boxShadow:24,p:4,justifyContent:"center",flex:"display"},P=t(45629),z=t(76132),L=t(16992),N=t(70324),T=t(52898);function A(){var e,n=(0,Z.UO)().roomJID,t=(0,m.K)((function(e){return e.userChatRooms})),r=(0,m.K)((function(e){return e.roomMemberInfo.filter((function(e){return"none"!==e.name}))})),i=(0,m.K)((function(e){return e.user})),a=t.find((function(e){return(null===e||void 0===e?void 0:e.jid)===n})),d=(0,o.useState)(!1),p=(0,l.Z)(d,2),h=p[0],x=p[1],j=(0,o.useState)(),g=(0,l.Z)(j,2),b=(g[0],g[1]),y=(0,o.useState)(null),w=(0,l.Z)(y,2),C=w[0],S=w[1],D=(0,m.K)((function(e){return e.roomRoles})),k=(0,Z.k6)(),I=null===(e=D.find((function(e){return e.roomJID===(null===a||void 0===a?void 0:a.jid)})))||void 0===e?void 0:e.role,M=function(e){e.stopPropagation(),S(null),x(!1)};return(0,R.jsxs)(s.Z,{children:[(0,R.jsxs)(f.Z,{variant:"h5",children:["Members (",r.length,")"]}),(0,R.jsx)(P.Z,{sx:{width:"100%",bgcolor:"background.paper"},children:r.map((function(e){return(0,R.jsxs)(z.ZP,{dense:!0,onClick:function(){return function(e){e.jid.includes((0,v.$I)(i.walletAddress))?k.push("/profile/"+i.walletAddress):k.push("/profile/"+(0,v.$2)(e.jid.split("@")[0]))}(e)},style:{flexDirection:"row",alignItems:"center"},children:[(0,R.jsx)(s.Z,{alignItems:"center",justifyContent:"center",style:{background:"#003E9C",width:"40px",height:"40px",margin:5,display:"flex"},children:"none"!==e.profile?(0,R.jsx)(u.Z,{style:{width:"40px",height:"40px"},variant:"square",src:e.profile}):(0,R.jsx)(f.Z,{style:{color:"white"},children:e.name?e.name[0]:null})}),(0,R.jsx)(f.Z,{children:e.jid.includes((0,v.$I)(i.walletAddress))?"You":e.name}),!e.jid.includes((0,v.$I)(i.walletAddress))&&("moderator"===I||"owner"===I)&&(0,R.jsx)(c.Z,{"aria-label":"more",id:"long-button","aria-haspopup":"true",onClick:function(n){return function(e,n){e.stopPropagation(),b(n),S(e.currentTarget),x(!0)}(n,e)},children:(0,R.jsx)(T.Z,{})}),"owner"===e.role&&(0,R.jsx)(s.Z,{style:{border:"1px solid",borderWidth:1,borderRadius:5,width:"70px",alignItems:"center",display:"flex",justifyContent:"center",marginLeft:10},children:(0,R.jsx)(f.Z,{children:e.role})}),"clear"!==e.ban_status?(0,R.jsx)(s.Z,{style:{border:"1px solid",borderWidth:1,borderRadius:5,width:"70px",alignItems:"center",display:"flex",justifyContent:"center",marginLeft:10},children:(0,R.jsx)(f.Z,{children:"banned"})}):null,(0,R.jsx)(L.Z,{id:"long-menu",MenuListProps:{"aria-labelledby":"long-button"},anchorEl:C,open:h,onClose:M,PaperProps:{style:{maxHeight:216,width:"20ch"}},children:(0,R.jsx)(N.Z,{onClick:function(n){return function(e,n){"clear"===e.ban_status?v.ZP.banUserStanza(e.jid,a.jid):v.ZP.unbanUserStanza(e.jid,a.jid),v.ZP.getRoomMemberInfo(a.jid),M(n)}(e,n)},children:"clear"===(null===e||void 0===e?void 0:e.ban_status)?"Ban":"Unban"})})]},e.jid)}))})]})}function _(){var e=(0,Z.UO)().roomJID;return(0,o.useEffect)((function(){v.ZP.getRoomMemberInfo(e),v.ZP.getRoomInfo(e)}),[]),(0,R.jsxs)(r.Z,{maxWidth:"xl",children:[(0,R.jsx)(I,{}),(0,R.jsx)(A,{})]})}},27247:function(e,n,t){var o=t(64836);n.Z=void 0;var r=o(t(45649)),i=t(80184),a=(0,r.default)((0,i.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");n.Z=a},41286:function(e,n,t){var o=t(64836);n.Z=void 0;var r=o(t(45649)),i=t(80184),a=(0,r.default)((0,i.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),"Edit");n.Z=a},50705:function(e,n,t){var o=t(64836);n.Z=void 0;var r=o(t(45649)),i=t(80184),a=(0,r.default)((0,i.jsx)("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}),"InsertPhoto");n.Z=a},52898:function(e,n,t){var o=t(64836);n.Z=void 0;var r=o(t(45649)),i=t(80184),a=(0,r.default)((0,i.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreVert");n.Z=a},75426:function(e,n,t){var o=t(64836);n.Z=void 0;var r=o(t(45649)),i=t(80184),a=(0,r.default)((0,i.jsx)("path",{d:"m12 8.89.94 3.11h2.82l-2.27 1.62.93 3.01L12 14.79l-2.42 1.84.93-3.01L8.24 12h2.82L12 8.89M12 2l-2.42 8H2l6.17 4.41L5.83 22 12 17.31 18.18 22l-2.35-7.59L22 10h-7.58L12 2z"}),"StarPurple500");n.Z=a},77248:function(e,n,t){t.d(n,{Z:function(){return Z}});var o=t(63366),r=t(87462),i=t(72791),a=t(28182),l=t(94419),s=t(60277),c=t(85513),d=t(75878),u=t(21217);function f(e){return(0,u.Z)("MuiDialogActions",e)}(0,d.Z)("MuiDialogActions",["root","spacing"]);var p=t(80184),h=["className","disableSpacing"],x=(0,s.ZP)("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:function(e,n){var t=e.ownerState;return[n.root,!t.disableSpacing&&n.spacing]}})((function(e){var n=e.ownerState;return(0,r.Z)({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto"},!n.disableSpacing&&{"& > :not(:first-of-type)":{marginLeft:8}})})),Z=i.forwardRef((function(e,n){var t=(0,c.Z)({props:e,name:"MuiDialogActions"}),i=t.className,s=t.disableSpacing,d=void 0!==s&&s,u=(0,o.Z)(t,h),Z=(0,r.Z)({},t,{disableSpacing:d}),m=function(e){var n=e.classes,t={root:["root",!e.disableSpacing&&"spacing"]};return(0,l.Z)(t,f,n)}(Z);return(0,p.jsx)(x,(0,r.Z)({className:(0,a.Z)(m.root,i),ownerState:Z,ref:n},u))}))},8440:function(e,n,t){t.d(n,{Z:function(){return v}});var o=t(4942),r=t(63366),i=t(87462),a=t(72791),l=t(28182),s=t(94419),c=t(60277),d=t(85513),u=t(75878),f=t(21217);function p(e){return(0,f.Z)("MuiDialogContent",e)}(0,u.Z)("MuiDialogContent",["root","dividers"]);var h=t(5186),x=t(80184),Z=["className","dividers"],m=(0,c.ZP)("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:function(e,n){var t=e.ownerState;return[n.root,t.dividers&&n.dividers]}})((function(e){var n=e.theme,t=e.ownerState;return(0,i.Z)({flex:"1 1 auto",WebkitOverflowScrolling:"touch",overflowY:"auto",padding:"20px 24px"},t.dividers?{padding:"16px 24px",borderTop:"1px solid ".concat((n.vars||n).palette.divider),borderBottom:"1px solid ".concat((n.vars||n).palette.divider)}:(0,o.Z)({},".".concat(h.Z.root," + &"),{paddingTop:0}))})),v=a.forwardRef((function(e,n){var t=(0,d.Z)({props:e,name:"MuiDialogContent"}),o=t.className,a=t.dividers,c=void 0!==a&&a,u=(0,r.Z)(t,Z),f=(0,i.Z)({},t,{dividers:c}),h=function(e){var n=e.classes,t={root:["root",e.dividers&&"dividers"]};return(0,s.Z)(t,p,n)}(f);return(0,x.jsx)(m,(0,i.Z)({className:(0,l.Z)(h.root,o),ownerState:f,ref:n},u))}))},39571:function(e,n,t){t.d(n,{Z:function(){return m}});var o=t(63366),r=t(87462),i=t(72791),a=t(28182),l=t(94419),s=t(60277),c=t(85513),d=t(4565),u=t(75878),f=t(21217);function p(e){return(0,f.Z)("MuiDialogContentText",e)}(0,u.Z)("MuiDialogContentText",["root"]);var h=t(80184),x=["children","className"],Z=(0,s.ZP)(d.Z,{shouldForwardProp:function(e){return(0,s.FO)(e)||"classes"===e},name:"MuiDialogContentText",slot:"Root",overridesResolver:function(e,n){return n.root}})({}),m=i.forwardRef((function(e,n){var t=(0,c.Z)({props:e,name:"MuiDialogContentText"}),i=t.className,s=(0,o.Z)(t,x),d=function(e){var n=e.classes,t=(0,l.Z)({root:["root"]},p,n);return(0,r.Z)({},n,t)}(s);return(0,h.jsx)(Z,(0,r.Z)({component:"p",variant:"body1",color:"text.secondary",ref:n,ownerState:s,className:(0,a.Z)(d.root,i)},t,{classes:d}))}))}}]);
//# sourceMappingURL=588.1df1cd15.chunk.js.map