veza/apps/web/dist_verification/assets/WishlistView-DGHnFMPQ.js
senke 04c25aa24f Phase 2 stabilisation: code mort, Modal→Dialog, feature flags, tests, router split, Rust legacy
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/)
2026-02-14 17:23:32 +01:00

1 line
5.1 KiB
JavaScript

import{a as y,j as e}from"./vendor-react-yWUy5XPk.js";import{u as C,h as S,E as l,S as a,B as n,C as k}from"./index-CYK_b1Uz.js";import{u as E}from"./cartStore-D5whk71m.js";import{u as A,a as T,b as q}from"./vendor-tanstack-kPY9uK0s.js";import{m as f}from"./marketplaceService-DWfxNVms.js";import{o as d,p as z,q as I,r as H,Z as L,i as P}from"./vendor-icons-DJFb1Tiw.js";import{m as g}from"./vendor-motion-B3XPS3Jc.js";import"./vendor-CveO81sn.js";import"./vendor-security-DsrNJhpn.js";import"./vendor-router-BNNHboN9.js";import"./vendor-http-Cz8wfb0q.js";import"./vendor-utils-DtoSyhX2.js";import"./vendor-i18n-CMcqpBLz.js";const Q={visible:{transition:{staggerChildren:.06,delayChildren:.04}}},R={hidden:{opacity:0,y:16,scale:.97},visible:{opacity:1,y:0,scale:1,transition:{duration:.35,ease:[.33,1,.68,1]}}},c=["wishlist"],G=()=>{const m=E(s=>s.addItem),{addToast:t}=C(),x=A(),r=S(s=>s.isAuthenticated),[h,v]=y.useState(null),{data:i=[],isLoading:p,isError:j,error:u}=T({queryKey:c,queryFn:()=>f.getWishlist(),enabled:r}),w=q({mutationFn:s=>f.removeFromWishlist(s),onSuccess:()=>{x.invalidateQueries({queryKey:c}),t("Removed from wishlist","info")},onError:s=>{t(s.message||"Failed to remove from wishlist","error")}}),o=s=>{r&&w.mutate(s)},b=s=>{m(s),o(s.id)},N=()=>{i.forEach(s=>m(s)),i.forEach(s=>o(s.id)),t("All items moved to cart","success")};return r?j?e.jsx(l,{variant:"centered",icon:e.jsx(d,{className:"w-full h-full"}),title:"Could not load wishlist",description:u instanceof Error?u.message:"Something went wrong.",action:{label:"Try again",onClick:()=>x.invalidateQueries({queryKey:c})},size:"lg",className:"min-h-96"}):p?e.jsxs("div",{className:"max-w-6xl mx-auto 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 mb-8",children:[e.jsxs("div",{children:[e.jsx(a,{className:"h-9 w-48 mb-2"}),e.jsx(a,{variant:"text",className:"w-32"})]}),e.jsx(a,{className:"h-10 w-44"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[1,2,3].map(s=>e.jsx(a,{className:"h-96 w-full rounded-lg"},s))})]}):i.length===0?e.jsx(l,{variant:"centered",icon:e.jsx(d,{className:"w-full h-full"}),title:"Your wishlist is empty",description:"Explore the marketplace and save items you love.",action:{label:"Browse Marketplace",onClick:()=>window.location.href="/marketplace"},size:"lg",className:"min-h-96"}):e.jsxs("div",{className:"animate-fadeIn max-w-6xl mx-auto 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 mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-heading font-bold text-foreground mb-2 tracking-tight",children:"WISHLIST"}),e.jsxs("p",{className:"text-muted-foreground font-mono text-sm",children:[i.length," saved items"]})]}),e.jsx(n,{variant:"primary",icon:e.jsx(z,{className:"w-4 h-4"}),onClick:N,children:"ADD ALL TO CART"})]}),e.jsx(g.div,{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",variants:Q,initial:"hidden",animate:"visible",children:i.map(s=>e.jsx(g.div,{variants:R,children:e.jsxs(k,{variant:"default",className:"p-4 group hover:border-border/50 hover:shadow-lg transition-all duration-[var(--sumi-duration-normal)]",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"relative w-24 h-24 bg-muted rounded-lg overflow-hidden flex-shrink-0",children:[e.jsx("img",{src:s.coverUrl,className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-[var(--sumi-duration-slow)]"}),e.jsx("div",{className:"absolute inset-0 bg-black/40 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",onClick:()=>v(h===s.id?null:s.id),children:h===s.id?e.jsx(I,{className:"w-8 h-8 text-foreground"}):e.jsx(H,{className:"w-8 h-8 text-foreground fill-current"})}),s.isHot&&e.jsxs("div",{className:"absolute top-1 left-1 bg-warning text-warning-foreground text-xs font-bold px-1.5 py-0.5 rounded",children:[e.jsx(L,{className:"w-2 h-2 inline"})," HOT"]})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-foreground truncate",children:s.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.author}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 capitalize",children:s.type})]}),e.jsxs("div",{className:"text-lg font-mono font-bold text-muted-foreground",children:["$",s.price]})]})]}),e.jsxs("div",{className:"flex gap-2 mt-4 pt-4 border-t border-border/30",children:[e.jsx(n,{variant:"secondary",size:"sm",className:"flex-1",onClick:()=>b(s),children:"Add to Cart"}),e.jsx(n,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive",onClick:()=>o(s.id),children:e.jsx(P,{className:"w-4 h-4"})})]})]})},s.id))})]}):e.jsx(l,{variant:"centered",icon:e.jsx(d,{className:"w-full h-full"}),title:"Sign in to view your wishlist",description:"Create an account or log in to save items you love.",action:{label:"Sign in",onClick:()=>window.location.href="/login"},size:"lg",className:"min-h-96"})};export{G as WishlistView};