veza/apps/web/dist_verification/assets/DashboardPage-BMNaRTjt.js
2026-02-07 20:36:48 +01:00

2 lines
9.2 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D2uzyr9g.js","assets/vendor-react-YMhRUmcb.js","assets/vendor-fFnFILYR.js","assets/vendor-BD_zwJK7.css","assets/vendor-router-DX94Iu-2.js","assets/vendor-tanstack-CoFNL2zy.js","assets/vendor-utils-4BWoYre8.js","assets/vendor-icons-DINCNwpk.js","assets/index-CDsSP0L3.css"])))=>i.map(i=>d[i]);
import{a as N,j as e}from"./vendor-react-YMhRUmcb.js";import{a as b,_ as u,u as _,C as d,b as m,c as h,d as p,e as x,f as g,B as A}from"./index-D2uzyr9g.js";import{u as w,a as C}from"./vendor-tanstack-CoFNL2zy.js";import"./chatStore-VE5eaeTh.js";import{u as L}from"./vendor-router-DX94Iu-2.js";import{a6 as v,z as y,E as k,w as f,a7 as q}from"./vendor-icons-DINCNwpk.js";import"./vendor-fFnFILYR.js";import"./vendor-utils-4BWoYre8.js";const n={all:["library"],items:a=>[...n.all,"items",a],favorites:()=>[...n.all,"favorites"]};async function F(a={}){const{page:s=1,limit:t=20,type:o,search:i}=a,r=(await b.get("/tracks",{params:{page:s,limit:t,type:o,search:i}})).data,c=Array.isArray(r.items)?r.items:Array.isArray(r)?r:[];return{...r,items:c,page:r.page||s,limit:r.limit||t,total:r.total||0,has_next:r.has_next??!1,has_prev:r.has_prev??!1}}async function Q(){const s=(await b.get("/tracks",{params:{page:1,limit:100,type:"favorites"}})).data;return Array.isArray(s.items)?s.items:Array.isArray(s)?s:[]}function j(a={}){return w({queryKey:n.items(a),queryFn:()=>F(a),staleTime:300*1e3,gcTime:600*1e3})}function T(){return w({queryKey:n.favorites(),queryFn:Q,staleTime:300*1e3,gcTime:600*1e3})}function I(a={}){const{data:s}=j(a);return s?.items??[]}function E(){const a=j({}),s=T();return{isLoading:a.isLoading||s.isLoading,error:a.error||s.error}}function K(){const a=C();return{fetchItems:async s=>{await a.refetchQueries({queryKey:n.items(s)})},fetchFavorites:async()=>{await a.refetchQueries({queryKey:n.favorites()})},uploadFile:async(s,t)=>{const{apiClient:o}=await u(async()=>{const{apiClient:l}=await import("./index-D2uzyr9g.js").then(r=>r.z);return{apiClient:l}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),i=new FormData;i.append("file",s),i.append("title",t.title),t.description&&i.append("description",t.description),await o.post("/tracks",i,{headers:{"Content-Type":"multipart/form-data"}}),await a.invalidateQueries({queryKey:n.all})},toggleFavorite:async s=>{const{apiClient:t}=await u(async()=>{const{apiClient:o}=await import("./index-D2uzyr9g.js").then(i=>i.z);return{apiClient:o}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));await t.post(`/tracks/${s}/favorite`),await a.invalidateQueries({queryKey:n.all})},deleteItem:async s=>{const{apiClient:t}=await u(async()=>{const{apiClient:o}=await import("./index-D2uzyr9g.js").then(i=>i.z);return{apiClient:o}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));await t.delete(`/tracks/${s}`),await a.invalidateQueries({queryKey:n.all})},clearItems:()=>{a.invalidateQueries({queryKey:n.all})}}}function $(){const a=L(),{data:s}=_(),t=I(),{fetchItems:o}=K(),{isLoading:i}=E();N.useEffect(()=>{o({limit:5})},[o]);const l=[{title:"Tracks Listened",value:"1,234",change:"+12%",icon:v,color:"text-cyan-500",shadow:"drop-shadow-[0_0_8px_rgba(var(--cyan-500),0.5)]"},{title:"Messages Sent",value:"567",change:"+8%",icon:y,color:"text-lime-500",shadow:"drop-shadow-[0_0_8px_rgba(var(--lime-500),0.5)]"},{title:"Favorites",value:"89",change:"+23%",icon:k,color:"text-destructive",shadow:"drop-shadow-[0_0_8px_rgba(var(--destructive),0.5)]"},{title:"Active Friends",value:"45",change:"+5%",icon:f,color:"text-magenta-500",shadow:"drop-shadow-[0_0_8px_rgba(var(--magenta-500),0.5)]"}];return e.jsxs("div",{className:"space-y-6 p-6 pb-24",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-display font-bold tracking-tight text-white mb-2",children:["Welcome back, ",e.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-cyan-500 to-magenta-500",children:s?.first_name||s?.username})]}),e.jsx("p",{className:"text-muted-foreground",children:"Your command center overview."})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:l.map(r=>e.jsxs(d,{variant:"glass",className:"group hover:border-primary/50 transition-all duration-300",children:[e.jsxs(m,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(h,{className:"text-sm font-medium text-muted-foreground group-hover:text-white transition-colors",children:r.title}),e.jsx(r.icon,{className:p("h-4 w-4 transition-all duration-300",r.color,r.shadow,"group-hover:scale-110")})]}),e.jsxs(x,{children:[e.jsx("div",{className:"text-2xl font-bold text-white tracking-tight",children:r.value}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[e.jsx("span",{className:"text-lime-500 font-medium",children:r.change})," from last month"]})]})]},r.title))}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(d,{className:"md:col-span-2",variant:"glass",children:[e.jsxs(m,{children:[e.jsx(h,{children:"Recent Activity"}),e.jsx(g,{children:"Your latest interactions on the platform"})]}),e.jsx(x,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-4 p-3 rounded-lg hover:bg-white/5 transition-colors border border-transparent hover:border-white/5",children:[e.jsx("div",{className:"w-2 h-2 bg-cyan-500 rounded-full shadow-[0_0_8px_rgba(var(--cyan-500),0.8)] animate-pulse"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"New track added"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"2 hours ago"})]})]}),e.jsxs("div",{className:"flex items-center space-x-4 p-3 rounded-lg hover:bg-white/5 transition-colors border border-transparent hover:border-white/5",children:[e.jsx("div",{className:"w-2 h-2 bg-lime-500 rounded-full shadow-[0_0_8px_rgba(var(--lime-500),0.8)]"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"Message from @alice"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"4 hours ago"})]})]}),e.jsxs("div",{className:"flex items-center space-x-4 p-3 rounded-lg hover:bg-white/5 transition-colors border border-transparent hover:border-white/5",children:[e.jsx("div",{className:"w-2 h-2 bg-magenta-500 rounded-full shadow-[0_0_8px_rgba(var(--magenta-500),0.8)]"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-white",children:"New favorite added"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"6 hours ago"})]})]})]})})]}),e.jsxs(d,{variant:"glass",children:[e.jsxs(m,{children:[e.jsx(h,{children:"Recent Tracks"}),e.jsx(g,{children:"Latest additions to your library"})]}),e.jsx(x,{children:i?e.jsx("div",{className:"space-y-4",children:[...Array(3)].map((r,c)=>e.jsxs("div",{className:"flex items-center space-x-4 animate-pulse",children:[e.jsx("div",{className:"w-10 h-10 bg-white/10 rounded"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-3 bg-white/10 rounded w-3/4"}),e.jsx("div",{className:"h-2 bg-white/10 rounded w-1/2"})]})]},c))}):e.jsxs("div",{className:"space-y-4",children:[t.slice(0,3).map(r=>e.jsxs("div",{className:"flex items-center space-x-4 p-2 rounded-lg hover:bg-white/5 transition-colors cursor-pointer group border border-transparent hover:border-white/5",children:[e.jsx("div",{className:"w-10 h-10 bg-black/40 rounded flex items-center justify-center border border-white/10 group-hover:border-cyan-500/50 transition-colors shadow-lg",children:e.jsx(v,{className:"h-4 w-4 text-muted-foreground group-hover:text-cyan-500 transition-colors"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate text-white group-hover:text-primary transition-colors",children:r.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate group-hover:text-white/70",children:r.description||"No description"})]})]},r.id)),t.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No tracks in your library"})]})})]})]}),e.jsxs(d,{variant:"glass",className:"overflow-hidden",children:[e.jsxs(m,{children:[e.jsx(h,{children:"Quick Actions"}),e.jsx(g,{children:"Fast access to main features"})]}),e.jsx(x,{children:e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[{label:"New Track",icon:v,color:"hover:text-cyan-500",border:"hover:border-cyan-500/50",action:()=>a("/library?action=upload")},{label:"New Chat",icon:y,color:"hover:text-lime-500",border:"hover:border-lime-500/50",action:()=>a("/chat")},{label:"Library",icon:q,color:"hover:text-magenta-500",border:"hover:border-magenta-500/50",action:()=>a("/library")},{label:"Invite Friends",icon:f,color:"hover:text-white",border:"hover:border-white/50",action:()=>a("/social")}].map((r,c)=>e.jsxs(A,{variant:"outline",onClick:r.action,className:p("h-24 flex-col gap-3 bg-black/20 border-white/10 hover:bg-white/5 transition-all duration-300 group",r.border),children:[e.jsx("div",{className:p("w-10 h-10 rounded-full bg-white/5 flex items-center justify-center transition-all duration-300 group-hover:scale-110",r.color),children:e.jsx(r.icon,{className:"h-5 w-5"})}),e.jsx("span",{className:"text-muted-foreground group-hover:text-white transition-colors",children:r.label})]},c))})})]})]})}export{$ as DashboardPage,$ as default};