PageSourceSearch

https://xterns.ai/assets/XternNotifications-SyyDk_9z.js

js xterns.ai collected 2026-10-05 13:24:13 UTC 9,206 bytes, 2 lines download raw bytes

1import{r as L,j as e,aK as w,bt as v,bu as C,aZ as U,B as t,y as O,b as k,h as l,m as r,a9 as p,J as g,i as x,k as h,H as P,a as W,g as A}from"./index-DLd_kDlx.js";import{S as q}from"./switch-7Twrb7Os.js";import{A as H,a as X,b as G,c as I,d as J,e as Q,f as $,g as K,h as Y}from"./alert-dialog-Ct5JsrY0.js";import{u as Z,N as V}from"./NotificationItem-Dc2WXW-y.js";import{u as ee}from"./useNotificationPreferences-DhCaj2cc.js";import{M as D}from"./message-square-CtxeCfRz.js";import{F as se}from"./filter-BMeMiGQo.js";import{M as ae}from"./mail-BVn2o8AP.js";import{G as te}from"./git-branch-C-twpC7K.js";import{A as ie}from"./award-MEJfpupD.js";import{T as le}from"./trash-2-0uuZSTFd.js";import{D as re}from"./download-Cr0jatld.js";import"./formatDistanceToNow-57P64IbE.js";import"./en-US-9SRVm7yB.js";import"./differenceInCalendarMonths-BA0TPVs2.js";import"./endOfDay-DkR3ZXc8.js";import"./endOfMonth-CYn6pTOm.js";import"./trophy-DBX-jNOC.js";import"./triangle-alert-Chqk_WK7.js";const n="rounded-2xl border border-gray-200/80 bg-white shadow-[0_12px_36px_rgba(15,23,42,0.06)]",S="rounded-xl border-gray-200 bg-white hover:border-xterns-blue/30 hover:bg-xterns-blue/5",Ae=()=>{const{notifications:o,unreadCount:j,loading:T,markAllAsRead:y}=Z(),{preferences:f,loading:z,updateEmailPreference:R}=ee(),[s,d]=L.useState(null),_=o.filter(a=>{const i=new Date().toDateString();return new Date(a.created_at).toDateString()===i}).length,M=o.filter(a=>{const i=new Date;return i.setDate(i.getDate()-7),new Date(a.created_at)>=i}).length,B=o.filter(a=>a.action_required&&!a.read_at).length,m=a=>o.filter(i=>i.type===a&&!i.read_at).length,u=s?o.filter(a=>a.type===s):o,E=async()=>{const a=new Date;a.setDate(a.getDate()-30),A.success("Old notifications cleared successfully")},F=()=>{const a=[["Title","Message","Type","Created At","Read"],...u.map(c=>[c.title,c.message,c.type,new Date(c.created_at).toLocaleDateString(),c.read_at?"Yes":"No"])].map(c=>c.join(",")).join(`
2`),i=new Blob([a],{type:"text/csv"}),b=window.URL.createObjectURL(i),N=document.createElement("a");N.href=b,N.download="notifications.csv",N.click(),window.URL.revokeObjectURL(b),A.success("Notifications exported successfully")};return T?e.jsx(w,{children:e.jsxs("div",{className:"min-h-screen flex w-full bg-gray-50",children:[e.jsx(v,{}),e.jsx(C,{className:"flex-1",children:e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"text-center",children:"Loading notifications..."})})})]})}):e.jsx(w,{children:e.jsxs("div",{className:"min-h-screen flex w-full bg-gray-50",children:[e.jsx(v,{}),e.jsxs(C,{className:"flex-1",children:[e.jsxs("header",{className:"sticky top-0 z-40 flex min-h-16 shrink-0 flex-wrap items-center gap-3 border-b border-gray-200/80 bg-white/95 px-4 py-3 backdrop-blur sm:px-8",children:[e.jsx(U,{className:"-ml-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"font-display text-2xl font-normal tracking-tight text-xterns-navy",children:"Notifications"}),e.jsxs("p",{className:"text-sm text-gray-600",children:["Stay updated with your Xterns journey",s&&e.jsxs("span",{className:"ml-2",children:["• Filtered by ",s,e.jsx(t,{size:"sm",variant:"ghost",className:"ml-1 h-auto p-1 text-xs",onClick:()=>d(null),children:"Clear"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(t,{size:"sm",variant:"outline",className:S,children:[e.jsx(O,{className:"h-4 w-4 mr-1"}),"Settings"]}),e.jsxs(t,{size:"sm",variant:"outline",className:S,onClick:y,disabled:j===0,children:[e.jsx(k,{className:"h-4 w-4 mr-1"}),"Mark All Read"]})]})]}),e.jsxs("main",{className:"flex-1 space-y-8 px-4 py-8 sm:px-8 lg:px-10",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsx(l,{className:n,children:e.jsx(r,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Unread"}),e.jsx("p",{className:"font-display text-3xl text-xterns-navy",children:j})]}),e.jsx(p,{className:"h-8 w-8 text-blue-500"})]})})}),e.jsx(l,{className:n,children:e.jsx(r,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Today"}),e.jsx("p",{className:"font-display text-3xl text-xterns-navy",children:_})]}),e.jsx(g,{className:"bg-green-100 text-green-800",children:"New"})]})})}),e.jsx(l,{className:n,children:e.jsx(r,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"This Week"}),e.jsx("p",{className:"font-display text-3xl text-xterns-navy",children:M})]}),e.jsx(D,{className:"h-8 w-8 text-purple-500"})]})})}),e.jsx(l,{className:n,children:e.jsx(r,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Actions"}),e.jsx("p",{className:"font-display text-3xl text-xterns-navy",children:B})]}),e.jsx(g,{className:"bg-red-100 text-red-800",children:"Urgent"})]})})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-3",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsxs(l,{className:n,children:[e.jsx(x,{children:e.jsxs(h,{className:"flex items-center gap-2",children:[e.jsx(p,{className:"h-5 w-5"}),s?`${s} Notifications`:"Recent Notifications",s&&e.jsxs(g,{variant:"secondary",className:"ml-2",children:[e.jsx(se,{className:"h-3 w-3 mr-1"}),"Filtered"]})]})}),e.jsx(r,{className:"space-y-4",children:u.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(p,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:s?`No ${s} notifications`:"No notifications yet"}),e.jsx("p",{className:"text-sm",children:s?"Try selecting a different filter or clear the current filter.":"When you receive notifications, they'll appear here."})]}):u.map(a=>e.jsx(V,{notification:a,showMarkAsRead:!0},a.id))})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(l,{className:n,children:[e.jsx(x,{children:e.jsx(h,{className:"text-base",children:"Notification Settings"})}),e.jsxs(r,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:"Email notifications"})]}),e.jsx(q,{checked:(f==null?void 0:f.email_enabled)??!0,onCheckedChange:R,disabled:z})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"When disabled, you'll only receive in-app notifications. Email notifications will be turned off."})]})]}),e.jsxs(l,{className:n,children:[e.jsx(x,{children:e.jsx(h,{className:"text-base",children:"Qu
2ick Filters"})}),e.jsxs(r,{className:"space-y-3",children:[e.jsxs(t,{size:"sm",variant:s==="project"?"default":"outline",className:"w-full justify-start rounded-xl",onClick:()=>d(s==="project"?null:"project"),children:[e.jsx(te,{className:"h-4 w-4 mr-2"}),"Project Updates (",m("project"),")"]}),e.jsxs(t,{size:"sm",variant:s==="achievement"?"default":"outline",className:"w-full justify-start rounded-xl",onClick:()=>d(s==="achievement"?null:"achievement"),children:[e.jsx(ie,{className:"h-4 w-4 mr-2"}),"Achievements (",m("achievement"),")"]}),e.jsxs(t,{size:"sm",variant:s==="meeting"?"default":"outline",className:"w-full justify-start rounded-xl",onClick:()=>d(s==="meeting"?null:"meeting"),children:[e.jsx(P,{className:"h-4 w-4 mr-2"}),"Meetings (",m("meeting"),")"]}),e.jsxs(t,{size:"sm",variant:s==="job"?"default":"outline",className:"w-full justify-start rounded-xl",onClick:()=>d(s==="job"?null:"job"),children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"Job Alerts (",m("job"),")"]}),e.jsxs(t,{size:"sm",variant:s==="message"?"default":"outline",className:"w-full justify-start rounded-xl",onClick:()=>d(s==="message"?null:"message"),children:[e.jsx(D,{className:"h-4 w-4 mr-2"}),"Messages (",m("message"),")"]})]})]}),e.jsxs(l,{className:n,children:[e.jsx(x,{children:e.jsx(h,{className:"text-base",children:"Quick Actions"})}),e.jsxs(r,{className:"space-y-2",children:[e.jsxs(t,{size:"sm",variant:"outline",className:"w-full justify-start",onClick:y,disabled:j===0,children:[e.jsx(k,{className:"h-4 w-4 mr-2"}),"Mark All as Read"]}
2),e.jsxs(H,{children:[e.jsx(X,{asChild:!0,children:e.jsxs(t,{size:"sm",variant:"outline",className:"w-full justify-start",children:[e.jsx(le,{className:"h-4 w-4 mr-2"}),"Clear Old Notifications"]})}),e.jsxs(G,{children:[e.jsxs(I,{children:[e.jsx(J,{children:"Clear Old Notifications"}),e.jsx(Q,{children:"This will permanently delete all read notifications older than 30 days. This action cannot be undone."})]}),e.jsxs($,{children:[e.jsx(K,{children:"Cancel"}),e.jsx(Y,{onClick:E,children:"Clear Notifications"})]})]})]}),e.jsxs(t,{size:"sm",variant:"outline",className:"w-full justify-start",onClick:F,children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),"Export Notifications"]})]})]})]})]})]})]})]})})};export{Ae as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.