PageSourceSearch

https://kconect.vercel.app/assets/AttendeeNotifications-C8iB-OSs.js

js kconect.vercel.app collected 2026-10-03 07:11:44 UTC 15,023 bytes, 1 lines download raw bytes

1import{c as F,u as H,a as J,r as $,K,j as e,B as g,W as M,C as V,d as W,e as X,m as k,f as G,g as O,U as Q,J as Z,k as ee}from"./index-IxvR3ybE.js";import{A as se,a as ae,b as te}from"./avatar-BaQ7HthH.js";import{C as u}from"./checkbox-CDY_wJSR.js";import{T as re,a as le,b as y,c as N}from"./tabs-_QLeAqis.js";import{u as ne}from"./useConnectionRequests-DWjgYp7F.js";import{u as ce}from"./useAttendeeNotifications-D_uPrmP4.js";import{T as de}from"./trash-2-DklbPQfi.js";import{B as C}from"./bell-XbQ4oIpl.js";import{M as R}from"./message-square-D78-i2rO.js";import{U as q}from"./user-plus-DKb_O1Pc.js";import{C as ie}from"./circle-x-Dst20DfF.js";import{C as me}from"./circle-check-big-DrZso9hg.js";import{I as T}from"./info-zb8jj5B_.js";import{C as xe}from"./clock-DaRv8o2j.js";import{M as oe}from"./megaphone-DiANqzpJ.js";import"./queryCache-BtqcWBRl.js";const qe=()=>{F();const{notifications:A,loading:P,acceptConnectionRequest:S,declineConnectionRequest:I,markAsRead:U}=ne(),{notifications:n,loading:z,markAsRead:B,markAllAsRead:D,deleteNotification:ge,deleteSelectedNotifications:Y,getNotificationsByType:pe,requestNotificationPermission:E}=ce(),r=H(),{currentUser:j}=J(),[l,v]=$.useState(!1),[c,b]=$.useState([]),w=n.filter(s=>!s.is_read).length;K.useEffect(()=>{E()},[]);const p=async s=>{if(l){o(s.id);return}try{if(s.is_read||("connection"in s?await U(s.id):await B(s.id)),"connection"in s){r("/attendee/networking?tab=connections");return}const a=s;switch(a.type){case"direct_message":{const t=a.related_id;let d;if(t&&(j!=null&&j.id)){const{data:i,error:m}=await ee.from("direct_messages").select("sender_id, recipient_id").eq("id",t).single();!m&&i&&(d=i.sender_id===j.id?i.recipient_id:i.sender_id)}const x=new URLSearchParams;x.set("tab","messages"),d&&x.set("dmUserId",d),r(`/attendee/networking?${x.toString()}`);break}case"group_message":{r("/attendee/networking?tab=chats");break}case"connection_accepted":{r("/attendee/networking?tab=connections");break}case"announcement":{a.related_id?r(`/attendee/announcements?announcementId=${a.related_id}`):r("/attendee/announcements");break}case"poll_created":{r("/attendee/polls?tab=active");break}case"schedule_update":{a.related_id?r(`/attendee/schedule?itemId=${a.related_id}`):r("/attendee/schedule");break}case"facility_update":{r("/attendee/map");break}case"question":{r("/attendee/questions");break}default:r("/attendee/notifications")}}catch(a){console.error("Error handling notification click:",a)}},o=s=>{b(a=>a.includes(s)?a.filter(t=>t!==s):[...a,s])},L=async()=>{c.length!==0&&(await Y(c),b([]),v(!1))},h=s=>{const a=new Date(s),d=new Date().getTime()-a.getTime(),x=Math.floor(d/(1e3*60)),i=Math.floor(d/(1e3*60*60)),m=Math.floor(d/(1e3*60*60*24));return x<60?`${x} min ago`:i<24?`${i}h ago`:`${m}d ago`},f=s=>{switch(s){case"connection":case"connection_accepted":return e.jsx(q,{className:"h-5 w-5 text-connect-600"});case"direct_message":return e.jsx(Z,{className:"h-5 w-5 text-blue-600"});case"group_message":return e.jsx(Q,{className:"h-5 w-5 text-purple-600"});case"question":return e.jsx(R,{className:"h-5 w-5 text-amber-600"});case"schedule_update":return e.jsx(O,{className:"h-5 w-5 text-green-600"});case"facility_update":return e.jsx(T,{className:"h-5 w-5 text-orange-600"});case"announcement":return e.jsx(oe,{className:"h-5 w-5 text-blue-600"});case"poll_created":return e.jsx(xe,{className:"h-5 w-5 text-indigo-600"});default:return e.jsx(T,{className:"h-5 w-5 text-gray-600"})}},_=s=>{const a=s.connection,t=a==null?void 0:a.requester_profile;if(!a||!t)return null;const d=a.status==="pending",x=a.status==="accepted",i=a.status==="rejected";return e.jsxs("div",{className:"py-5 px-3 flex items-start gap-4",children:[e.jsx(se,{className:"h-12 w-12 flex-shrink-0",children:t.photo_url?e.jsx(ae,{src:t.photo_url,alt:t.name}):e.jsx(te,{className:"bg-connect-100 text-connect-600",children:t.name.split(" ").map(m=>m[0]).join("")})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:`text-sm leading-relaxed ${s.is_read?"":"font-medium"} break-words`,children:[e.jsx("span",{className:"font-semibold",children:t.name})," wants to connect with you"]}),t.role&&e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 break-words mt-1",children:[t.role,t.company&&` at ${t.company}`]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:h(s.created_at)}),!s.is_read&&e.jsx(k,{variant:"outline",className:"text-[10px] px-2 py-0.5 h-5 bg-connect-50 text-connect-600 dar
1k:bg-connect-900/30 dark:text-connect-400",children:"New"}),x&&e.jsx(k,{variant:"outline",className:"text-[10px] px-2 py-0.5 h-5 bg-green-50 text-green-600 dark:bg-green-900/30 dark:text-green-400",children:"Accepted"}),i&&e.jsx(k,{variant:"outline",className:"text-[10px] px-2 py-0.5 h-5 bg-red-50 text-red-600 dark:bg-red-900/30 dark:text-red-400",children:"Declined"})]})]}),d&&e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsxs(g,{size:"sm",variant:"outline",onClick:m=>{m.stopPropagation(),I(a.id,s.id)},className:"h-8 px-3 text-xs flex-1 sm:flex-none",children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),"Decline"]}),e.jsxs(g,{size:"sm",onClick:m=>{m.stopPropagation(),S(a.id,s.id)},className:"h-8 px-3 text-xs bg-connect-600 hover:bg-connect-700 flex-1 sm:flex-none",children:[e.jsx(me,{className:"h-3 w-3 mr-1"}),"Accept"]})]})]})]})};return z||P?e.jsx("div",{className:"animate-fade-in max-w-6xl mx-auto p-4 sm:p-6",children:e.jsx("div",{className:"flex justify-center items-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-connect-600 mx-auto"}),e.jsx("p",{className:"mt-2 text-gray-600 dark:text-gray-400",children:"Loading notifications..."})]})})}):e.jsxs("div",{className:"animate-fade-in max-w-6xl mx-auto p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col space-y-4 mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-900 dark:text-white break-words",children:"Notifications"}),e.jsx("p",{className:"text-sm sm:text-base text-gray-600 dark:text-gray-400 mt-1",children:"Stay updated on your activities and event updates"})]}),e.jsx("div",{className:"flex flex-wrap gap-2 w-full sm:w-auto",children:l?e.jsxs(e.Fragment,{children:[e.jsx(g,{variant:"outline",onClick:()=>{v(!1),b([])},className:"text-sm flex-1 sm:flex-none",children:"Cancel"}),e.jsxs(g,{variant:"destructive",onClick:L,disabled:c.length===0,className:"text-sm flex-1 sm:flex-none",children:[e.jsx(de,{className:"h-4 w-4 mr-1"}),"Delete (",c.length,")"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(g,{variant:"outline",onClick:()=>v(!0),className:"text-sm flex-1 sm:flex-none",children:"Select"}),e.jsxs(g,{variant:"outline",onClick:D,className:"text-sm flex-1 sm:flex-none",disabled:w===0,children:[e.jsx(M,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Mark All Read"}),e.jsx("span",{className:"sm:hidden",children:"Read All"})]})]})})]})}),e.jsxs(V,{className:"shadow-lg",children:[e.jsx(W,{className:"pb-3 px-4 sm:px-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"h-5 w-5 text-connect-600 dark:text-connect-400 flex-shrink-0"}),e.jsx(X,{className:"text-lg sm:text-xl",children:"Your Notifications"})]}),w>0&&e.jsxs(k,{className:"bg-connect-600 text-xs",children:[w," new"]})]})}),e.jsx(G,{className:"px-4 sm:px-6",children:e.jsxs(re,{defaultValue:"all",className:"w-full",children:[e.jsx("div",{className:"mb-6 overflow-x-auto",children:e.jsxs(le,{className:"inline-flex w-auto min-w-full h-auto p-1 gap-1",children:[e.jsx(y,{value:"all",className:"px-4 py-2.5 text-sm font-medium whitespace-nowrap",children:"All"}),e.jsx(y,{value:"unread",className:"px-4 py-2.5 text-sm font-medium whitespace-nowrap",children:"Unread"}),e.jsx(y,{value:"messages",className:"px-4 py-2.5 text-sm font-medium whitespace-nowrap",children:"Messages"}),e.jsx(y,{value:"connections",className:"px-4 py-2.5 text-sm font-medium whitespace-nowrap",children:"Connections"}),e.jsx(y,{value:"updates",className:"px-4 py-2.5 text-sm font-medium whitespace-nowrap",children:"Updates"})]})}),e.jsx(N,{value:"all",className:"space-y-0 divide-y divide-gray-100 dark:divide-gray-800",children:n.length>0?n.map(s=>e.jsxs("div",{className:`cursor-pointer transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50 ${s.is_read?"":"bg-gray-50 dark:bg-gray-800/50"} ${l?"relative":""}`,onClick:()=>p(s),children:[l&&e.jsx("div",{className:"absolute top-3 left-3 z-10",onClick:a=>
1a.stopPropagation(),children:e.jsx(u,{checked:c.includes(s.id),onCheckedChange:()=>o(s.id)})}),s.type==="connection"?_(s):e.jsxs("div",{className:"py-5 px-3 flex items-start gap-4",children:[e.jsx("div",{className:"mt-1 p-2.5 rounded-full bg-gray-100 dark:bg-gray-800 flex-shrink-0",children:f(s.type)}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsx("p",{className:`text-sm leading-relaxed ${s.is_read?"":"font-medium"} break-words`,children:s.message}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:h(s.created_at)})]})]})]},s.id)):e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(C,{className:"h-12 w-12 mx-auto text-gray-300 dark:text-gray-600"}),e.jsx("h3",{className:"mt-4 text-lg font-medium",children:"No notifications"}),e.jsx("p",{className:"mt-2 text-gray-500 dark:text-gray-400 text-sm",children:"You don't have any notifications yet"})]})}),e.jsx(N,{value:"unread",className:"space-y-0 divide-y divide-gray-100 dark:divide-gray-800",children:n.filter(s=>!s.is_read).length>0?n.filter(s=>!s.is_read).map(s=>e.jsxs("div",{className:`cursor-pointer bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800/70 transition-colors ${l?"relative":""}`,onClick:()=>p(s),children:[l&&e.jsx("div",{className:"absolute top-3 left-3 z-10",onClick:a=>a.stopPropagation(),children:e.jsx(u,{checked:c.includes(s.id),onCheckedChange:()=>o(s.id)})}),s.type==="connection"?_(s):e.jsxs("div",{className:"py-5 px-3 flex items-start gap-4",children:[e.jsx("div",{className:"mt-1 p-2.5 rounded-full bg-gray-100 dark:bg-gray-800 flex-shrink-0",children:f(s.type)}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsx("p",{className:"text-sm font-medium leading-relaxed break-words",children:s.message}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:h(s.created_at)})]})]})]},s.id)):e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(M,{className:"h-12 w-12 mx-auto text-gray-300 dark:text-gray-600"}),e.jsx("h3",{className:"mt-4 text-lg font-medium",children:"No unread notifications"}),e.jsx("p",{className:"mt-2 text-gray-500 dark:text-gray-400 text-sm",children:"You're all caught up!"})]})}),e.jsx(N,{value:"messages",className:"space-y-0 divide-y divide-gray-100 dark:divide-gray-800",children:n.filter(s=>s.type==="direct_message"||s.type==="group_message").length>0?n.filter(s=>s.type==="direct_message"||s.type==="group_message").map(s=>e.jsxs("div",{className:`cursor-pointer transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50 ${s.is_read?"":"bg-gray-50 dark:bg-gray-800/50"} ${l?"relative":""}`,onClick:()=>p(s),children:[l&&e.jsx("div",{className:"absolute top-3 left-3 z-10",onClick:a=>a.stopPropagation(),children:e.jsx(u,{checked:c.includes(s.id),onCheckedChange:()=>o(s.id)})}),e.jsxs("div",{className:"py-5 px-3 flex items-start gap-4",children:[e.jsx("div",{className:"mt-1 p-2.5 rounded-full bg-gray-100 dark:bg-gray-800 flex-shrink-0",children:f(s.type)}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsx("p",{className:`text-sm leading-relaxed ${s.is_read?"":"font-medium"} break-words`,children:s.message}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:h(s.created_at)})]})]})]},s.id)):e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(R,{className:"h-12 w-12 mx-auto text-gray-300 dark:text-gray-600"}),e.jsx("h3",{className:"mt-4 text-lg font-medium",children:"No messages"}),e.jsx("p",{className:"mt-2 text-gray-500 dark:text-gray-400 text-sm",children:"You haven't received any messages yet"})]})}),e.jsx(N,{value:"connections",className:"space-y-0 divide-y divide-gray-100 dark:divide-gray-800",children:A.filter(s=>s.type==="connection").length>0?A.filter(s=>s.type==="connection").map(s=>e.jsxs("div",{className:`cursor-pointer transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50 ${s.is_read?"":"bg-gray-50 dark:bg-gray-800/50"} ${l?"relative":""}`,onClick:()=>p(s),children:[l&&e.jsx("div",{className:"absolute top-3 left-3 z-10",onClick:a=>
1a.stopPropagation(),children:e.jsx(u,{checked:c.includes(s.id),onCheckedChange:()=>o(s.id)})}),_(s)]},s.id)):e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(q,{className:"h-12 w-12 mx-auto text-gray-300 dark:text-gray-600"}),e.jsx("h3",{className:"mt-4 text-lg font-medium",children:"No connection requests"}),e.jsx("p",{className:"mt-2 text-gray-500 dark:text-gray-400 text-sm",children:"You haven't received any connection requests yet"})]})}),e.jsx(N,{value:"updates",className:"space-y-0 divide-y divide-gray-100 dark:divide-gray-800",children:n.filter(s=>["announcement","schedule_update","facility_update","poll_created"].includes(s.type)).length>0?n.filter(s=>["announcement","schedule_update","facility_update","poll_created"].includes(s.type)).map(s=>e.jsxs("div",{className:`cursor-pointer transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50 ${s.is_read?"":"bg-gray-50 dark:bg-gray-800/50"} ${l?"relative":""}`,onClick:()=>p(s),children:[l&&e.jsx("div",{className:"absolute top-3 left-3 z-10",onClick:a=>a.stopPropagation(),children:e.jsx(u,{checked:c.includes(s.id),onCheckedChange:()=>o(s.id)})}),e.jsxs("div",{className:"py-5 px-3 flex items-start gap-4",children:[e.jsx("div",{className:"mt-1 p-2.5 rounded-full bg-gray-100 dark:bg-gray-800 flex-shrink-0",children:f(s.type)}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsx("p",{className:`text-sm leading-relaxed ${s.is_read?"":"font-medium"} break-words`,children:s.message}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:h(s.created_at)})]})]})]},s.id)):e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(C,{className:"h-12 w-12 mx-auto text-gray-300 dark:text-gray-600"}),e.jsx("h3",{className:"mt-4 text-lg font-medium",children:"No updates"}),e.jsx("p",{className:"mt-2 text-gray-500 dark:text-gray-400 text-sm",children:"You haven't received any event updates yet"})]})})]})})]})]})};export{qe 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.