PageSourceSearch

https://shareden.in/assets/Room-DgpjZPXW.js

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

1import{d as W,u as p,j as e,P as G,Q as K,C as E,L as R,B as c,c as k,r as m,D as X,e as Y,f as Z,g as D,S as ee,h as z,a as se,R as ae}from"./index-CFJ27ZP-.js";import{A as F,a as M,b as I}from"./avatar-HUKItj1x.js";import{Q as re}from"./QRCarousel-DNTnXkIk.js";import{c as te,u as ne}from"./authSchema-MmugwzWH.js";import"./form-8zF3S441.js";import{I as Q}from"./input-Bkz9O8Ha.js";import{S as _}from"./scroll-area-CwLKPKWG.js";import{T as le,a as oe,b as ce,c as ie}from"./tooltip-DSuEBdZr.js";import{V as de}from"./AppSidebar-Bq9C9B2w.js";import{P as $}from"./pencil-wx7zPTNq.js";import{u as U,t as B,L as V}from"./label-D-cyiqYU.js";import H from"./formWrapper-DTOhGeVc.js";import{E as me,a as xe}from"./eye-Tq7ysrSi.js";import"./index-C-1sFIJi.js";import"./index-CQ8mqBJF.js";import"./floating-ui.react-dom-Dp9yLVN7.js";import"./separator-kowIez__.js";import"./sheet-BXt4xKeY.js";/**
2 * @license lucide-react v0.577.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const he=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ue=W("refresh-cw",he),fe=()=>{const{sessionQuery:a}=p(),{data:s,isLoading:t,isError:r}=a;return t?e.jsx(G,{}):r?e.jsx(e.Fragment,{children:"Something went wrong . Please refresh"}):e.jsxs("div",{className:"flex flex-col items-center gap-2 ",children:[e.jsx("div",{className:"relative group",children:e.jsxs(F,{className:"sm:w-[60px] sm:h-[60px] w-[50px] h-[50px] bg-transparent",children:[e.jsx(M,{src:s==null?void 0:s.avatar,alt:s==null?void 0:s.fullName,className:""}),e.jsx(I,{className:"bg-transparent",children:e.jsx("img",{src:"/altAvatar1.jpg",alt:"fallback avatar"})})]})}),e.jsx("p",{className:"font-medium tracking-wide w-[90px] truncate text-center",children:s==null?void 0:s.fullName})]})};function pe(){const{sessionQuery:a}=p(),{data:s,isLoading:t,isError:r}=a;return t?e.jsx(K,{}):r?e.jsx(e.Fragment,{children:"Something went wrong . Please refresh"}):e.jsx(re,{paymentMethod:s==null?void 0:s.paymentMethod,editable:!0})}const ge=({rooms:a})=>a!=null&&a.length?e.jsxs(E,{className:`flex flex-col gap-3 sm:gap-5 items-center bg-card py-6 px-10
7      shadow-[0_4px_12px_rgba(0,0,0,0.4)] my-10`,children:[e.jsx("h1",{className:"text-lg font-semibold",children:"Pending Payments"}),e.jsx(_,{children:e.jsx("div",{className:"flex flex-col gap-2 h-[6.6rem] mr-3",children:a==null?void 0:a.map(s=>e.jsx(le,{children:e.jsxs(oe,{children:[e.jsx(ce,{asChild:!0,children:e.jsx(R,{to:`/room/${s==null?void 0:s.roomId}/payment`,children:e.jsx(E,{className:"border-none",children:e.jsxs(c,{className:"text-lg bg-card-muted hover:bg-card-muted/80 py-6 w-[200px] truncate relative",children:[e.jsx("span",{className:"truncate",children:s==null?void 0:s.name}),e.jsx("span",{className:"absolute top-2 right-2 w-2.5 h-2.5 bg-red-500 rounded-full"})]})})})}),e.jsx(ie,{children:"Click to complete payment"})]})},s.roomId))})})]}):null,je=({variant:a=""})=>{const{logoutMutation:s}=p(),t=async()=>{try{const r=await s.mutateAsync();k("User logout successful")}catch{}};return e.jsx(c,{onClick:()=>t(),variant:a,size:"sm",className:"text-",children:"Logout"})},we=({onEdit:a})=>e.jsxs("div",{className:"flex justify-center items-center py-4 gap-1 ",children:[e.jsx(fe,{}),e.jsx(c,{className:" hover:bg-card-muted bg-card rounded w-4 h-8 hover:text-white ",variant:"ghost",onClick:a,children:e.jsx($,{className:""})})]}),ve=({onEdit:a,data:s})=>e.jsxs("div",{className:"relative ",children:[e.jsxs(F,{className:"w-8 h-8",children:[e.jsx(M,{src:s==null?void 0:s.avatar}),e.jsx(I,{children:e.jsx("img",{src:"/altAvatar1.jpg"})})]}),e.jsx(c,{variant:"ghost",className:"w-6 h-6 p-1 absolute -bottom-1 -right-2 text-muted hover:bg-muted hover:text-white",onClick:a,children:e.jsx($,{className:"w-3 h-3"})})]}),O=()=>Array.from({length:15},()=>Math.random().toString(36).substring(2,10)),Ne=(a,s="adventurer")=>`https://api.dicebear.com/9.x/${s}/svg?seed=${a}&backgroundColor=b6e3f4,c0aede,d1d4f9,ffd5dc,ffdfbf`,be=({onSelect:a,style:s="adventurer"})=>{const[t,r]=m.useState(null),[i,d]=m.useState(!1),[n,h]=m.useState(O),[x,u]=m.useState({}),[w,v]=m.useState(!1),g=m.useCallback(()=>{v(!0),u({}),r(null),h(O()),setTimeout(()=>v(!1),600)},[]),j=l=>{r(l),a(l),d(!1)},f=l=>{u(o=>({...o,[l]:!0}))},N=n.map(l=>({seed:l,url:Ne(l,s)}));return e.jsxs(X,{open:i,onOpenChange:d,children:[e.jsx(Y,{asChild:!0,children:e.jsx(c,{size:"sm",variant:"outline",className:"gap-2",onClick:()=>d(!0),children:t?e.jsx(e.Fragment,{children:"Change Avatar"}):"Select Avatar"})}),e.jsxs(Z,{className:"sm:max-w-md",children:[e.jsx(D,{children:e.jsx(de,{children:"Choose an avatar"})}),e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Pick your avatar"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Click any avatar to select it"})]}),e.jsx(c,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:g,title:"Generate new avatars",children:e.jsx(ue,{className:`h-4 w-4 transition-transform duration-500 ${w?"animate-spin":""}`})})]}
7),e.jsx("div",{className:"grid grid-cols-5 gap-3",children:N.map(({seed:l,url:o})=>e.jsxs("button",{onClick:()=>j(o),className:`
8                group relative aspect-square rounded-xl overflow-hidden border-2 transition-all duration-150
9                focus:outline-none focus-visible:ring-2 focus-visible:ring-ring
10                ${t===o?"border-primary ring-2 ring-primary/30 scale-105":"border-transparent hover:border-primary/50 hover:scale-105"}
11              `,children:[!x[o]&&e.jsx(ee,{className:"absolute inset-0 w-full h-full rounded-xl"}),e.jsx("img",{src:o,alt:`Avatar ${l}`,onLoad:()=>f(o),className:`w-full h-full object-cover transition-opacity duration-300 ${x[o]?"opacity-100":"opacity-0"}`}),t===o&&e.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-primary/20 rounded-xl",children:e.jsx("svg",{className:"w-5 h-5 text-primary drop-shadow",fill:"none",stroke:"currentColor",strokeWidth:2.5,viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})]},l))}),e.jsxs("p",{className:"text-xs text-muted-foreground text-center mt-2",children:["Powered by"," ",e.jsx("a",{href:"https://www.dicebear.com",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"DiceBear"})]})]})]})},ye=({variant:a=""})=>{const[s,t]=m.useState(!1),[r,i]=m.useState(!1),[d,n]=m.useState(!1),[h,x]=m.useState(!1),{changePasswordMutation:u}=p(),{register:w,handleSubmit:v,formState:{errors:g,isDirty:j,isSubmitting:f},reset:N}=U({resolver:B(te),defaultValues:{oldPassword:"",newPassword:"",confirmNewPassword:""},mode:"onTouched"}),l=()=>{N(),i(!1),n(!1),x(!1),t(!0)},o=()=>{t(!1)},C=y=>{u.mutate({oldPassword:y.oldPassword,newPassword:y.newPassword},{onSuccess:()=>{k.success("Password changed successfully"),o()},onError:S=>{var L,P;k.error(((P=(L=S==null?void 0:S.response)==null?void 0:L.data)==null?void 0:P.message)||"Failed to change password")}})},b=({id:y,label:S,registerName:L,error:P,showPassword:T,setShowPassword:J})=>e.jsxs("div",{children:[e.jsx(V,{htmlFor:y,className:"text-sm text-white",children:S}),e.jsxs("div",{className:"relative",children:[e.jsx(Q,{id:y,type:T?"text":"password",...w(L),className:"pr-10"}),e.jsx("button",{type:"button",onMouseDown:A=>A.preventDefault(),onClick:()=>J(A=>!A),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-white",children:T?e.jsx(me,{size:18}):e.jsx(xe,{size:18})})]}),P&&e.jsx("p",{className:"mt-1 text-sm text-destructive",children:P.message})]});return e.jsxs(e.Fragment,{children:[e.jsx(c,{variant:a,onClick:l,children:"Change Password"}),s&&e.jsx(H,{onClose:o,children:e.jsxs("form",{onSubmit:v(C),className:"flex flex-col gap-6 max-w-md mx-auto p-6 rounded-2xl text-white shadow-md",children:[e.jsx(b,{id:"oldPassword",label:"Current Password",registerName:"oldPassword",error:g.oldPassword,showPassword:r,setShowPassword:i}),e.jsx(b,{id:"newPassword",label:"New Password",registerName:"newPassword",error:g.newPassword,showPassword:d,setShowPassword:n}),e.jsx(b,{id:"confirmNewPassword",label:"Confirm New Password",registerName:"confirmNewPassword",error:g.confirmNewPassword,showPassword:h,setShowPassword:x}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(c,{type:"button",variant:"outline",onClick:o,disabled:f,children:"Cancel"}),e.jsx(c,{type:"submit",disabled:!j||f||u.isLoading,children:f||u.isLoading?e.jsx(z,{size:"sm"}):"Change Password"})]})]})})]})},Se=({initialData:a,onCancel:s,onSave:t})=>{const{updateUserMutation:r}=p(),{register:i,handleSubmit:d,watch:n,setValue:h,formState:{errors:x,isDirty:u,isSubmitting:w}}=U({resolver:B(ne),defaultValues:{fullName:a==null?void 0:a.fullName,avatar:a==null?void 0:a.avatar},mode:"onTouched"}),v=n("avatar"),g=j=>{const{fullName:f,avatar:N}=j,l={};if(f!==a.fullName&&(l.fullName=f),N!==a.avatar&&(l.avatar=N),Object.keys(l).length===0){s();return}r.mutate(l,{onSuccess:()=>{k.success("Profile updated"),t()},onError:o=>{var C,b;k.error(((b=(C=o==null?void 0:o.response)==null?void 0:C.data)==null?void 0:b.message)||"Failed to update profile")}})};return e.jsxs("form",{onSubmit:d(g),className:"max-w-xl mx-auto flex flex-col gap-6 py-4 rounded-2xl shadow-md ",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2 ",children:[e.jsxs(F,{className:"w-20 h-20 rounded-full object-cover",children:[e.jsx(M,{src:v||(a==null?void 0:a.avatar),alt:a==null?void 0:a.fullName}),e.jsx(I,{children:e.jsx("img",{src:"/altAvatar1.jpg",alt:"fallback avatar"})})]}),e.jsx(be,{onSelect:j=>h("avatar",j,{shouldDirty:!0,shouldTouch:!0})}),x.avatar&&e.jsx("p",{className:"text-sm text-destructive",children:x.avatar.message})]}),e.jsx("div",{className:"flex gap-4 ",children:e.jsxs("div",{className:"flex-1 ",children:[e.jsx(V,{htmlFor:"fullName",className:"text-sm text-white",children:"Full Name"}),e.jsx(Q,{id:"fullName",...i("fullName"),className:"bg-[#121418] text-white"}),x.fullName&&e.jsx("p",{className:"text-sm text-destructive",children:x.fullName.message})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(c,{variant:"outline",onClick:s,children:"Cancel"}),e.jsx(c,{type:"submit",disabled:!u||w||r.isLoading,children:w||r.isLoading?e.jsx(z,{size:"sm"}):"Save"})]})]})},q=({open:a,onClose:s,user:t,onSave:r})=>a?e.jsxs(H,{onClose:s,className:"",children:[e.jsx(Se,{initialData:t,onCancel:s,onSave:()=>{r(),s()}}),e.jsx(ye,{variant:"outline"})]}):null,Pe=({user:a,refetch:s})=>{se(),p();const[t,r]=m.useState(!1);return e.jsxs("div",{className:`flex items-center justify-between sm:px-8 px-4 py-3 
12bg-background/80 border-b border-zinc-800 `,children:[e.jsx("h3",{className:"font-semibold text-lg hidden bs:block",children:" ShareDen"}),e.jsxs("div",{className:"block bs:hidden",children:[e.jsx(ve,{data:a,onEdit:()=>r(!0)}),e.jsx(q,{open:t,onClose:()=>r(!1),user:a,onSave:()=>s()})]}),e.jsxs("div",{className:"flex sm:space-x-4",children:[e.jsx(R,{to:"/room/create",className:" ",children:e.jsxs(c,{variant:"link",size:"sm",className:"text- ",children:[" ","Create/Join Room"]})}),e.jsx(je,{variant:"link"})]})]})},ke=()=>{var i,d;const{sessionQuery:a}=p(),{data:s,isLoading:t,isError:r}=a;return t?e.jsx(ae,{}):r?e.jsx(e.Fragment,{children:"Something went wrong . Please refresh"}):e.jsx(E,{className:`flex flex-col gap-3 sm:gap-5 items-center bg-card py-6 px-10
13  shadow-[0_4px_12px_rgba(0,0,0,0.4)] `,children:((i=s==null?void 0:s.rooms)==null?void 0:i.length)>
130?e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-lg font-semibold",children:"Rooms"}),e.jsx(_,{children:e.jsx("div",{className:"flex flex-col gap-2 h-[7rem] pt- mr-3",children:(d=s==null?void 0:s.rooms)==null?void 0:d.map(n=>e.jsx(R,{to:`/room/${n==null?void 0:n.roomId}`,children:e.jsx(E,{className:"border-none",children:e.jsx(c,{className:" text-lg bg-card-muted max-w-[100%] hover:bg-card-muted/80 py-6 w-[200px] truncate ",children:e.jsx("span",{className:"truncate",children:n==null?void 0:n.name})})})},n==null?void 0:n.roomId))})})]}):e.jsxs("div",{className:"flex flex-col gap-4 text-center ",children:[e.jsx("p",{className:"text-muted-foreground text-lg",children:"No rooms yet"}),e.jsx(R,{to:"/room/create",children:e.jsx(c,{className:"",variant:"outline",children:"Create / Join Room"})})]})})},qe=()=>{const{sessionQuery:a}=p(),{data:s,isLoading:t,isError:r,refetch:i}=a,d=s==null?void 0:s.pendingRooms,[n,h]=m.useState(!1);return e.jsxs("div",{className:"bg-background h-[100vh]",children:[e.jsx(Pe,{user:s,refetch:i}),e.jsxs("div",{className:"flex flex-col items-center pt-12 bs:pt-16 bs:gap-16 ",children:[e.jsxs("div",{className:"flex flex-col bs:flex-row items-center justify-evenly w-full bs:gap-0 gap-12 ",children:[e.jsxs("div",{className:"bs:space-y-20",children:[e.jsxs("div",{className:"bs:block hidden ",children:[e.jsx(we,{onEdit:()=>h(!0)}),e.jsx(q,{open:n,onClose:()=>h(!1),user:s,onSave:()=>i()})]}),e.jsx(ke,{})]}),e.jsx(pe,{})]}),e.jsx(ge,{rooms:d})]})]})};export{qe 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.