PageSourceSearch

https://gobytv.com/assets/WatchPartyLobby-D6GH6a5U.js

js gobytv.com collected 2026-10-05 19:23:50 UTC 8,567 bytes, 1 lines download raw bytes

1import{ab as E,V as G,r as l,a as u,l as K,j as e,g as T,B as N,A,W as B,a2 as M,J as p,n as w,q as _,G as P,T as C,U as D,X as H,x as J,D as O,t as Q,h as o}from"./index-C4LWZPK9.js";import{P as R}from"./plus-Nk5sUbpA.js";import{U as X}from"./users-DL5nkPsl.js";function ee(){const{user:t}=E()||{},f=G(),[m,k]=l.useState(""),[a,S]=l.useState(null),[g,L]=l.useState(""),[i,v]=l.useState(!1),[n,j]=l.useState(""),[d,y]=l.useState([]),{data:U=[]}=u({queryKey:["videos-for-party"],queryFn:()=>o.entities.VideoContent.filter({status:"published"},"-created_date",50)}),{data:I=[]}=u({queryKey:["active-parties"],queryFn:()=>o.entities.WatchParty.filter({status:"active"},"-created_date",20),refetchInterval:5e3}),{data:W=[]}=u({queryKey:["users-for-invite"],queryFn:()=>o.entities.User.list()}),x=K({mutationFn:()=>o.entities.WatchParty.create({title:g||`${(t==null?void 0:t.full_name)||"Someone"}'s Party`,video_id:a.id,video_title:a.title,video_thumbnail:a.thumbnail_url,host_id:t.id,host_name:t.full_name||t.email,status:"active",is_private:i,invited_user_ids:i?[t.id,...d.map(s=>s.id)]:[],is_playing:!1,playback_position:0}),onSuccess:s=>f(`/watch-party/${s.id}`),onError:()=>Q.error("Failed to create party")}),q=U.filter(s=>{var r;return!m||((r=s.title)==null?void 0:r.toLowerCase().includes(m.toLowerCase()))}),b=n.trim()?W.filter(s=>{var r,c;return s.id!==(t==null?void 0:t.id)&&!d.find(z=>z.id===s.id)&&(((r=s.full_name)==null?void 0:r.toLowerCase().includes(n.toLowerCase()))||((c=s.email)==null?void 0:c.toLowerCase().includes(n.toLowerCase())))}).slice(0,6):[],$=s=>{y(r=>[...r,{id:s.id,name:s.full_name||s.email}]),j("")},F=s=>y(r=>r.filter(c=>c.id!==s)),h=I.filter(s=>!s.is_private||s.host_id===(t==null?void 0:t.id)||(s.invited_user_ids||[]).includes(t==null?void 0:t.id));return e.jsxs("div",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-5xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(T,{to:"/goby-chat",children:e.jsx(N,{variant:"ghost",size:"icon",children:e.jsx(A,{className:"w-4 h-4"})})}),e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/20 flex items-center justify-center shrink-0",children:e.jsx(B,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-display font-bold",children:"Watch Party"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Watch Goby videos together and chat in real-time"})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.jsx("h2",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:"Start a Party — Pick a Video"}),e.jsxs("div",{className:"relative",children:[e.jsx(M,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(p,{className:"pl-9",placeholder:"Search videos...",value:m,onChange:s=>k(s.target.value)})]}),e.jsx("div",{className:"grid sm:grid-cols-2 gap-3 max-h-[360px] overflow-y-auto pr-1",children:q.map(s=>e.jsxs(w.div,{whileHover:{scale:1.01},onClick:()=>S((a==null?void 0:a.id)===s.id?null:s),className:`cursor-pointer rounded-xl overflow-hidden border-2 transition-colors ${(a==null?void 0:a.id)===s.id?"border-primary":"border-border hover:border-border/60"}`,children:[e.jsxs("div",{className:"relative aspect-video bg-secondary",children:[s.thumbnail_url?e.jsx("img",{src:s.thumbnail_url,alt:s.title,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(_,{className:"w-8 h-8 text-muted-foreground"})}),(a==null?void 0:a.id)===s.id&&e.jsx("div",{className:"absolute inset-0 bg-primary/20 flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary flex items-center justify-center",children:e.jsx(_,{className:"w-4 h-4 text-white"})})})]}),e.jsxs("div",{className:"p-2 bg-card",children:[e.jsx("p",{className:"text-xs font-medium line-clamp-1",children:s.title}),e.jsx("p",{className:"text-[10px] text-muted-foreground capitalize",children:s.category})]})]},s.id))}),a&&e.jsxs(w.div,{initial:{opacity:0,y:6}
1,animate:{opacity:1,y:0},className:"space-y-3",children:[e.jsxs("div",{className:"p-4 bg-primary/10 rounded-xl border border-primary/30 space-y-3",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Selected: ",e.jsx("span",{className:"text-primary",children:a.title})]}),e.jsx(p,{placeholder:"Party name (optional)",value:g,onChange:s=>L(s.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>v(!1),className:`flex-1 flex items-center justify-center gap-2 rounded-lg px-3 py-2 text-sm font-medium border transition-colors ${i?"border-border text-muted-foreground hover:border-primary/40":"bg-primary text-white border-primary"}`,children:[e.jsx(P,{className:"w-4 h-4"})," Public"]}),e.jsxs("button",{onClick:()=>v(!0),className:`flex-1 flex items-center justify-center gap-2 rounded-lg px-3 py-2 text-sm font-medium border transition-colors ${i?"bg-primary text-white border-primary":"border-border text-muted-foreground hover:border-primary/40"}`,children:[e.jsx(C,{className:"w-4 h-4"})," Private"]})]}),i&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-xs text-muted-foreground font-medium flex items-center gap-1.5",children:[e.jsx(D,{className:"w-3.5 h-3.5"})," Invite people"]}),e.jsxs("div",{className:"relative",children:[e.jsx(p,{placeholder:"Search by name or email...",value:n,onChange:s=>j(s.target.value),className:"text-sm"}),b.length>0&&e.jsx("div",{className:"absolute top-full left-0 right-0 z-10 mt-1 bg-popover border border-border rounded-lg shadow-lg overflow-hidden",children:b.map(s=>e.jsxs("button",{onClick:()=>$(s),className:"w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-secondary transition-colors text-left",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/20 flex items-center justify-center text-xs font-bold text-primary shrink-0",children:(s.full_name||s.email||"U")[0].toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.full_name||s.email}),s.full_name&&e.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:s.email})]})]},s.id))})]}),d.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.map(s=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-primary/20 text-primary rounded-full px-2.5 py-0.5 text-xs font-medium",children:[s.name,e.jsx("button",{onClick:()=>F(s.id),className:"hover:text-red-400 transition-colors",children:e.jsx(H,{className:"w-3 h-3"})})]},s.id))})]})]}),e.jsxs(N,{className:"w-full bg-primary hover:bg-primary/90 gap-2 h-11",disabled:x.isPending,onClick:()=>x.mutate(),children:[e.jsx(R,{className:"w-4 h-4"}),x.isPending?"Creating...":`Start ${i?"Private":"Public"} Watch Party`]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h2",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),"Live Parties (",h.length,")"]}),h.length===0&&e.jsxs("div",{className:"text-center py-8 text-muted-foreground text-sm",children:[e.jsx(X,{className:"w-8 h-8 mx-auto mb-2 opacity-20"}),"No active parties right now"]}),e.jsx("div",{className:"space-y-2",children:h.map(s=>e.jsx(J,{className:"bg-card border-border hover:border-primary/40 transition-colors cursor-pointer",onClick:()=>f(`/watch-party/${s.id}`),children:e.jsxs(O,{className:"p-3 flex gap-3",children:[s.video_thumbnail&&e.jsx("img",{src:s.video_thumbnail,alt:"",className:"w-16 h-10 rounded object-cover shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("p",{className:"text-xs font-semibold line-clamp-1 flex-1",children:s.title||s.video_title}),s.is_private?e.jsx(C,{className:"w-3 h-3 text-muted-foreground shrink-0"}):e.jsx(P,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground line-clamp-1",children:s.video_title}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full"}),e.jsx("span",{className:"text-[10px] text-green-500 font-medium",children:"Live"}),e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["· ",s.host_name]})]})]})]})},s.id))})]})]})]})}export{ee 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.