PageSourceSearch

https://mostreams-com.lovable.app/assets/discover-CWafbVUb.js

js mostreams-com.lovable.app collected 2026-10-03 03:35:36 UTC 8,949 bytes, 1 lines download raw bytes

1import{bz as A,r as n,ab as O,s as v,j as r,bA as P,n as F,bU as L,bR as w,U as B,L as T,ae as D,aY as G,t as I,V as H}from"./index-BNrdOJig.js";import{L as Q}from"./LibraryHome-Dsl1q_4d.js";import{L as Y}from"./LockedDropsRail-Dr4X48Vm.js";import{w as Z,S as J,V as K}from"./SponsoredVideoTile-B5cYZeQs.js";import"./discCover-CfcRtT-1.js";import"./official-channel-ScPM5slQ.js";import"./FollowerCount-DqYNFd1w.js";import"./ticket-DY92lRWa.js";import"./calendar-DPBDZjL-.js";import"./map-pin-BRjVggch.js";import"./GlobalSearch-Hj7UfeDD.js";import"./drum-nhBEtyuZ.js";import"./arrow-right-CRCU77cw.js";import"./DiscBookletModal-BYZr6VB8.js";import"./mostreams-disc-default-cover.png.asset-CgIoJHym.js";import"./modisc.functions-YskwSfYf.js";import"./useMe-Cr7XOTxZ.js";import"./discLibrary.functions-XplYfHC1.js";import"./shopping-cart-CvE4J-jm.js";import"./log-in-BjATJu04.js";import"./credit-card-DuGDEZtl.js";import"./scan-line-Y6QVMevr.js";import"./useSmartInterval-Caibau3y.js";import"./newspaper-BvYbnxei.js";import"./gift-zW-OXeDx.js";import"./mic-vocal-1o-CIBe1.js";import"./music-4-XSQW5tQl.js";import"./book-open-cq8RVrvi.js";import"./nft.drops.functions-eAhzeF2u.js";import"./gem-DST2RriO.js";import"./VerifiedBadge-D-qjQohi.js";import"./video-engagement-CTOe3S-S.js";import"./mostreams-logo.png.asset-BLv69mKP.js";import"./tooltip-38gOocur.js";import"./index-xFoOlCOp.js";import"./index-CknWoRzV.js";import"./trash-2-DqSHrMYS.js";import"./thumbs-up-C6P5ySa9.js";import"./thumbs-down-Ci16tFLJ.js";import"./message-circle-CDHT5vRz.js";import"./ellipsis-vertical-yOi2Ft7_.js";import"./adServing-BRr30AWw.js";import"./adAssets-C675SCmn.js";const W=["all","artist","label","producer","fan","podcaster","dj"],X=[{value:"newest",label:"Newest"},{value:"country_az",label:"Country A → Z"},{value:"domestic",label:"Domestic first"}];function Be(){const d=A(),t=(d?.country_code||"").toUpperCase(),[a,h]=n.useState(""),[c,l]=n.useState("all"),[o,u]=n.useState(""),[i,p]=n.useState(""),[m,N]=n.useState("newest"),[k,M]=n.useState([]),[b,R]=n.useState([]),[f,z]=n.useState([]),E=n.useMemo(()=>O(),[]);n.useEffect(()=>{const e=setTimeout(async()=>{let s=v.from("profiles").select("id, handle, display_name, role, genre, country, country_code, avatar_url").limit(60);a&&(s=s.or(`display_name.ilike.%${a}%,handle.ilike.%${a}%,bio.ilike.%${a}%`)),c!=="all"&&(s=s.eq("role",c)),o&&(s=s.ilike("genre",`%${o}%`)),i&&(s=s.eq("country_code",i));let x=v.from("tracks").select("id, title, cover_url, genre, owner_id, owner:profiles!tracks_owner_id_fkey(country_code, country, display_name)").eq("status","published").eq("removed",!1).order("created_at",{ascending:!1}).limit(48);a&&(x=x.ilike("title",`%${a}%`)),o&&(x=x.ilike("genre",`%${o}%`));let g=v.from("videos").select("id, title, thumbnail_url, genre, owner_id, play_count, created_at, owner:profiles!videos_owner_id_fkey(country_code, country, display_name, handle, avatar_url, role)").eq("status","published").eq("removed",!1).order("created_at",{ascending:!1}).limit(48);a&&(g=g.ilike("title",`%${a}%`)),o&&(g=g.ilike("genre",`%${o}%`));const[V,$,U]=await Promise.all([s,x,g]);V.data&&M(V.data),$.data&&R($.data),U.data&&z(U.data)},250);return()=>clearTimeout(e)},[a,c,o,i]);const S=n.useMemo(()=>j(k,m,t,e=>e.country_code),[k,m,t]),C=n.useMemo(()=>{const e=i?b.filter(s=>(s.owner?.country_code??"").toUpperCase()===i):b;return j(e,m,t,s=>s.owner?.country_code??null).slice(0,24)},[b,i,m,t]),q=n.useMemo(()=>{const e=i?f.filter(s=>(s.owner?.country_code??"").toUpperCase()===i):f;return j(e,m,t,s=>s.owner?.country_code??null).slice(0,24)},[f,i,m,t]);return r.jsxs(P,{profile:d,title:"Discover",subtitle:"Search the network for people, tracks and videos.",defaultCollapsed:!0,children:[r.jsx("div",{className:"mb-8",children:r.jsx(Q,{variant:"dashboard"})}),r.jsx(Y,{}),r.jsxs("div",{className:"rounded-3xl border border-border bg-card p-6 mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-background border border-border px-4 py-3",children:[r.jsx(F,{className:"w-4 h-4 text-muted-foreground"}),r.jsx("input",{value:a,onChange:e=>h(e.target.value),placeholder:"Search names, handles, tracks, videos…",className:"flex-1 bg-transparent focus:outline-none text-sm"})]}),r.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-3 mt-4",children:[r.jsx("select",{value:c,onChange:e=>l(e.target.value),className:"rounded-xl bg-background border border-border px-4 py-2 text-sm",children:W.map(e=>r.jsx("option",{value:e,children:e==="all"?"All roles":e},e))}),r.jsx("input",{value:o,onChange:e=>u(e.target.value),placeholder:"Genre (e.g. afrobeats)",className:"rounded-xl bg-background border border-border px-4 py-2 text-sm"}),r.jsxs("select",{value:i,onChange:e=>p(e.target.value),className:"rounded-xl bg-background border border-border px-4 py-2 text-sm","aria-label":"Filter by country",children:[r.jsx("option",{value:"",children:"🌐 All countries"}),t&&r.jsxs("option",{value:t,children:[L(t)," ",w(t)?.name??t," (mine)"]}),E.map(e=>r.jsxs("option",{value:e.code,children:[L(e.code)," ",e.name]},e.code))]}),r.jsx("select",{value:m,onChange:e=>N(e.target.value),className:"rounded-xl bg-background border border-border px-4 py-2 text-sm","aria-label":"Sort results",children:X.map(e=>r.jsxs("option",{value:e.value,disabled:e.value==="domestic"&&!t,children:["Sort: ",e.label,e.value==="domestic"&&!t?" (set your country)":""]},e.value))})]}),(i||m!=="newest")&&r.jsx("button",{type:"button",onClick:()=>{p(""),N("newest")},className:"mt-3 text-xs text-primary hover:underline",children:"Clear country & sort"})]}),r.jsx(_,{title:"People",icon:B,children:S.length===0?r.jsx(y,{}):r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-3",children:S.map(e=>r.jsx(T,{to:"/network/u/$handle",params:{handle:e.handle},className:"rounded-2xl border border-border bg-card p-4 hover:border-primary/50",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-primary to-rose-500 flex items-center justify-center font-bold",children:e.display_name[0]?.toUpperCase()}),r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"font-semibold truncate flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate",children:e.display_name}),r.jsx(D,{code:e.country_code,name:e.country,size:"sm"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["@",e.handle," · ",e.role]}),(e.genre||e.country)&&r.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:[e.genre,e.country].filter(
1Boolean).join(" · ")})]})]})},e.id))})}),r.jsx(_,{title:"Tracks",icon:G,children:C.length===0?r.jsx(y,{}):r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-4",children:C.map(e=>r.jsxs(T,{to:"/tracks/$id",params:{id:e.id},className:"group",children:[r.jsx("div",{className:"aspect-square rounded-2xl bg-gradient-to-br from-orange-500/40 to-rose-500/40 overflow-hidden border border-border",children:e.cover_url&&r.jsx("img",{src:I(e.cover_url,960),alt:e.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform",loading:"lazy",decoding:"async"})}),r.jsxs("div",{className:"mt-2 text-sm font-semibold truncate flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate",children:e.title}),r.jsx(D,{code:e.owner?.country_code,name:e.owner?.country,size:"sm"})]}),e.genre&&r.jsx("div",{className:"text-xs text-muted-foreground",children:e.genre})]},e.id))})}),r.jsx(_,{title:"Videos",icon:H,children:q.length===0?r.jsx(y,{}):r.jsx("div",{className:"grid gap-x-4 gap-y-8 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:Z(q,7).map(e=>e.kind==="ad"?r.jsx(J,{slot:"discover"},e.key):r.jsx(K,{v:{id:e.item.id,title:e.item.title,thumbnail_url:e.item.thumbnail_url,play_count:e.item.play_count??0,created_at:e.item.created_at??new Date().toISOString(),channel_name:e.item.owner?.display_name??"MO Streams",channel_handle:e.item.owner?.handle??"",channel_verified:e.item.owner?.role==="super_admin"||e.item.owner?.role==="artist"||e.item.owner?.role==="label",channel_avatar:e.item.owner?.avatar_url??null}},e.item.id))})})]})}function j(d,t,a,h){if(t==="newest"||d.length<=1)return d;const c=d.map((l,o)=>({row:l,idx:o,code:(h(l)??"").toUpperCase()}));return t==="domestic"&&a?c.sort((l,o)=>{const u=l.code===a?0:1,i=o.code===a?0:1;return u!==i?u-i:l.idx-o.idx}):c.sort((l,o)=>{const u=w(l.code)?.name??(l.code||"￿"),i=w(o.code)?.name??(o.code||"￿"),p=u.localeCompare(i);return p!==0?p:l.idx-o.idx}),c.map(l=>l.row)}function _({title:d,icon:t,children:a}){return r.jsxs("section",{className:"mt-6",children:[r.jsxs("h3",{className:"font-display text-2xl flex items-center gap-2 mb-4",children:[r.jsx(t,{className:"w-5 h-5 text-primary"})," ",d]}),a]})}function y(){return r.jsx("p",{className:"text-sm text-muted-foreground",children:"No matches."})}export{Be as component};

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.