- DESIGN_TOKENS.md: Complete rewrite to document --sumi-* token system - APP_SHELL.md: Update layout shell docs (glass bg, backdrop-blur, z-index) - DESIGN_DIRECTION.md: Update aesthetic direction to SUMI philosophy - .storybook/preview.tsx: Remove deleted CSS imports, update bg colors - eslint.config.js: Update color rule message from Kodo to SUMI tokens - tailwind.config.ts: Fix comment referencing deleted design-tokens.css Co-authored-by: Cursor <cursoragent@cursor.com>
2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-jE2AGx2y.js","assets/vendor-react-Dkpvlwai.js","assets/vendor-CAoAb3tF.js","assets/vendor-BD_zwJK7.css","assets/vendor-router-4bycex72.js","assets/vendor-tanstack-BoI3DtL9.js","assets/vendor-utils-CDFfoeXY.js","assets/vendor-icons-CbmLcMl-.js","assets/index-bEnrauoa.css"])))=>i.map(i=>d[i]);
|
|
import{j as e,a as C}from"./vendor-react-Dkpvlwai.js";import{u as L,L as N}from"./vendor-router-4bycex72.js";import{a as w,_ as p,u as k,E as T,C as d,b as u,c as q,d as x,e as m,f as g,B as F}from"./index-jE2AGx2y.js";import{u as A,a as Q}from"./vendor-tanstack-BoI3DtL9.js";import"./chatStore-Dpim9vVR.js";import{x as D,y as b}from"./vendor-CAoAb3tF.js";import{A as E}from"./AnimatedNumber-Dt_wg-GW.js";import{a8 as v,D as y,F as I,x as j,a9 as K,aa as P,K as R,S as G}from"./vendor-icons-CbmLcMl-.js";import"./vendor-utils-CDFfoeXY.js";const l={all:["library"],items:r=>[...l.all,"items",r],favorites:()=>[...l.all,"favorites"]};async function M(r={}){const{page:a=1,limit:t=20,type:o,search:n}=r,i=(await w.get("/tracks",{params:{page:a,limit:t,type:o,search:n}})).data,s=Array.isArray(i.items)?i.items:Array.isArray(i)?i:[];return{...i,items:s,page:i.page||a,limit:i.limit||t,total:i.total||0,has_next:i.has_next??!1,has_prev:i.has_prev??!1}}async function S(){const a=(await w.get("/tracks",{params:{page:1,limit:100,type:"favorites"}})).data;return Array.isArray(a.items)?a.items:Array.isArray(a)?a:[]}function _(r={}){return A({queryKey:l.items(r),queryFn:()=>M(r),staleTime:300*1e3,gcTime:600*1e3})}function H(){return A({queryKey:l.favorites(),queryFn:S,staleTime:300*1e3,gcTime:600*1e3})}function O(r={}){const{data:a}=_(r);return a?.items??[]}function U(){const r=_({}),a=H();return{isLoading:r.isLoading||a.isLoading,error:r.error||a.error}}function V(){const r=Q();return{fetchItems:async a=>{await r.refetchQueries({queryKey:l.items(a)})},fetchFavorites:async()=>{await r.refetchQueries({queryKey:l.favorites()})},uploadFile:async(a,t)=>{const{apiClient:o}=await p(async()=>{const{apiClient:c}=await import("./index-jE2AGx2y.js").then(i=>i.G);return{apiClient:c}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),n=new FormData;n.append("file",a),n.append("title",t.title),t.description&&n.append("description",t.description),await o.post("/tracks",n,{headers:{"Content-Type":"multipart/form-data"}}),await r.invalidateQueries({queryKey:l.all})},toggleFavorite:async a=>{const{apiClient:t}=await p(async()=>{const{apiClient:o}=await import("./index-jE2AGx2y.js").then(n=>n.G);return{apiClient:o}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));await t.post(`/tracks/${a}/favorite`),await r.invalidateQueries({queryKey:l.all})},deleteItem:async a=>{const{apiClient:t}=await p(async()=>{const{apiClient:o}=await import("./index-jE2AGx2y.js").then(n=>n.G);return{apiClient:o}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));await t.delete(`/tracks/${a}`),await r.invalidateQueries({queryKey:l.all})},clearItems:()=>{r.invalidateQueries({queryKey:l.all})}}}function $({isLoading:r,skeleton:a,children:t,className:o}){return e.jsx("div",{className:o,children:e.jsx(D,{mode:"wait",children:r?e.jsx(b.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:a},"skeleton"):e.jsx(b.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.05},children:t},"content")})})}function B({username:r}){const a=new Date().getHours(),t=a<12?"Good morning":a<18?"Good afternoon":"Good evening";return e.jsxs("div",{className:"relative overflow-hidden rounded-xl bg-gradient-to-r from-primary/20 via-primary/10 to-transparent p-6 mb-6",children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-primary/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("h1",{className:"text-heading-1",children:[t,","," ",e.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-primary to-secondary",children:r})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Here's what's happening with your music today."})]})]})}const z=[{icon:P,label:"Upload Track",path:"/library?action=upload",color:"bg-primary/10 text-primary"},{icon:R,label:"Create Playlist",path:"/library",color:"bg-success/10 text-success"},{icon:G,label:"Discover Music",path:"/search",color:"bg-warning/10 text-warning"},{icon:y,label:"Open Chat",path:"/chat",color:"bg-info/10 text-info"}];function W(){return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:z.map((r,a)=>e.jsxs(N,{to:r.path,className:"group flex items-center gap-3 p-4 rounded-xl border border-border hover:border-primary/30 hover:bg-muted/50 transition-all duration-[var(--sumi-duration-normal)] animate-stagger-in",style:{animationDelay:`${a*60}ms`},children:[e.jsx("div",{className:x("p-2.5 rounded-lg",r.color),children:e.jsx(r.icon,{className:"h-5 w-5"})}),e.jsx("span",{className:"text-sm font-medium group-hover:text-foreground transition-colors",children:r.label})]},r.label))})}function f({title:r,viewAllPath:a}){return e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-heading-3",children:r}),a&&e.jsx(N,{to:a,className:"text-caption hover:text-foreground transition-colors",children:"View all →"})]})}function ie(){const r=L(),{data:a}=k(),t=O(),{fetchItems:o}=V(),{isLoading:n,error:c}=U();C.useEffect(()=>{o({limit:5})},[o]);const i=[{title:"Tracks Listened",value:1234,change:"+12%",icon:v,color:"text-primary",shadow:"drop-shadow-stat-icon"},{title:"Messages Sent",value:567,change:"+8%",icon:y,color:"text-success",shadow:"drop-shadow-stat-icon"},{title:"Favorites",value:89,change:"+23%",icon:I,color:"text-destructive",shadow:"drop-shadow-stat-icon"},{title:"Active Friends",value:45,change:"+5%",icon:j,color:"text-destructive",shadow:"drop-shadow-stat-icon"}];return c?e.jsx("div",{className:"p-6",children:e.jsx(T,{error:c,onRetry:()=>o({limit:5})})}):e.jsxs("div",{className:"space-y-6 p-6 pb-24",children:[e.jsx(B,{username:a?.first_name||a?.username||"there"}),e.jsx(W,{}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:i.map(s=>e.jsxs(d,{variant:"glass",className:"group hover:border-primary/50 transition-all duration-[var(--sumi-duration-normal)]",children:[e.jsxs(u,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(q,{className:"text-sm font-medium text-muted-foreground group-hover:text-foreground transition-colors duration-[var(--duration-fast)]",children:s.title}),e.jsx(s.icon,{className:x("h-4 w-4 transition-all duration-[var(--sumi-duration-normal)]",s.color,s.shadow,"group-hover:scale-110")})]}),e.jsxs(m,{children:[e.jsx(E,{value:s.value,className:"text-2xl font-bold text-foreground tracking-tight"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[e.jsx("span",{className:"text-success font-medium",children:s.change})," from last month"]})]})]},s.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(u,{children:[e.jsx(f,{title:"Recent Activity",viewAllPath:"/library"}),e.jsx(g,{children:"Your latest interactions on the platform"})]}),e.jsx(m,{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-muted/50 transition-colors duration-[var(--duration-fast)] border border-transparent hover:border-border",children:[e.jsx("div",{className:"w-2 h-2 bg-primary rounded-full shadow-status-dot-cyan animate-pulse"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",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-muted/50 transition-colors duration-[var(--duration-fast)] border border-transparent hover:border-border",children:[e.jsx("div",{className:"w-2 h-2 bg-success rounded-full shadow-status-dot-lime"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",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-muted/50 transition-colors duration-[var(--duration-fast)] border border-transparent hover:border-border",children:[e.jsx("div",{className:"w-2 h-2 bg-destructive rounded-full shadow-status-dot-magenta"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",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(u,{children:[e.jsx(f,{title:"Recent Tracks",viewAllPath:"/library"}),e.jsx(g,{children:"Latest additions to your library"})]}),e.jsx(m,{children:e.jsx($,{isLoading:n,skeleton:e.jsx("div",{className:"space-y-4",children:[...Array(3)].map((s,h)=>e.jsxs("div",{className:"flex items-center space-x-4 animate-pulse",children:[e.jsx("div",{className:"w-10 h-10 bg-muted rounded"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-3 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-2 bg-muted rounded w-1/2"})]})]},h))}),children:e.jsxs("div",{className:"space-y-4",children:[t.slice(0,3).map(s=>e.jsxs("div",{className:"flex items-center space-x-4 p-2 rounded-lg hover:bg-white/5 transition-colors duration-[var(--duration-fast)] cursor-pointer group border border-transparent hover:border-white/5",children:[e.jsx("div",{className:"w-10 h-10 bg-muted/50 rounded flex items-center justify-center border border-border group-hover:border-primary/50 transition-colors shadow-lg",children:e.jsx(v,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate text-foreground group-hover:text-primary transition-colors",children:s.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate group-hover:text-foreground/80",children:s.description||"No description"})]})]},s.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(u,{children:[e.jsx(f,{title:"Quick Actions"}),e.jsx(g,{children:"Fast access to main features"})]}),e.jsx(m,{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-primary",border:"hover:border-primary/50",action:()=>r("/library?action=upload")},{label:"New Chat",icon:y,color:"hover:text-success",border:"hover:border-success/50",action:()=>r("/chat")},{label:"Library",icon:K,color:"hover:text-destructive",border:"hover:border-destructive/50",action:()=>r("/library")},{label:"Invite Friends",icon:j,color:"hover:text-foreground",border:"hover:border-primary/50",action:()=>r("/social")}].map((s,h)=>e.jsxs(F,{variant:"outline",onClick:s.action,className:x("h-24 flex-col gap-3 bg-muted/30 border-border hover:bg-muted/50 transition-all duration-[var(--sumi-duration-normal)] group",s.border),children:[e.jsx("div",{className:x("w-10 h-10 rounded-full bg-muted/50 flex items-center justify-center transition-all duration-[var(--sumi-duration-normal)] group-hover:scale-110",s.color),children:e.jsx(s.icon,{className:"h-5 w-5"})}),e.jsx("span",{className:"text-muted-foreground group-hover:text-foreground transition-colors duration-[var(--duration-fast)]",children:s.label})]},h))})})]})]})}export{ie as DashboardPage,ie as default};
|