%PDF- %PDF-
Direktori : /home/opti/www/startup-life/assets/ |
Current File : /home/opti/www/startup-life/assets/view-action-page-4a85a60d.js |
import{u as D,F as T,j as t,C as N,Q as m}from"./index-5492fbe1.js";import{D as P}from"./dashboard-page-layout-2cec2413.js";import{D as R}from"./dashboard-footer-navigation-f658b457.js";import{P as I}from"./index-4de96b18.js";import{c as A}from"./copy-to-clipboard-ddf9ebff.js";import{u as S}from"./index-9f8785a2.js";import{C as d}from"./index-2c4b8b3c.js";import{u as q}from"./useQuery-0abbcf43.js";import{u as M}from"./post-notification.api-d7cee9b0.js";import"./motion-4a110d9b.js";import"./Box-263f925f.js";import"./joinClasses-adfcc520.js";import"./isNativeReflectConstruct-061ae640.js";import"./setPrototypeOf-0bb37fbe.js";import"./assertThisInitialized-081f9914.js";const Z=()=>{var g,b,v,j,w;const c=D(),h=T(),{client:x,decoded:u}=S(),s=JSON.parse(localStorage.getItem("user")),{mutateAsync:C}=M();async function _(){var o;try{const i={type:"messaging",members:{$in:[u.user_id]}},n=[{last_message_at:-1}],l=(await x.queryChannels(i,n,{watch:!0,state:!0,limit:30})).filter(a=>a.id===h.id);return l.length>0?l[0]:[]}catch(i){return console.log(i),(o=i.response)==null?void 0:o.data}}const{data:e,isPending:f,isLoading:p,isError:y}=q({queryFn:_,queryKey:["fetch_channel",h.id],enabled:!!x&&!!u});console.log(e);const E=async()=>{if(confirm("Are you sure you want to delete this team?")){const o=await e.delete();console.log(o),m.success("Community Deleted Successfully"),c("/groups/investment_community/join-community")}},F=async()=>{var o,i;if(confirm("Are you sure you wnt to dissolve this Team?"))try{const n=await e.queryMembers({},{created_at:-1},{});console.log(n);let r=[];for(let a=0;a<n.members.length;a++)r=[...r,n.members[a].user_id];console.log(r);const l=await e.removeMembers([...r]);if(console.log(l),l){const a=await e.truncate({hard_delete:!0,skip_push:!1,message:{text:"Dear Everyone. The channel has been truncated.",user_id:u.user_id}});C({message:`${(o=a==null?void 0:a.channel)==null?void 0:o.name} channel has been dissolved. Community members and conversations will be deleted, but the channel is still very much live..`,email:[s==null?void 0:s.email],to:[s==null?void 0:s.id],fullName:[`${s==null?void 0:s.firstName} ${s==null?void 0:s.lastName}`],channelId:(i=e==null?void 0:e.data)==null?void 0:i.id}).then(()=>{console.log(a),m.success("Community members and conversations will be deleted, but the channel is still very much live."),c("/groups/investment_community/join-community")}).catch(k=>{console.log(k),m.error("error while creating notification")})}}catch(n){console.log(n),m.error("unable to dissolve community")}};return console.log(e),t.jsxs(P,{children:[t.jsx(d,{appear:p,children:t.jsx(N,{})}),t.jsxs(d,{appear:!p&&f,children:[t.jsx(N,{})," Resolving..."]}),t.jsx(d,{appear:y,children:t.jsx("div",{className:"px-[40px]",children:"ERR_INTERNET_CONNECTION_REFUSED"})}),t.jsx(d,{appear:e&&!p&&!f&&!y,children:t.jsxs("section",{className:"px-5",children:[t.jsxs("div",{className:"flex justify-between items-center mt-3",children:[t.jsx("header",{onClick:()=>c(-1),className:"text-[#537473] capitalize text-lg font-semibold cursor-pointer",children:(g=e==null?void 0:e.data)==null?void 0:g.name}),t.jsx("button",{onClick:()=>A(window.location.href),className:"!p-0 !bg-transparent flex gap-x-3 items-center text-[#A8CF45] underline font-semibold",children:"Copy link"})]}),t.jsxs("div",{className:"flex flex-col justify-center items-center gap-y-5",children:[t.jsx("div",{className:"rounded-full overflow-hidden w-[293px] h-[293px]",children:t.jsx(I,{imgUrl:(e==null?void 0:e.Image)??"",name:((b=e==null?void 0:e.data)==null?void 0:b.name)??"",className:"!w-full !h-full"})}),t.jsxs("div",{className:"max-w-[491px] text-center",children:[t.jsx("p",{children:(v=e==null?void 0:e.data)==null?void 0:v.description}),t.jsxs("div",{className:"mt-5 space-y-5",children:[t.jsxs("button",{onClick:F,className:"bg-[#EFF0F6] font-bold capitalize text-black px-5 py-2 w-full max-w-[350px]",children:["End"," "," ",(j=e==null?void 0:e.data)==null?void 0:j.name]}),t.jsxs("button",{onClick:E,className:"bg-[#EFF0F6] font-bold capitalize text-black px-5 py-2 w-full max-w-[350px]",children:["Dissolve"," "," ",(w=e==null?void 0:e.data)==null?void 0:w.name]})]})]})]})]})}),t.jsx(R,{hideContinueBtn:!0,backBtnText:"Back",cancelEventHandler:()=>c(-1),rowReverse:!0})]})};export{Z as default};