veza/apps/web/dist_verification/assets/GearView-ZVOHN4tS.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
21 KiB
JavaScript

import{j as e,a as f}from"./vendor-react-yWUy5XPk.js";import{c as o,S as d,B as j,C as b,k as G,g as N,u as W}from"./index-CYK_b1Uz.js";import{aa as R,P as S,Q as z,h as B,X as H,az as $,aA as _,b as K,aB as X,F as Q,W as q,a5 as L,aC as J,aD as Y,aE as Z}from"./vendor-icons-DJFb1Tiw.js";import{S as ee}from"./input-CGdBHtsQ.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";const re="GEAR LOCKER",se="Manage hardware assets, documentation, and warranties.";function D({title:r=re,subtitle:s=se,onExport:n,onRegister:a,isLoading:l=!1,error:x=null,className:i}){return x?e.jsx("div",{className:o("max-w-layout-content mx-auto p-4",i),children:e.jsx("p",{className:"text-destructive font-medium",children:x})}):l?e.jsxs("div",{className:o("flex flex-col md:flex-row justify-between items-start md:items-center gap-4",i),children:[e.jsxs("div",{children:[e.jsx(d,{variant:"text",className:"h-9 w-48 mb-2"}),e.jsx(d,{variant:"text",className:"h-4 w-80"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(d,{variant:"rectangular",className:"h-10 w-28 rounded-xl"}),e.jsx(d,{variant:"rectangular",className:"h-10 w-36 rounded-xl"})]})]}):e.jsxs("div",{className:o("flex flex-col md:flex-row justify-between items-start md:items-center gap-4",i),children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-heading font-bold text-foreground mb-2",children:r}),e.jsx("p",{className:"text-muted-foreground font-mono text-sm",children:s})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(j,{variant:"ghost",icon:e.jsx(R,{className:"w-4 h-4"}),onClick:n,children:"EXPORT CSV"}),e.jsx(j,{variant:"glass",icon:e.jsx(S,{className:"w-4 h-4"}),onClick:a,children:"REGISTER GEAR"})]})]})}const te=["All","Synth","Interface","Microphone","Active","Maintenance","Sold"];function F({search:r,onSearchChange:s,filter:n,onFilterChange:a,searchPlaceholder:l="Search brand, model, serial...",isLoading:x=!1,error:i=null,className:m}){return i?e.jsx("div",{className:o("p-4 rounded-xl border border-border bg-muted/30",m),children:e.jsx("p",{className:"text-sm text-muted-foreground",children:i})}):x?e.jsxs("div",{className:o("flex flex-col md:flex-row gap-4 items-center bg-muted/30 p-4 rounded-xl border border-border",m),children:[e.jsx(d,{variant:"rectangular",className:"h-11 w-full md:w-64 rounded-xl"}),e.jsx("div",{className:"flex gap-2 w-full md:w-auto",children:[1,2,3,4].map(t=>e.jsx(d,{variant:"rectangular",className:"h-9 w-20 rounded-lg"},t))})]}):e.jsxs("div",{className:o("flex flex-col md:flex-row gap-4 items-center bg-muted/30 p-4 rounded-xl border border-border",m),children:[e.jsx("div",{className:"w-full md:w-64",children:e.jsx(ee,{placeholder:l,value:r,onChange:t=>s(t.target.value)})}),e.jsx("div",{className:"flex gap-2 overflow-x-auto w-full md:w-auto pb-2 md:pb-0",children:te.map(t=>e.jsx("button",{type:"button",onClick:()=>a(t),className:o("px-4 py-1.5 rounded-lg text-xs font-bold uppercase tracking-wider transition-colors border shrink-0",n===t?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-transparent hover:border-border"),children:t},t))})]})}function O(r){if(!r)return{label:"Unknown",color:"text-muted-foreground",bg:"bg-muted"};const s=new Date(r),n=new Date,a=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24));return a<0?{label:"Expired",color:"text-destructive",bg:"bg-destructive/10"}:a<90?{label:`Expiring (${a}d)`,color:"text-warning",bg:"bg-warning/10"}:{label:"Active",color:"text-success",bg:"bg-success/10"}}function I({item:r,onClick:s,className:n}){const a=O(r.warrantyExpire),l=r.status==="Active"?"bg-green-600/10 text-green-600":"bg-amber-500/10 text-amber-500";return e.jsxs(b,{variant:"glass",className:o("group cursor-pointer hover:border-border transition-colors",n),onClick:s,children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx(G,{label:r.category,variant:"terminal"}),e.jsx("div",{className:o("px-2 py-0.5 rounded text-xs font-bold uppercase",l),children:r.status})]}),e.jsxs("div",{className:"flex gap-4 mb-4",children:[e.jsx("div",{className:"w-24 h-24 bg-muted rounded-lg border border-border overflow-hidden flex-shrink-0",children:r.image?e.jsx("img",{src:r.image,loading:"lazy",className:"w-full h-full object-cover opacity-80 group-hover:opacity-100 transition-opacity",alt:""}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground text-xs",children:"No image"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-bold text-foreground truncate",children:r.name}),e.jsx("p",{className:"text-primary text-sm font-mono mb-1",children:r.brand}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["S/N: ",r.serialNumber??"—"]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("span",{className:o("w-2 h-2 rounded-full",a.bg)}),e.jsxs("span",{className:o("text-xs font-bold",a.color),children:[a.label," Warranty"]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-4 pt-4 border-t border-border",children:[e.jsxs("div",{className:"text-center p-2 bg-muted/50 rounded",children:[e.jsx("div",{className:"text-xs text-muted-foreground uppercase",children:"Purchased"}),e.jsx("div",{className:"text-sm font-bold text-foreground",children:r.purchaseDate})]}),e.jsxs("div",{className:"text-center p-2 bg-muted/50 rounded",children:[e.jsx("div",{className:"text-xs text-muted-foreground uppercase",children:"Condition"}),e.jsx("div",{className:"text-sm font-bold text-foreground",children:r.condition})]})]})]})}const ae=6;function P({count:r=ae,mode:s="grid",className:n}){return s==="list"?e.jsx("div",{className:o("space-y-2",n),children:Array.from({length:r}).map((a,l)=>e.jsxs("div",{className:"flex gap-4 p-4 rounded-xl border border-border bg-card",children:[e.jsx(d,{variant:"rectangular",className:"w-24 h-24 rounded-lg shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(d,{variant:"text",className:"h-5 w-32"}),e.jsx(d,{variant:"text",className:"h-4 w-24"}),e.jsx(d,{variant:"text",className:"h-3 w-40"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(d,{variant:"rectangular",className:"h-8 w-16 rounded"}),e.jsx(d,{variant:"rectangular",className:"h-8 w-16 rounded"})]})]},l))}):e.jsx("div",{className:o("grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",n),children:Array.from({length:r}).map((a,l)=>e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(d,{variant:"rectangular",className:"h-6 w-16 rounded"}),e.jsx(d,{variant:"rectangular",className:"h-6 w-16 rounded"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(d,{variant:"rectangular",className:"w-24 h-24 rounded-lg shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(d,{variant:"text",className:"h-5 w-full"}),e.jsx(d,{variant:"text",className:"h-4 w-2/3"}),e.jsx(d,{variant:"text",className:"h-3 w-1/2"}),e.jsx(d,{variant:"text",className:"h-3 w-24"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-4 border-t border-border",children:[e.jsx(d,{variant:"rectangular",className:"h-14 rounded"}),e.jsx(d,{variant:"rectangular",className:"h-14 rounded"})]})]},l))})}function T({items:r,viewMode:s="grid",onItemSelect:n,onAddNew:a,isLoading:l=!1,error:x=null,emptyMessage:i="No gear found.",skeletonCount:m=6,className:t}){if(x)return e.jsx("div",{className:o("min-h-layout-page-sm flex items-center justify-center text-muted-foreground",t),children:e.jsx("p",{children:x})});if(l)return e.jsx(P,{count:m,mode:s,className:t});const u=r.length>0&&s==="list"?e.jsx("div",{className:"space-y-2",children:r.map(c=>e.jsx(I,{item:c,onClick:()=>n?.(c)},c.id))}):r.length>0?r.map(c=>e.jsx(I,{item:c,onClick:()=>n?.(c)},c.id)):null,h=s==="grid";return e.jsxs("div",{className:o(h?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8":"flex flex-col gap-2",t),children:[r.length===0&&h?e.jsx("div",{className:o("min-h-layout-page-sm flex items-center justify-center text-muted-foreground col-span-full",t),children:e.jsx("p",{children:i})}):r.length===0&&!h?e.jsx("div",{className:o("min-h-layout-page-sm flex items-center justify-center text-muted-foreground",t),children:e.jsx("p",{children:i})}):u,h&&e.jsxs("button",{type:"button",className:"appearance-none bg-transparent text-inherit font-inherit border-2 border-dashed border-border rounded-xl flex flex-col items-center justify-center p-8 hover:bg-muted/30 transition-colors cursor-pointer text-muted-foreground hover:text-foreground hover:border-primary/50 min-h-72 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background w-full",onClick:a,children:[e.jsx(S,{className:"w-12 h-12 mb-4 opacity-50"}),e.jsx("span",{className:"font-mono font-bold",children:"REGISTER NEW HARDWARE"})]}),s==="list"&&e.jsxs("button",{type:"button",onClick:a,className:"appearance-none bg-transparent border border-dashed border-border rounded-xl flex flex-col items-center justify-center p-8 min-h-24 cursor-pointer hover:bg-muted/30 w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[e.jsx(S,{className:"w-8 h-8 mb-2 opacity-50"}),e.jsx("span",{className:"font-mono text-sm font-bold",children:"REGISTER NEW HARDWARE"})]})]})}function ne({item:r,onClose:s,onSellOnMarketplace:n,onLogMaintenance:a,onContactSupport:l,onUploadDocument:x,className:i}){const m=O(r.warrantyExpire);return e.jsxs("div",{className:o("fixed inset-0 z-50 flex items-center justify-center p-4",i),children:[e.jsx("div",{className:"absolute inset-0 bg-background/90 backdrop-blur-sm",onClick:s,"aria-hidden":!0}),e.jsxs("div",{className:"relative w-full max-w-5xl bg-card border border-border rounded-2xl shadow-2xl overflow-hidden flex flex-col max-h-screen",children:[e.jsxs("div",{className:"p-8 border-b border-border bg-muted/30 flex justify-between items-start shrink-0",children:[e.jsxs("div",{className:"flex gap-8",children:[e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg overflow-hidden border border-border shrink-0",children:r.image?e.jsx("img",{src:r.image,loading:"lazy",className:"w-full h-full object-cover",alt:""}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground text-sm",children:"No image"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-1",children:[e.jsx(G,{label:r.category,variant:"cyan"}),e.jsx("span",{className:"text-muted-foreground text-xs font-mono uppercase",children:r.serialNumber??"—"})]}),e.jsx("h2",{className:"text-3xl font-heading font-bold text-foreground",children:r.name}),e.jsxs("h3",{className:"text-xl text-primary font-medium mb-4",children:[r.brand," ",r.model]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(j,{variant:"glass",size:"sm",icon:e.jsx(z,{className:"w-4 h-4"}),onClick:()=>n?.(r),children:"SELL ON MARKETPLACE"}),e.jsx(j,{variant:"secondary",size:"sm",icon:e.jsx(B,{className:"w-4 h-4"}),onClick:()=>a?.(r),children:"LOG MAINTENANCE"})]})]})]}),e.jsx("button",{type:"button",onClick:s,className:"text-muted-foreground hover:text-foreground p-1","aria-label":"Close",children:e.jsx(H,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-8 min-h-0",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-8",children:[e.jsxs(b,{variant:"default",children:[e.jsxs("h4",{className:"flex items-center gap-2 font-bold text-foreground mb-4 border-b border-border pb-2",children:[e.jsx($,{className:"w-4 h-4 text-muted-foreground"})," Specifications"]}),e.jsx("div",{className:"grid grid-cols-2 gap-y-4 gap-x-8",children:r.specs&&Object.keys(r.specs).length>0?Object.entries(r.specs).map(([t,u])=>e.jsxs("div",{className:"flex justify-between border-b border-border pb-1",children:[e.jsx("span",{className:"text-muted-foreground text-sm",children:t}),e.jsx("span",{className:"text-foreground text-sm font-medium",children:u})]},t)):e.jsx("p",{className:"text-muted-foreground italic col-span-2",children:"No specs available."})})]}),e.jsxs(b,{variant:"default",children:[e.jsxs("h4",{className:"flex items-center gap-2 font-bold text-foreground mb-4 border-b border-border pb-2",children:[e.jsx(_,{className:"w-4 h-4 text-amber-500"})," Maintenance & Support (SAV)"]}),r.status==="Maintenance"&&r.notes&&e.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 p-4 rounded mb-4 flex items-center gap-4",children:[e.jsx(K,{className:"w-5 h-5 text-amber-500 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-bold text-amber-500",children:"Currently in Repair"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r.notes})]})]}),e.jsxs("div",{className:"space-y-4",children:[r.maintenanceHistory?.map(t=>e.jsxs("div",{className:"flex items-start gap-4 p-4 bg-muted/30 rounded hover:bg-muted/50 transition-colors",children:[e.jsx("div",{className:"bg-muted p-2 rounded text-muted-foreground shrink-0",children:e.jsx(X,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("span",{className:"font-bold text-foreground text-sm",children:t.type}),e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:t.date})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.notes}),t.cost!=null&&e.jsxs("div",{className:"text-xs text-destructive mt-1 font-mono",children:["Cost: $",t.cost]})]})]},t.id)),(!r.maintenanceHistory||r.maintenanceHistory.length===0)&&e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No maintenance history recorded."})]})]})]}),e.jsxs("div",{className:"space-y-8",children:[e.jsxs(b,{variant:"glass",children:[e.jsxs("h4",{className:"flex items-center gap-2 font-bold text-foreground mb-4 border-b border-border pb-2",children:[e.jsx(Q,{className:"w-4 h-4 text-primary"})," Purchase Info"]}),e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Price Paid"}),e.jsxs("span",{className:"text-foreground font-mono",children:[r.currency," ",r.purchasePrice]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Date"}),e.jsx("span",{className:"text-foreground",children:r.purchaseDate})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Vendor"}),e.jsx("span",{className:"text-foreground",children:r.vendor??"—"})]}),r.orderNumber&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Order #"}),e.jsx("span",{className:"text-muted-foreground font-mono",children:r.orderNumber})]})]})]}),e.jsxs(b,{variant:"default",children:[e.jsxs("h4",{className:"flex items-center gap-2 font-bold text-foreground mb-4 border-b border-border pb-2",children:[e.jsx(q,{className:"w-4 h-4 text-green-600"})," Warranty"]}),e.jsxs("div",{className:o("p-4 rounded text-center mb-4",m.bg),children:[e.jsx("div",{className:o("text-lg font-bold",m.color),children:m.label}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Expires: ",r.warrantyExpire??"N/A"]})]}),r.supportContact&&e.jsx(j,{variant:"ghost",size:"sm",className:"w-full text-xs",onClick:()=>l?.(r),children:"Contact Support"})]}),e.jsxs(b,{variant:"default",children:[e.jsxs("h4",{className:"flex items-center gap-2 font-bold text-foreground mb-4 border-b border-border pb-2",children:[e.jsx(L,{className:"w-4 h-4 text-muted-foreground"})," Documentation"]}),e.jsxs("div",{className:"space-y-2",children:[r.documents?.map((t,u)=>e.jsxs("div",{className:"flex items-center justify-between p-2 hover:bg-muted/50 rounded cursor-pointer group",children:[e.jsxs("div",{className:"flex items-center gap-4 overflow-hidden min-w-0",children:[t.type==="manual"?e.jsx(L,{className:"w-4 h-4 text-muted-foreground shrink-0"}):e.jsx(J,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("span",{className:"text-sm text-foreground truncate",children:t.name})]}),e.jsx(R,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground shrink-0"})]},u)),e.jsxs(j,{variant:"ghost",size:"sm",className:"w-full mt-2 text-xs border border-dashed border-border",onClick:()=>x?.(r),children:[e.jsx(S,{className:"w-3 h-3 mr-1"})," Upload Document"]})]})]})]})]})})]})]})}function C(r){const s=r.purchaseDate,n=r.warrantyExpire;return{id:String(r.id??""),name:String(r.name??""),category:String(r.category??""),brand:String(r.brand??""),model:String(r.model??""),serialNumber:r.serialNumber,image:r.image,images:Array.isArray(r.images)?r.images:void 0,status:r.status??"Active",condition:r.condition??"Good",purchaseDate:s??"",purchasePrice:Number(r.purchasePrice??0),currency:r.currency??"USD",vendor:r.vendor,orderNumber:r.orderNumber,warrantyExpire:n,warrantyType:r.warrantyType,supportContact:r.supportContact,specs:r.specs??void 0,notes:r.notes,documents:r.documents??void 0,maintenanceHistory:r.maintenanceHistory??void 0}}const oe={async list(){const s=(await N.get("/inventory/gear")).data?.items??[];return Array.isArray(s)?s.map(C):[]},async getAll(){return this.list()},async get(r){const n=(await N.get(`/inventory/gear/${r}`)).data?.item;return n?C(n):null},async getById(r){return this.get(r)},async create(r){const n=(await N.post("/inventory/gear",r)).data?.item;if(!n)throw new Error("Invalid response from create gear");return C(n)},async update(r,s){const a=(await N.put(`/inventory/gear/${r}`,s)).data?.item;if(!a)throw new Error("Invalid response from update gear");return C(a)},async delete(r){await N.delete(`/inventory/gear/${r}`)}};function le(r={}){const{itemsOverride:s,isLoading:n=!1,error:a=null}=r,[l,x]=f.useState("All"),[i,m]=f.useState(""),[t,u]=f.useState("grid"),[h,c]=f.useState(null),[E,w]=f.useState([]),[v,y]=f.useState(!1),[p,k]=f.useState(null);f.useEffect(()=>{s===void 0&&(y(!0),k(null),oe.list().then(g=>{w(g)}).catch(g=>{k(g instanceof Error?g.message:"Failed to load gear"),w([])}).finally(()=>{y(!1)}))},[s]);const A=s!==void 0?s??[]:E,M=f.useMemo(()=>A.filter(g=>{const V=l==="All"||g.category===l||g.status===l,U=g.name.toLowerCase().includes(i.toLowerCase())||g.brand.toLowerCase().includes(i.toLowerCase());return V&&U}),[A,l,i]);return{filter:l,setFilter:x,search:i,setSearch:m,viewMode:t,setViewMode:u,selectedItem:h,setSelectedItem:c,filteredInventory:M,isLoading:n||s===void 0&&v,error:a??(s===void 0?p:null)}}function de(){return e.jsxs("div",{className:"space-y-8 animate-fadeIn relative max-w-layout-content mx-auto px-4 md:px-6",children:[e.jsx(D,{isLoading:!0}),e.jsx(F,{search:"",onSearchChange:()=>{},filter:"All",onFilterChange:()=>{},isLoading:!0}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:"View"}),e.jsx("div",{className:"h-9 w-20 rounded-lg bg-muted"})]}),e.jsx(P,{count:6,mode:"grid"})]})}function ie({viewMode:r,onViewModeChange:s}){return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:"View"}),e.jsxs("div",{className:"flex gap-1 bg-muted p-1 rounded-lg border border-border",children:[e.jsx("button",{type:"button",onClick:()=>s("grid"),className:o("p-1.5 rounded transition-colors",r==="grid"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),"aria-label":"Grid view",children:e.jsx(Y,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:()=>s("list"),className:o("p-1.5 rounded transition-colors",r==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),"aria-label":"List view",children:e.jsx(Z,{className:"w-4 h-4"})})]})]})}const Ce=({itemsOverride:r,isLoading:s,error:n})=>{const{addToast:a}=W(),{filter:l,setFilter:x,search:i,setSearch:m,viewMode:t,setViewMode:u,selectedItem:h,setSelectedItem:c,filteredInventory:E,isLoading:w,error:v}=le({itemsOverride:r,isLoading:s,error:n}),y=p=>{a(`Draft listing created for ${p.brand} ${p.name}`,"success"),c(null)};return w?e.jsx(de,{}):e.jsxs("div",{className:"space-y-8 animate-fadeIn relative max-w-layout-content mx-auto px-4 md:px-6",children:[e.jsx(D,{onExport:()=>a("Exporting Inventory CSV..."),onRegister:()=>a("Opens Registration Form"),error:v}),v?e.jsx(T,{items:[],viewMode:t,error:v,onItemSelect:c,onAddNew:()=>a("Opens Registration Form")}):e.jsxs(e.Fragment,{children:[e.jsx(F,{search:i,onSearchChange:m,filter:l,onFilterChange:x}),e.jsx(ie,{viewMode:t,onViewModeChange:u}),e.jsx(T,{items:E,viewMode:t,onItemSelect:c,onAddNew:()=>a("Opens Registration Form")}),h&&e.jsx(ne,{item:h,onClose:()=>c(null),onSellOnMarketplace:y,onLogMaintenance:()=>a("Maintenance Log Updated"),onContactSupport:p=>a(`Contacting ${p.supportContact}`),onUploadDocument:()=>a("Upload document")})]})]})};export{Ce as GearView};