Bloc A - Code mort: - Suppression Studio (components, views, features) - Suppression gamification + services mock (projectService, storageService, gamificationService) - Mise à jour Sidebar, Navbar, locales Bloc B - Frontend: - Suppression modal.tsx deprecated, Modal.stories (doublon Dialog) - Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true - Suppression 19 tests orphelins, retrait exclusions vitest.config Bloc C - Backend: - Extraction routes_auth.go depuis router.go Bloc D - Rust: - Suppression security_legacy.rs (code mort, patterns déjà dans security/)
1 line
8 KiB
JavaScript
1 line
8 KiB
JavaScript
import{a as c,j as e}from"./vendor-react-yWUy5XPk.js";import{u as N,B as g,j as I,C as $,E as A}from"./index-CYK_b1Uz.js";import{I as _}from"./input-CGdBHtsQ.js";import{X as w,G as M,t as O,u as U,i as q,q as z,r as y,v as F,w as G}from"./vendor-icons-DJFb1Tiw.js";import{o as L,p as V}from"./playlistService-Ibr1CVA5.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-motion-B3XPS3Jc.js";import"./vendor-i18n-CMcqpBLz.js";import"./features-DItyhINc.js";const B=({onClose:a,onSave:l})=>{const{addToast:m}=N(),[u,f]=c.useState(""),[o,x]=c.useState(!1),[h,i]=c.useState(!1),b=async()=>{if(!u){m("Please name your playlist","error");return}i(!0);try{await l(u,o),a()}catch(n){m(n instanceof Error?n.message:"Failed to save playlist","error")}finally{i(!1)}};return e.jsxs("div",{className:"fixed inset-0 z-[var(--sumi-z-modal)] flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-background/90 backdrop-blur-sm",onClick:a}),e.jsxs("div",{className:"relative w-full max-w-md bg-card border border-border rounded-xl shadow-2xl animate-scaleIn",children:[e.jsxs("div",{className:"p-4 border-b border-border bg-card flex justify-between items-center",children:[e.jsx("h3",{className:"font-bold text-foreground",children:"Save Queue as Playlist"}),e.jsx("button",{onClick:a,children:e.jsx(w,{className:"w-5 h-5 text-muted-foreground hover:text-foreground"})})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx(_,{label:"Playlist Name",value:u,onChange:n=>f(n.target.value),autoFocus:!0,placeholder:"My Queue Session"}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-card rounded border border-border cursor-pointer hover:border-border",onClick:()=>x(!o),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[o?e.jsx(M,{className:"w-5 h-5 text-muted-foreground"}):e.jsx(O,{className:"w-5 h-5 text-warning"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-bold text-foreground",children:o?"Public Playlist":"Private Playlist"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:o?"Visible on your profile":"Only visible to you"})]})]}),e.jsx("div",{className:`w-10 h-5 rounded-full relative transition-colors ${o?"bg-primary":"bg-muted"}`,children:e.jsx("div",{className:`absolute top-1 w-3 h-3 bg-white rounded-full transition-all ${o?"left-6":"left-1"}`})})]})]}),e.jsxs("div",{className:"p-4 border-t border-border bg-card flex justify-end gap-4",children:[e.jsx(g,{variant:"ghost",onClick:a,children:"Cancel"}),e.jsx(g,{variant:"primary",onClick:b,disabled:h,loading:h,children:"Save Playlist"})]})]})]})},oe=()=>{const{queue:a,currentTrack:l,reorderQueue:m,removeFromQueue:u,clearQueue:f,playTrack:o,isPlaying:x,togglePlay:h,autoplay:i,toggleAutoplay:b}=I(),{addToast:n}=N(),[k,v]=c.useState(!1),[d,p]=c.useState(null),[S,j]=c.useState(null),P=(s,r)=>{p(r),s.dataTransfer.effectAllowed="move";const t=document.createElement("div");t.style.opacity="0",document.body.appendChild(t),s.dataTransfer.setDragImage(t,0,0),setTimeout(()=>document.body.removeChild(t),0)},C=(s,r)=>{s.preventDefault(),j(r),!(d===null||d===r)&&(m(d,r),p(r))},Q=()=>{p(null),j(null)},E=async(s,r)=>{const t=[...l?[l]:[],...a];if(t.length===0)throw n("Queue is empty","error"),new Error("Queue is empty");const T=await L({title:s,description:"",is_public:r});for(const D of t)await V(T.id,String(D.id));n(`Queue saved as "${s}"`,"success")};return e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6 animate-fadeIn pb-20",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-end border-b border-border/50 pb-6 gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-heading font-bold text-foreground mb-2",children:"PLAY QUEUE"}),e.jsxs("p",{className:"text-muted-foreground font-mono text-sm",children:[a.length," tracks upcoming"]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(g,{variant:"ghost",onClick:()=>v(!0),icon:e.jsx(U,{className:"w-4 h-4"}),children:"Save Queue"}),e.jsx(g,{variant:"ghost",className:"text-destructive hover:bg-destructive/10",onClick:f,icon:e.jsx(q,{className:"w-4 h-4"}),children:"Clear"})]})]}),l&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3",children:"Now Playing"}),e.jsxs($,{variant:"glass",className:"flex items-center gap-4 p-4 border-l-4 border-l-primary",children:[e.jsxs("div",{className:"relative w-16 h-16 rounded overflow-hidden flex-shrink-0 group cursor-pointer",onClick:h,children:[e.jsx("img",{src:l.coverUrl,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-background/40 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:x?e.jsx(z,{className:"w-6 h-6 text-foreground"}):e.jsx(y,{className:"w-6 h-6 text-foreground fill-current ml-1"})}),x&&e.jsxs("div",{className:"absolute bottom-1 right-1 flex gap-0.5 items-end h-3",children:[e.jsx("div",{className:"w-1 bg-primary animate-[bounce_1s_infinite] h-full"}),e.jsx("div",{className:"w-1 bg-primary animate-[bounce_1.2s_infinite] h-2/3"}),e.jsx("div",{className:"w-1 bg-primary animate-[bounce_0.8s_infinite] h-full"})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:l.title}),e.jsx("p",{className:"text-muted-foreground",children:l.artist})]}),e.jsx("div",{className:"text-muted-foreground font-mono text-sm hidden md:block",children:l.duration})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-3",children:[e.jsx("h3",{className:"text-xs font-bold text-muted-foreground uppercase tracking-widest",children:"Up Next"}),e.jsxs("div",{className:"flex items-center gap-2 cursor-pointer group",onClick:b,children:[e.jsx("span",{className:`text-xs font-bold ${i?"text-success":"text-muted-foreground"}`,children:"Autoplay"}),e.jsx("div",{className:`w-8 h-4 rounded-full relative transition-colors ${i?"bg-success":"bg-muted"}`,children:e.jsx("div",{className:`absolute top-0.5 w-3 h-3 bg-background rounded-full transition-all ${i?"left-4.5":"left-0.5"}`})})]})]}),e.jsx("div",{className:"space-y-2",children:a.length===0?e.jsx(A,{variant:"card",icon:e.jsx(F,{className:"w-full h-full"}),title:"Nothing in your queue",description:i?"Autoplay is on — we’ll pick something for you.":"Start playing music and add tracks to build your queue.",size:"md"}):a.map((s,r)=>e.jsxs("div",{draggable:!0,onDragStart:t=>P(t,r),onDragOver:t=>C(t,r),onDragEnd:Q,className:`flex items-center gap-4 p-4 bg-card rounded-lg border border-transparent hover:border-border transition-all group ${d===r?"opacity-50 border-primary shadow-lg scale-[1.02] cursor-grabbing":""} ${S===r&&d!==null&&d!==r?"border-t-2 border-t-primary bg-primary/5":""}`,children:[e.jsx("div",{className:"text-muted-foreground cursor-grab active:cursor-grabbing hover:text-foreground p-1",children:e.jsx(G,{className:"w-5 h-5"})}),e.jsxs("div",{className:"w-10 h-10 rounded overflow-hidden flex-shrink-0 relative",children:[e.jsx("img",{src:s.coverUrl,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-background/50 hidden group-hover:flex items-center justify-center cursor-pointer",onClick:()=>o(s),children:e.jsx(y,{className:"w-4 h-4 text-foreground fill-current"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-bold text-foreground truncate",children:s.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:s.artist})]}),e.jsx("div",{className:"text-muted-foreground font-mono text-xs hidden sm:block",children:s.duration}),e.jsx("button",{className:"p-2 text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>u(s.id),children:e.jsx(w,{className:"w-4 h-4"})})]},`${s.id}-${r}`))})]}),k&&e.jsx(B,{onClose:()=>v(!1),onSave:E})]})};export{oe as QueueView};
|