PageSourceSearch

https://weeklywizdom.com/assets/NotificationCenter-D_1VlcEY.js

js weeklywizdom.com collected 2026-10-06 14:15:55 UTC 7,790 bytes, 1 lines download raw bytes

1import{j as r}from"./vendor-radix-miDeECL4.js";import{r as f,L as u}from"./vendor-react-BBjb5hzp.js";import{s as m,D as g,c as _,i as x}from"./index-DGrYQ9Ri.js";import{u as h}from"./vendor-query-CnkSJpBn.js";import{e as v}from"./formatters-emItPtIP.js";import{F as y}from"./filter-BVHXsfJd.js";import"./vendor-charts-D_igoWGj.js";import"./vendor-supabase-DwR6CW6F.js";function $(t,n){const a=n||"Unknown";switch(t){case"entry_hit":return`⚡ ${a} Entry Filled`;case"tp_hit":return`🎯 ${a} Target Hit`;case"tp1_hit":return`🎯 ${a} TP1 Hit`;case"tp2_hit":return`🎯 ${a} TP2 Hit`;case"tp3_hit":return`🎯 ${a} TP3 Hit`;case"sl_hit":return`🛑 ${a} Stop Loss Hit`;case"manual_close":return`📋 ${a} Trade Closed`;case"new_call":return`📢 New ${a} Trade Call`;case"activated":return`⚡ ${a} Trade Activated`;default:return`${a} — ${t.replace(/_/g," ")}`}}function b(t,n){const a=n||"Unknown";switch(t){case"entry_hit":return`${a} entry price reached — trade is now active`;case"tp_hit":return`${a} take profit target hit 💰`;case"tp1_hit":return`${a} first target hit — partial profit taken`;case"tp2_hit":return`${a} second target hit — scaling out`;case"tp3_hit":return`${a} final target hit — full profit!`;case"sl_hit":return`${a} stop loss triggered — risk managed`;case"manual_close":return`${a}
1 trade manually closed by analyst`;default:return`${t.replace(/_/g," ")} for ${a}`}}function k(t){const n=new Set;return t.filter(a=>{const o=`${a.type}:${a.title}:${a.ticker}:${Math.floor(new Date(a.timestamp).getTime()/6e4)}`;return n.has(o)?!1:(n.add(o),!0)})}function j(t=50){return h({queryKey:["notification-feed",t],queryFn:async()=>{const n=[],{data:a}=await m.from("admin_notification_log").select("id, notification_type, event_type, ticker, trade_call_id, delivered, created_at").order("created_at",{ascending:!1}).limit(t*2);if(a){const e=new Set;for(const i of a){const l=i.trade_call_id?`${i.trade_call_id}:${i.event_type}`:`${i.ticker}:${i.event_type}:${i.id}`;if(e.has(l))continue;e.add(l);const c=i.notification_type==="crime_alerts";n.push({id:i.id,type:c?"crime_alert":"official_call",title:c?`🚨 ${i.ticker||"Unknown"} Crime Alert`:$(i.event_type,i.ticker),description:c?`Suspicious activity detected on ${i.ticker||"unknown asset"}`:b(i.event_type,i.ticker),ticker:i.ticker,timestamp:i.created_at??new Date().toISOString(),delivered:i.delivered??!1})}}const{data:o}=await m.from("degen_call_notifications").select("id, notification_type, delivered, created_at, signal_snapshot").order("created_at",{ascending:!1}).limit(t);if(o)for(const e of o){const i=e.signal_snapshot,l=i?.ticker||"Unknown",c=i?.direction||"";n.push({id:e.id,type:"degen_signal",title:`🔥 ${l} Degen ${c?c.charAt(0).toUpperCase()+c.slice(1):"Signal"}`,description:`${c.toUpperCase()} ${l} — ${e.notification_type==="new_signal"?"new signal detected":e.notification_type}`,ticker:l!=="Unknown"?l:null,timestamp:e.created_at,delivered:e.delivered??!1})}const d=new Date(Date.now()-3*24*60*60*1e3).toISOString().slice(0,10),{data:s}=await m.from("calendar_events").select("id, title, event_date, event_time, impact_level, data_released, actual_value").gte("event_date",d).in("impact_level",["high","critical"]).order("event_date",{ascending:!1}).limit(t);if(s)for(const e of s){const i=e.event_time?`${e.event_date}T${e.event_time}Z`:`${e.event_date}T12:00:00Z`,l=e.data_released||!!e.actual_value;n.push({id:e.id,type:"calendar_event",title:l?`📊 ${e.title}`:`📅 ${e.title}`,description:l?`Result: ${e.actual_value||"released"} — ${e.impact_level} impact`:`${e.impact_level?.toUpperCase()} impact event on ${e.event_date}`,ticker:null,timestamp:i,delivered:l})}return n.sort((e,i)=>new Date(i.timestamp).getTime()-new Date(e.timestamp).getTime()),k(n).slice(0,t)},staleTime:60*60*1e3,refetchInterval:60*60*1e3,refetchOnWindowFocus:!1})}const N={crime_alert:{emoji:"🚨",label:"Crime Alert",color:"#ff2e50",link:"/funding-rates?tab=crime"},official_call:{emoji:"⚡",label:"Trade Call",color:"#00d4ff",link:"/trades"},degen_signal:{emoji:"🔥",label:"Degen Signal",color:"#ff6b35",link:"/degen-calls"},calendar_event:{emoji:"📅",label:"Calendar",color:"#ffd700",link:"/calendar"}};function w({item:t}){const n=N[t.type]||{emoji:"🔔",label:"Alert",color:"#6366f1"};return r.jsx("div",{className:"relative rounded-xl border border-border/30 bg-card/60 p-3 hover:bg-accent/20 transition-colors",children:r.jsxs("div",{className:"flex items-start gap-2.5",children:[r.jsx("span",{className:"text-base mt-0.5 shrink-0",children:n.emoji}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[r.jsx("span",{className:"text-xs font-bold text-foreground truncate",children:t.title}),!t.delivered&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary shrink-0"})]}),r.jsx("p",{className:"text-[10px] text-muted-foreground line-clamp-2 leading-relaxed",children:t.description}),r.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[r.jsx("span",{className:"text-[9px] text-muted-foreground/60",children:v(t.timestamp)}),r.jsx("span",{className:"text-[8px] font-mono font-bold px-1.5 py-0.5 rounded-full",style:{color:n.color,background:`${n.color}15`,border:`1px solid ${n.color}30`},children:n.label}),t.ticker&&r.jsx(u,{to:`/ticker/${t.ticker}`,className:"text-[9px] font-mono text-primary hover:underline",onClick:a=>a.stopPropagation(),children:t.ticker})]})]})]})})}function H(){const{data:t,isLoading:n}=j(25),[a,o]=f.useState("all"),d=f.useMemo(()=>t?a==="all"?t:t.filter(e=>e.type===a):[],[t,a]),s=f.useMemo(()=>t?{all:t.length,crime_alert:t.filter(e=>e.type==="crime_alert").length,official_call:t.filter(e=>e.type==="official_call").length,degen_signal:t.filter(e=>e.type==="degen_signal").length,calendar_event:t.filter(e=>e.type==="calendar_event").length}:{all:0,crime_alert:0,official_call:0,degen_signal:0,calendar_event:0},[t]),p=[{label:"All",value:"all",count:s.all},{label:"Crime",value:"crime_alert",count:s.crime_alert},{label:"Calls",value:"official_call",count:s.official_call},{label:"Degen",value:"degen_signal",count:s.degen_signal},{label:"📅 Calendar",value:"calendar_event",count:s.calendar_event}];return r.jsx(g,{children:r.jsxs("div",{className:"p-4 lg:p-6 space-y-5 max-w-5xl mx-auto",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Notification Center"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"All alerts, signals, and events in one feed"})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx(y,{className:"h-3.5 w-3.5 text-muted-foreground"}),p.map(e=>r.jsxs("button",{onClick:()=>o(e.value),className:_("px-3 py-1.5 text-[10px] font-mono font-bold uppercase tracking-wider rounded-lg border transition-colors",a===e.value?"bg-primary/10 border-primary/30 text-primary":"bg-card/50 border-border/40 text-muted-foreground hover:text-foreground"),children:[e.label," (",e.count,")"]},e.value))]}),n?r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:[...Array(6)].map((e,i)=>r.jsx("div",{className:"h-24 rounded-xl border border-border/20 animate-pulse bg-muted/20"},i))}):d.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[r.jsx(x,{className:"h-12 w-12 text-muted-foreground
1/20 mb-3"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No notifications yet"}),r.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Alerts will appear here as they're triggered"})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:d.map(e=>r.jsx(w,{item:e},e.id))})]})})}export{H 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.