import{r as l,j as e,L as y,b2 as p,h as b,at as R,S as A,aV as C,Z as S,l as L}from"./vendor-DyCecx-5.js";import{e as c,t as g}from"./index-DJXN7D4i.js";const $=({type:a})=>{switch(a){case"booking":return e.jsx("div",{className:"p-2.5 bg-blue-50 text-blue-600 rounded",children:e.jsx(L,{className:"w-5 h-5"})});case"offer":return e.jsx("div",{className:"p-2.5 bg-emerald-50 text-emerald-600 rounded",children:e.jsx(S,{className:"w-5 h-5"})});case"payment":return e.jsx("div",{className:"p-2.5 bg-amber-50 text-amber-600 rounded",children:e.jsx(C,{className:"w-5 h-5"})});case"system":return e.jsx("div",{className:"p-2.5 bg-slate-50 text-slate-600 rounded",children:e.jsx(A,{className:"w-5 h-5"})});default:return e.jsx("div",{className:"p-2.5 bg-slate-50 text-slate-400 rounded",children:e.jsx(b,{className:"w-5 h-5"})})}},F=()=>{const[a,r]=l.useState([]),[N,n]=l.useState(!0),[d,o]=l.useState("all"),[x,m]=l.useState(!1);l.useEffect(()=>{f()},[]);const f=async()=>{n(!0);const s=await c.getNotifications();s.success&&s.data&&r(s.data),n(!1)},w=async(s,t)=>{s.stopPropagation(),(await c.markNotificationAsRead(t)).success&&r(k=>k.map(i=>i.id===t?{...i,isRead:!0}:i))},j=async()=>{m(!0),(await c.markAllNotificationsAsRead()).success?(r(t=>t.map(u=>({...u,isRead:!0}))),g.success("All notifications marked as read")):g.error("Failed to mark all as read"),m(!1)},h=Array.isArray(a)?a.filter(s=>d==="all"?!0:!s.isRead):[],v=Array.isArray(a)&&a.some(s=>!s.isRead);return e.jsx("div",{className:"min-h-screen bg-slate-50/50 py-12 px-6",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6 mb-10",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-4xl font-black text-slate-900 tracking-tight",children:"Notifications"}),e.jsx("p",{className:"text-slate-500 font-medium mt-1",children:"Stay updated with your bookings and exclusive offers."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[v&&e.jsxs("button",{onClick:j,disabled:x,className:"text-xs font-black text-blue-600 hover:text-blue-800 transition-colors uppercase tracking-widest flex items-center gap-2",children:[x?e.jsx(y,{className:"w-3 h-3 animate-spin"}):e.jsx(p,{className:"w-4 h-4"}),"Mark all read"]}),e.jsxs("div",{className:"flex bg-white p-1.5 rounded border border-slate-200 shadow-sm",children:[e.jsx("button",{onClick:()=>o("all"),className:`px-5 py-2 rounded text-sm font-black transition-all ${d==="all"?"bg-slate-900 text-white shadow-lg shadow-slate-200":"text-slate-400 hover:text-slate-600"}`,children:"All"}),e.jsx("button",{onClick:()=>o("unread"),className:`px-5 py-2 rounded text-sm font-black transition-all ${d==="unread"?"bg-slate-900 text-white shadow-lg shadow-slate-200":"text-slate-400 hover:text-slate-600"}`,children:"Unread"})]})]})]}),e.jsx("div",{className:"space-y-4",children:N?[1,2,3].map(s=>e.jsxs("div",{className:"bg-white p-6 rounded-lg border border-slate-100 flex gap-6",children:[e.jsx("div",{className:"w-12 h-12 bg-slate-100 rounded shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"h-4 bg-slate-100 rounded-full w-1/3"}),e.jsx("div",{className:"h-3 bg-slate-100 rounded-full w-full"})]})]},s)):h.length===0?e.jsxs("div",{className:"bg-white rounded-lg p-20 text-center border border-slate-100 shadow-sm shadow-slate-200/50",children:[e.jsx("div",{className:"w-24 h-24 bg-gradient-to-br from-slate-50 to-slate-100 text-slate-300 rounded-lg flex items-center justify-center mx-auto mb-8 shadow-inner",children:e.jsx(b,{className:"w-12 h-12"})}),e.jsx("h3",{className:"text-2xl font-black text-slate-900 mb-2",children:"You're all caught up!"}),e.jsx("p",{className:"text-slate-500 font-medium max-w-xs mx-auto",children:"No new notifications at the moment. We'll alert you when something pops up."})]}):h.map(s=>e.jsxs("div",{className:`
                                    group bg-white p-6 rounded-lg border transition-all duration-300 relative overflow-hidden
                                    ${s.isRead?"border-slate-100 opacity-75 grayscale-[0.5]":"border-slate-900/5 bg-white shadow-sm shadow-slate-200/50"}
                                    hover:bg-slate-50 hover:-translate-y-1
                                `,children:[e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"shrink-0 relative",children:[e.jsx($,{type:s.type}),!s.isRead&&e.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3 bg-rose-500 rounded-full ring-4 ring-white"})]}),e.jsxs("div",{className:"flex-1 min-w-0 pr-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("h3",{className:`text-lg font-black tracking-tight ${s.isRead?"text-slate-700":"text-slate-900"}`,children:s.title}),e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-black text-slate-400 tracking-widest uppercase",children:[e.jsx(R,{className:"w-3 h-3"}),s.timestamp]})]}),e.jsx("p",{className:`text-sm leading-relaxed ${s.isRead?"text-slate-500":"text-slate-600 font-medium"}`,children:s.message})]}),!s.isRead&&e.jsx("button",{onClick:t=>w(t,s.id),className:"absolute right-6 top-1/2 -translate-y-1/2 p-3 bg-slate-50 text-slate-400 hover:bg-emerald-500 hover:text-white rounded transition-all opacity-0 group-hover:opacity-100 shadow-lg shadow-emerald-100",title:"Mark read",children:e.jsx(p,{className:"w-5 h-5"})})]}),!s.isRead&&e.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-slate-900/5 blur-3xl -mr-12 -mt-12 pointer-events-none"})]},s.id))})]})})};export{F as default};
