2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
|
|
import{a as x,j as e}from"./vendor-react-yWUy5XPk.js";import{g as v,u as E,B as m,C as f,k as L,S as n,i as M}from"./index-CYK_b1Uz.js";import{ai as A,U as T,Y as I,aj as R,ak as V,o as D,F as w,af as F,al as B}from"./vendor-icons-DJFb1Tiw.js";import{m as j}from"./vendor-motion-B3XPS3Jc.js";import"./vendor-CveO81sn.js";import"./vendor-security-DsrNJhpn.js";import"./vendor-router-BNNHboN9.js";import"./vendor-tanstack-kPY9uK0s.js";import"./vendor-http-Cz8wfb0q.js";import"./vendor-utils-DtoSyhX2.js";import"./vendor-i18n-CMcqpBLz.js";const h={id:"1",title:"Late Night DnB Production 🎧 | Feedback Session",streamer:"Neuro_Glitch",viewers:1240,thumbnailUrl:"https://picsum.photos/id/140/800/450",tags:["Production","Ableton","DnB"],isLive:!0,category:"Production"},P=[{user:"BassHead99",text:"That Reese bass is filthy! 🤮🔥",color:"text-muted-foreground"},{user:"Studio_Rat",text:"What VST is that?",color:"text-muted-foreground"},{user:"Neuro_Glitch",text:"It's Phase Plant, just initializing now.",color:"text-warning font-bold"},{user:"VocalChops",text:"Sent a $5 dono! Check my track?",color:"text-success"}];function N(s){const a=s.tags;return{id:String(s.id??""),title:String(s.title??""),streamer:String(s.streamer??s.streamerName??""),viewers:Number(s.viewers??s.viewerCount??0),thumbnailUrl:String(s.thumbnailUrl??""),tags:Array.isArray(a)?a:[],isLive:!!(s.isLive??s.is_live??!1),category:s.category??"Production"}}const b={async listStreams(s){const a=s!=null?{is_live:String(s)}:{},r=(await v.get("/live/streams",{params:a})).data?.streams??[];return Array.isArray(r)?r.map(N):[]},async getStream(s){const l=(await v.get(`/live/streams/${s}`)).data?.stream;return l?N(l):null}};function U(s={}){const{addToast:a}=E(),[l,r]=x.useState(s.stream??h),[o,t]=x.useState(!1),[u,i]=x.useState(null),g=s.chatMessages??P,[c,p]=x.useState("");x.useEffect(()=>{if(s.stream!==void 0&&s.stream!==null){r(s.stream),t(!1),i(null);return}if(s.stream===null){r(h);return}t(!0),i(null),(s.streamId?b.getStream(s.streamId):b.listStreams(!0).then(d=>d[0]??void 0)).then(d=>r(d??h)).catch(d=>{i(d instanceof Error?d:new Error(String(d))),r(h)}).finally(()=>t(!1))},[s.stream,s.streamId]);const y=x.useCallback(()=>{c.trim()&&(s.onSendMessage?s.onSendMessage(c):a("Message sent to chat","success"),p(""))},[c,s.onSendMessage,a]),S=l??h,k=s.isLoading??o,C=s.error??u;return{stream:S,chatMessages:g,msgInput:c,setMsgInput:p,handleSend:y,addToast:a,isLoading:k,error:C}}function _({stream:s,onToggleChat:a,onSettings:l,onFullscreen:r}){return e.jsxs("div",{className:"relative aspect-video bg-black rounded-xl overflow-hidden shadow-2xl border border-border group",children:[e.jsx("img",{src:s.thumbnailUrl,alt:"",className:"w-full h-full object-cover opacity-80"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-transparent to-transparent"}),e.jsxs("div",{className:"absolute top-4 left-4 flex gap-2",children:[e.jsxs("span",{className:"bg-destructive text-destructive-foreground px-2 py-1 text-xs font-bold rounded flex items-center gap-1 animate-pulse",children:[e.jsx(A,{className:"w-3 h-3"})," LIVE"]}),e.jsxs("span",{className:"bg-black/50 backdrop-blur text-foreground px-2 py-1 text-xs font-mono rounded flex items-center gap-1",children:[e.jsx(T,{className:"w-3 h-3"})," ",s.viewers]})]}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-4 flex justify-between items-end opacity-0 group-hover:opacity-100 transition-opacity duration-[var(--sumi-duration-normal)]",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsx(m,{variant:"ghost",size:"sm",className:"text-foreground hover:bg-white/10",onClick:a,children:e.jsx(I,{className:"w-5 h-5"})}),e.jsx(m,{variant:"ghost",size:"sm",className:"text-foreground hover:bg-white/10",onClick:l,children:e.jsx(R,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex gap-4",children:e.jsx(m,{variant:"ghost",size:"sm",className:"text-foreground hover:bg-white/10",onClick:r,children:e.jsx(V,{className:"w-5 h-5"})})})]})]})}function z({stream:s,onStreamerClick:a,onFollow:l,onDonate:r,onShare:o}){retu
|