PageSourceSearch

https://wevyn.ai/assets/RemindersPage-C7iyR6Rw.js

js wevyn.ai collected 2026-10-05 14:28:29 UTC 5,187 bytes, 1 lines download raw bytes

1import{r as i,_ as B,J as z,g as C,Y as F,j as t,B as m,a7 as x}from"./index-CUJHY1__.js";import{B as p}from"./badge-DEX-OWmE.js";import{B as f}from"./button-CuHNnmzZ.js";import{T as I,a as E,b as u}from"./tabs-wf3fx91i.js";import{S as $,a as P,b as V,c as L,d as j}from"./select-DTqFlShN.js";import{B as J}from"./bell-off-DvZ054Qi.js";import{s as K}from"./subDays-ByyGNxrB.js";import{f as M}from"./formatDistanceToNow-Db3Vzw1G.js";import"./index-T0HY47K6.js";import"./index-DIDn7E4Z.js";import"./index-BdQq_4o_.js";import"./index-BQqgmzc6.js";import"./index-CgsI9YHZ.js";import"./chevron-down-BW0_ZS-e.js";import"./check-3jUdm9tS.js";import"./en-US-DWrl2lTx.js";function le(){const[N,v]=i.useState([]),[r,b]=i.useState("pending"),[S,g]=i.useState(!0),[d,w]=i.useState("all"),[y,T]=i.useState([]),{toast:n}=B(),A=z(),{user:l}=C(),a=(l==null?void 0:l.role)==="admin"||(l==null?void 0:l.role)==="supervisor",c=()=>{x.list({agentId:a&&d!=="all"?d:void 0}).then(e=>{const o=(e==null?void 0:e.data)??e??[];v(o)}).catch(()=>{n({title:"Failed to load reminders",variant:"destructive"})}).finally(()=>g(!1))};i.useEffect(()=>{a&&F.get("/agents").then(e=>{const o=(e==null?void 0:e.data)??e??[];T(o.map(s=>({id:s.id,name:s.user?`${s.user.firstName??""} ${s.user.lastName??""}`.trim()||s.user.email:s.id})))}).catch(()=>{})},[a]),i.useEffect(()=>{g(!0),c();const e=setInterval(c,3e4);return()=>clearInterval(e)},[d]);const k=e=>{x.dismiss(e).then(()=>{n({title:"Reminder dismissed"}),c()}).catch(()=>n({title:"Failed to dismiss reminder",variant:"destructive"}))},D=e=>{x.snooze(e,15).then(()=>{n({title:"Reminder snoozed 15 minutes"}),c()}).catch(()=>n({title:"Failed to snooze reminder",variant:"destructive"}))},R=K(new Date,30),h=N.filter(e=>{if(r==="pending")return!e.isTriggered;const s=new Date(e.reminderAt)>=R;return r==="triggered"?e.isTriggered&&s:s});return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"border-b border-border px-6 py-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(m,{className:"h-5 w-5 text-orange-500"}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-xl font-semibold leading-tight",children:a?"All Reminders":"My Reminders"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:a?"Reminders across all agents":"Reminders you have set"})]})]})}),t.jsxs("div",{className:"px-6 pt-4 flex items-center gap-4 flex-wrap",children:[t.jsx(I,{value:r,onValueChange:e=>b(e),children:t.jsxs(E,{children:[t.jsxs(u,{value:"all",children:["All ",t.jsx("span",{className:"ml-1 text-[10px] text-muted-foreground",children:"(30d)"})]}),t.jsx(u,{value:"pending",children:"Pending"}),t.jsxs(u,{value:"triggered",children:["Triggered ",t.jsx("span",{className:"ml-1 text-[10px] text-muted-foreground",children:"(30d)"})]})]})}),a&&t.jsxs($,{value:d,onValueChange:w,children:[t.jsx(P,{className:"h-8 w-44 text-xs",children:t.jsx(V,{placeholder:"All Agents"})}),t.jsxs(L,{children:[t.jsx(j,{value:"all",children:"All Agents"}),y.map(e=>t.jsx(j,{value:e.id,children:e.name},e.id))]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto px-6 py-4",children:S?t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx("div",{className:"h-6 w-6 border-2 border-primary border-t-transparent rounded-full animate-spin"})}):h.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-24 text-muted-foreground",children:[t.jsx(m,{className:"h-10 w-10"}),t.jsxs("p",{className:"text-sm",children:["No reminders",r==="pending"?" pending":""]})]}):t.jsx("div",{className:"flex flex-col gap-2",children:h.map(e=>t.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-card p-4",children:[t.jsx("div",{className:"mt-0.5 shrink-0",children:e.isTriggered?t.jsx(J,{className:"h-5 w-5 text-muted-foreground"}):t.jsx(m,{className:"h-5 w-5 text-orange-500"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("p",{className:"flex-1 font-semibold text-sm leading-tight min-w-0",children:e.subject}),t.jsx("div",{className:"shrink-0",children:e.isTriggered?t.jsx(p,{variant:"secondary",className:"text-xs",children:"Done"}):t.jsx(p,{className:"bg-orange-500 text-white hover:bg-orange-600 text-xs",children:"Pending"})})]}),(e.ticketNumber||e.ticketSubject)&&t.jsxs("button",{type:"button",onClick:()=>A(`/tickets?open=${e.ticketId}`),className:"mt-1 text-xs text-primary hover:underline text-left",children:[e.ticketNumber?`TKT#${e.ticketNumber}`:"",e.ticketNumber&&e.ticketSubject?" · ":"",e.ticketSubject??""]}),a&&e.agentName&&t.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Agent: ",e.agentName]}),t.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Due"," ",M(new Date(e.reminderAt),{addSuffix:!0})]}),!e.isTriggered&&t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(f,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>D(e.id),children:"Snooze 15m"}),t.jsx(f,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>k(e.id),children:"Dismiss"})]})]})]},e.id))})})]})}export{le 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.