PageSourceSearch

https://shareden.in/assets/RoomDetails-Cajdkz4i.js

js shareden.in collected 2026-09-24 15:02:46 UTC 15,318 bytes, 13 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Chat-DsT9AMDM.js","assets/index-CFJ27ZP-.js","assets/index-DXLB56bv.css","assets/scroll-area-CwLKPKWG.js","assets/index-C-1sFIJi.js","assets/avatar-HUKItj1x.js","assets/index-CQ8mqBJF.js","assets/textarea-CcFx6G19.js","assets/useInfiniteQuery-Da9ruv-4.js"])))=>i.map(i=>d[i]);
2import{d as V,p as E,q as K,s as C,c as P,t as b,j as e,B as g,r as x,u as X,v as ee,w as se,a as te,S,x as L,_ as k,y as O,D as I,e as A,f as F,M as le}from"./index-CFJ27ZP-.js";import{C as ae,a as z}from"./popover-guNYsl4t.js";import{z as _,s as T,u as B,t as oe}from"./label-D-cyiqYU.js";import{F as Q,b as N,c as v,d as y,e as $,a as q}from"./form-8zF3S441.js";import{I as R}from"./input-Bkz9O8Ha.js";import{D as ne,g as H}from"./taskHelper-CcyhuNGH.js";import re from"./formWrapper-DTOhGeVc.js";import{R as ce,a as ie}from"./radio-group-BgVeTxKe.js";import{S as M}from"./scroll-area-CwLKPKWG.js";import{S as de}from"./separator-kowIez__.js";import{A as me,a as xe,b as ue}from"./avatar-HUKItj1x.js";import he from"./Chat-DsT9AMDM.js";import"./index-C-1sFIJi.js";import"./index-WX0W2y0G.js";import"./floating-ui.react-dom-Dp9yLVN7.js";import"./index-BzxgSLMt.js";import"./index-CQ8mqBJF.js";import"./textarea-CcFx6G19.js";import"./useInfiniteQuery-Da9ruv-4.js";/**
3 * @license lucide-react v0.577.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const pe=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],fe=V("bell",pe);/**
8 * @license lucide-react v0.577.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const je=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ge=V("plus",je),we=_.object({title:T(1,100,"title"),voteEndTime:_.date(),options:_.array(T(1,100,"Option Text")).min(2,{message:"At least two options are required"})}),D="poll",Ne=async(l,a)=>E.post(`${D}/${a}/polls`,l),ve=async(l,a)=>E.patch(`/${D}/${l}/vote/${a}`),ye=async l=>E.delete(`/${D}/${l}`),W=()=>{K();const l=C({mutationFn:({data:r,roomId:c})=>Ne(r,c),onSuccess:()=>{P("Poll created successfully")}}),a=C({mutationFn:r=>ye(roomId),onSuccess:()=>{P("Poll deleted successfully")}}),s=C({mutationFn:({pollId:r,optionId:c})=>ve(r,c),onSuccess:()=>{P("Vote added successfully")}});return{createPollMutation:l,deletePollMutation:a,castVoteMutation:s}},be=({onClose:l})=>{const{roomId:a}
12=b(),{createPollMutation:s}=W(),r=B({resolver:oe(we),defaultValues:{title:"",voteEndTime:void 0,options:[""]}}),{watch:c,setValue:o,handleSubmit:f,reset:n}=r,t=c("options"),h=async d=>{const m={...d,options:d.options.filter(u=>u.trim()!=="")};try{const u=await s.mutateAsync({data:m,roomId:a});n(),l()}catch{}},p=()=>{t.length<6?o("options",[...t,""]):P.error("You can only add up to 6 options.")},i=d=>{const m=t.filter((u,j)=>j!==d);o("options",m)};return e.jsx(Q,{...r,children:e.jsxs("form",{onSubmit:f(h),className:"space-y-4",children:[e.jsxs(N,{children:[e.jsx(v,{children:"Title"}),e.jsx(y,{children:e.jsx(R,{...r.register("title"),placeholder:"Add Poll Title"})}),e.jsx($,{})]}),e.jsx(q,{control:r.control,name:"voteEndTime",render:({field:d})=>e.jsxs(N,{children:[e.jsx(v,{children:"Vote End Time"}),e.jsx(y,{children:e.jsx(ne,{name:"voteEndTime",field:d,disableBefore:new Date,disableAfter:new Date(Date.now()+7*24*60*60*1e3)})}),e.jsx($,{})]})}),e.jsxs(N,{children:[e.jsx(v,{children:"Options"}),t.map((d,m)=>e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(y,{className:"flex-1",children:e.jsx(R,{placeholder:`Option ${m+1}`,value:d,onChange:u=>{const j=[...t];j[m]=u.target.value,o("options",j)}})}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(m),disabled:t.length<=1,children:"Remove"})]},m)),e.jsxs(g,{type:"button",variant:"outline",onClick:p,className:"flex items-center",children:[e.jsx(ge,{className:"mr-2 h-4 w-4"})," Add Option"]}),e.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"You can add up to 6 options."})]}),e.jsx(g,{type:"submit",disabled:s.isPending,children:s.isPending?"Creating...":"Create Poll"})]})})},Pe=({poll:l})=>{const a=B(),{castVoteMutation:s}=W(),r=async c=>{const o={pollId:l._id,optionId:c.optionId};try{await s.mutateAsync(o)}catch{}};return e.jsx("div",{className:"rounded-lg py-1 shadow ",children:e.jsx(Q,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(r),className:"space-y-4 ",children:[e.jsx(q,{control:a.control,name:"optionId",render:({field:c})=>e.jsxs(N,{className:"",children:[e.jsx(v,{className:"text-md font-semibold text-foreground ",children:l.title}),e.jsx(y,{className:"",children:e.jsx(ce,{onValueChange:c.onChange,defaultValue:c.value,className:"flex flex-col gap-2 ",children:l.options.map(o=>e.jsxs(N,{className:"flex items-center bg-card-muted px-5 rounded-lg gap-3",children:[e.jsx(y,{className:"",children:e.jsx(ie,{value:o._id})}),e.jsx(v,{className:"text-sm font-normal pb-3",children:o.optionText})]},o._id))})}),e.jsx($,{})]})}),e.jsx(g,{type:"submit",className:"w-full",disabled:s.isPending,children:s.isPending?"Voting...":"
12Vote"})]})})})},Se=({poll:l})=>e.jsxs("div",{className:" rounded-lg shadow flex flex-col gap-3 py-1",children:[e.jsx("h3",{className:"text-md font-semibold text-foreground",children:l.title}),e.jsx("div",{className:"space-y-2",children:l.options.map(a=>e.jsxs("div",{className:"flex justify-between items-center px-3 py-2 bg-card-muted rounded-md",children:[e.jsx("span",{className:"text-sm",children:a.optionText}),e.jsx("span",{className:"text-sm font-semibold text-primary",children:a.votes.length})]},a._id))})]}),Ce=({initialPolls:l})=>{const[a,s]=x.useState(l||[]),{sessionQuery:r}=X(),{data:c,isLoading:o,isError:f}=r;b();const n=ee();if(x.useEffect(()=>{const i=m=>{s((u=[])=>[...u,m])},d=m=>{s((u=[])=>u.map(j=>j._id===m.pollId?{...j,options:m.options}:j))};return n.on("createdPoll",i),n.on("castVote",d),()=>{n.off("createPoll",i),n.off("castVote",d)}},[n]),o)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."});if(f)return e.jsx("p",{className:"text-sm text-destructive",children:"Something went wrong"});const t=new Date,h=[],p=[];if(a)for(const i of a){const d=new Date(i.voteEndTime),m=i.options.some(j=>j.votes.some(w=>w.voter===c._id)),u=d<=t;m||u?p.push(i):h.push(i)}return h.sort((i,d)=>new Date(d.createdAt)-new Date(i.createdAt)),h.length==0&&p.length==0?e.jsx("p",{className:"text-muted-foreground text-sm mt-8 text-center",children:"Room has no polls."}):e.jsxs("div",{className:"flex flex-col gap-3 ",children:[h.map(i=>e.jsx(Pe,{poll:i},i._id)),p.length>0&&e.jsx("div",{className:"flex flex-col gap-3",children:p.map(i=>e.jsx(Se,{poll:i},i._id))})]})},G=({initialPolls:l})=>{const[a,s]=x.useState(!1);return e.jsxs("div",{className:"bs:w-[25rem] bs:h-[305px] h-[400px] rounded-lg p-4 flex flex-col bg-card  border-none shadow-lg",children:[e.jsxs("div",{className:"flex justify-between items-center pb-1 mb-1 px-2",children:[e.jsx("h2",{className:"font-semibold text-lg",children:"Polls"}),e.jsx(g,{size:"icon",variant:"primary",onClick:()=>s(!0),children:e.jsx(ae,{})})]}),e.jsx(de,{}),a&&e.jsx(re,{className:"",onClose:()=>s(!1),children:e.jsx(be,{onClose:()=>s(!1)})}),e.jsx(M,{className:"flex-1 py-2 px-4",children:e.jsx(Ce,{initialPolls:l})})]})},_e=Object.freeze(Object.defineProperty({__proto__:null,default:G},Symbol.toStringTag,{value:"Module"})),$e=()=>{const{unreadCount:l,notifications:a,markAllSeen:s}=se(),[r,c]=x.useState(!1),o=x.useRef();x.useEffect(()=>{const n=t=>{r&&o.current&&!o.current.contains(t.target)&&c(!1)};return window.addEventListener("mousedown",n),()=>window.removeEventListener("mousedown",n)},[r]);const f=()=>{r||s(),c(n=>!n)};return e.jsx("div",{className:"notification rounded-3xl flex justify-center items-center hover:bg-muted/30 transition-colors bg-card ",children:e.jsxs("div",{className:"relative ",children:[e.jsxs("button",{onClick:f,className:"p-2 ",children:[e.jsx(fe,{className:" text-primary p-[0.15rem]"}),l>0&&e.jsx("span",{className:"absolute -top-1 p-[0.1rem] right-1 bg-black text-white text-xs ",children:l})]}),r&&e.jsx("div",{ref:o,className:"absolute right-0 mt-2 w-80  bg-background border rounded-lg shadow-lg z-50 py-2 ",children:e.jsx(M,{className:"h-40 m-2",children:e.jsx("div",{className:"px-3",children:a.length===0?e.jsx("p",{className:"text-md text-muted-foreground text-center py-2",children:"No notifications"}):a.map(n=>{var t,h,p;return e.jsx("div",{className:"mb-2 pl-2 py-2 rounded bg-card-muted text-gray-300 transition ",children:e.jsxs("div",{className:"flex items-center gap-2 ",children:[e.jsxs(me,{className:" w-6 h-6",children:[e.jsx(xe,{src:(t=n==null?void 0:n.actor)==null?void 0:t.avatar,alt:(h=n==null?void 0:n.actor)==null?void 0:h.fullName[0],className:""}),e.jsx(ue,{className:"bg-transparent",children:e.jsx("img",{src:"/altAvatar1.jpg",alt:"fallback avatar"})})]}),e.jsxs("p",{className:"text-sm leading-tight",children:[e.jsx("span",{className:"font-medium",children:((p=n.actor)==null?void 0:p.fullName)||"Someone"})," ",n.message]})]})},n.id)})})})})]})})},Y=({scheduledTasks:l})=>{const a=x.useRef(null),s=te(),{roomId:r}=b(),[c]=x.useState(()=>`card-clip-${Math.random().toString(36).slice(2)}
12`),[o,f]=x.useState("");x.useEffect(()=>{const t=()=>{if(!a.current)return;const h=400,p=260,i=w=>(w/h).toFixed(6),d=w=>(w/p).toFixed(6),m=(20/h).toFixed(6),u=(20/p).toFixed(6),j=["M0,0",`H${i(328)}`,`A${m},${u} 0,0,1 ${i(348)},${d(20)}`,`L${i(348)},${d(18)}`,`A${m},${u} 0,0,0 ${i(368)},${d(38)}`,`L${i(380)},${d(38)}`,`A${m},${u} 0,0,1 ${i(400)},${d(58)}`,"V1","H0","Z"].join(" ");f(j)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const n=t=>{s(`/room/${r}/tasks`,{state:{focusTaskId:t}})};return e.jsxs("div",{className:"relative shadow-lg ",children:[e.jsx("svg",{width:"0",height:"0",style:{position:"absolute"},children:e.jsx("defs",{children:e.jsx("clipPath",{id:c,clipPathUnits:"objectBoundingBox",children:o&&e.jsx("path",{d:o})})})}),e.jsx($e,{}),e.jsxs("div",{ref:a,className:"w-[25rem] max-w-full p-3 bg-card rounded-lg",style:{clipPath:o?`url(#${c})`:void 0},children:[e.jsxs("h3",{className:"font-semibold text-base mx-2",children:["Scheduled Tasks (",l.length,")"]}),e.jsx(M,{className:"h-[12.7rem] py-4 pl-2 pr-4 mt-1",children:l.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"No tasks for this date."}):e.jsx("ul",{className:"space-y-2 ",children:l.map(t=>{var h,p;return e.jsxs("li",{onClick:()=>n(t.id),className:"px-3 py-2 rounded-xl bg-card-muted transition cursor-pointer hover:opacity-90 ",children:[e.jsx("p",{className:"font-semibold text-primary text-sm",children:t==null?void 0:t.title}),(t==null?void 0:t.description)&&e.jsx("p",{className:"text-xs truncate my-1",children:t.description}),e.jsxs("p",{className:"text-xs mt-1 text-foreground",children:["Assignee:"," ",e.jsx("span",{className:"font-medium text-primary",children:(p=(h=t==null?void 0:t.assignees)==null?void 0:h[0])==null?void 0:p.fullName})]})]},t==null?void 0:t.id)})})})]})]})},Ee=()=>e.jsx(S,{className:"h-[370px] w-[25rem]"}),U=()=>e.jsx(S,{className:"rounded-lg p-4 h-[320px] max-w-md"}),Me=()=>e.jsx(S,{className:"w-[25rem] h-[305px]"}),Z=()=>e.jsx(S,{className:"w-[400px] h-[256px]"}),De=()=>e.jsxs("div",{className:" flex w-full items-center justify-center  gap-10 my-5 ",children:[e.jsxs("div",{className:"flex flex-col gap-5 ",children:[e.jsx(U,{}),e.jsx(Me,{})]}),e.jsxs("div",{className:"flex flex-col gap-5 ",children:[e.jsx(Z,{}),e.jsx(Ee,{})]})]}),Ie=()=>e.jsx("div",{className:"flex flex-col items-center px-5 py-2 gap-2 mt-12",children:e.jsxs("div",{className:"flex flex-col items-center gap-8 w-full ",children:[e.jsx("div",{className:"w-full max-w-[25rem] ",children:e.jsx(U,{})}),e.jsx("div",{className:"w-full max-w-[25rem]",children:e.jsx(Z,{})})]})}),Ae=L.lazy(()=>k(()=>Promise.resolve().then(()=>_e),void 0)),Fe=L.lazy(()=>k(()=>import("./Chat-DsT9AMDM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),J=()=>{var t;const{roomId:l}=b(),{roomQuery:a}=O(l),{data:s,isLoading:r,isError:c}=a,[o,f]=x.useState(new Date);x.useState(!1),x.useState(!1);const n=x.useMemo(()=>!(s!=null&&s.tasks)||!o?[]:H(s.tasks,o),[s==null?void 0:s.tasks,o]);return r?e.jsx(Ie,{}):c?e.jsx(e.Fragment,{children:"Something went wrong. Please refresh."}):e.jsxs("div",{className:"lg:mt-5 mt-0 flex flex-col items-center px-5 gap-1 ",children:[((t=s==null?void 0:s.plan)==null?void 0:t.planId)!="free"&&e.jsxs("div",{className:"flex w-full max-w-[25rem] justify-end gap-2 mx-2 ",children:[e.jsxs(I,{children:[e.jsx(A,{asChild:!0,children:e.jsx(g,{variant:"ghost",className:"h-[30px] p-2",children:"poll"})}),e.jsx(F,{className:"rounded-lg p-4 shadow-md max-h-[420px] h-full max-w-md bg-card w-full ",children:e.jsx(Ae,{initialPolls:s.polls})})]}),e.jsxs(I,{children:[e.jsx(A,{asChild:!0,children:e.jsx(g,{variant:"ghost",className:"h-[30px] p-2",children:e.jsx(le,{})})}),e.jsx(F,{className:"max-w-md w-full",children:e.jsx(Fe,{messages:s==null?void 0:s.chatMessages})})]})]}),e.jsxs("div",{className:"flex flex-col items-center gap-4 w-full ",children:[e.jsx("div",{className:"w-full max-w-[25rem] bg-card rounded-lg shadow-md p-4",children:e.jsx(z,{mode:"single",selected:o,onSelect:f,className:"h-[300px] w-full rounded-xl",classNames:{months:"flex w-full flex-col sm:flex-row space-y-4 sm:sp
12ace-x-4 sm:space-y-0 flex-1",month:"space-y-4 w-full flex flex-col",table:"w-full h-full border-collapse space-y-1",head_row:"",row:"w-full mt-2"}})}),e.jsx("div",{className:"w-full max-w-[25rem]",children:e.jsx(Y,{scheduledTasks:n})})]})]})},Te=()=>{var t;const{roomId:l}=b(),{roomQuery:a}=O(l),{data:s,isLoading:r,isError:c}=a,[o,f]=x.useState(new Date),n=x.useMemo(()=>!(s!=null&&s.tasks)||!o?[]:H(s.tasks,o),[s==null?void 0:s.tasks,o]);return r?e.jsx(De,{}):c?e.jsx(e.Fragment,{children:"Something went wrong. Please refresh"}):((t=s==null?void 0:s.plan)==null?void 0:t.planId)==="free"?e.jsx(J,{}):e.jsxs("div",{className:" flex  w-full items-center justify-center  gap-10 my-2 ",children:[e.jsxs("div",{className:"flex flex-col gap-5 ",children:[e.jsx("div",{className:` rounded-lg p-4 h-[320px] max-w-md bg-card  border-none
13   shadow-lg`,children:e.jsx(z,{classNames:{months:"flex w-full flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0 flex-1",month:"space-y-4 w-full flex flex-col",table:"w-full h-full border-collapse space-y-1",head_row:"",row:"w-full mt-2"},mode:"single",selected:o,onSelect:f,className:"rounded-xl h-[300px] w-full"})}),e.jsx(G,{initialPolls:s==null?void 0:s.polls})]}),e.jsxs("div",{className:"flex flex-col gap-5 ",children:[e.jsx(Y,{scheduledTasks:n}),e.jsx(he,{messages:s==null?void 0:s.chatMessages,chatMessagesMeta:s==null?void 0:s.chatMessagesMeta})]})]})};function ss(){const[l,a]=x.useState(()=>window.innerWidth<=929);return x.useEffect(()=>{const s=window.matchMedia("(max-width: 929px)"),r=c=>a(c.matches);return s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[]),l?e.jsx(J,{}):e.jsx(Te,{})}export{ss as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.