2 lines
1.9 KiB
JavaScript
2 lines
1.9 KiB
JavaScript
import{u as f,j as e,ay as p,e as h,az as u,L as o,q as j}from"./vendor-BKmmeuxg.js";import{P as N,a as g,b as v}from"./popover-B4kBsMuI.js";import{c as w}from"./utils-DxSsnXxD.js";import{B as t}from"./button-BpNwv2aE.js";import{S as b}from"./scroll-area-C8HGru-R.js";const k=()=>{const{notifications:s,translate:l}=f().props,{button:a,frontend:c,dashboard:x}=l;return e.jsxs(N,{children:[e.jsx(g,{asChild:!0,children:e.jsxs(t,{variant:"secondary",size:"icon",className:"relative h-9 w-9 rounded-full p-0",children:[e.jsx(p,{className:"!h-5 !w-5"}),s.length>0&&e.jsx("span",{className:"absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-red-500 text-[10px] font-medium text-white",children:s.length})]})}),e.jsxs(v,{align:"end",className:"w-80 p-0",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-2",children:[e.jsx("h4",{className:"font-semibold",children:x.notifications}),e.jsx(t,{variant:"ghost",size:"sm",className:"px-2 text-xs",onClick:()=>h.put(route("notifications.mark-all-as-read")),children:a.mark_all_as_read})]}),e.jsx(b,{children:e.jsx("div",{className:"flex max-h-[300px] flex-col gap-1 py-2",children:s.length>0?s.map(({id:i,data:d,created_at:r})=>{const n=u(new Date(r),{addSuffix:!0}),m=n.slice(0,1).toUpperCase()+n.slice(1);return e.jsxs(o,{href:route("notifications.show",i),className:w("hover:bg-accent/50 flex flex-col gap-1 px-4 py-2 transition-colors"),children:[e.jsx("p",{className:"text-sm font-medium capitalize",children:d.title}),e.jsx("span",{className:"text-muted-foreground text-xs",title:j(new Date(r),"PPpp"),children:m})]},i)}):e.jsx("p",{className:"text-muted-foreground p-6 text-center text-sm",children:c.no_unread_notifications})})}),e.jsx("div",{className:"border-t p-2",children:e.jsx(t,{asChild:!0,variant:"ghost",className:"w-full justify-center",size:"sm",children:e.jsx(o,{href:route("notifications.index"),children:a.view_all_notifications})})})]})]})};export{k as N};
|