PageSourceSearch

https://poke6900.gg/assets/Notifications-nDXLJBLm.js

js poke6900.gg collected 2026-10-02 01:56:08 UTC 12,731 bytes, 6 lines download raw bytes

1import{E as $,G as U,u as B,c as H,Y as V,t as l,J as w,Z as A,aV as h,bG as K,b6 as y,aM as N,a6 as C,q as b,aj as q,bH as R,j as e,B as u,M as G,h as z,o as Q,bC as Z,ar as J,as as Y,at as O,aB as W,$ as X,a7 as ee,ay as M,aH as E,V as te,F as se,aw as ie,D as ae,b5 as ce}from"./index-DCifuJ2A.js";import{S as ne}from"./switch-CQJ0nw4r.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const oe=$("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);function re(o){switch(o){case"mention":case"chat_mention":case"community_mention":return{icon:h,bg:"bg-blue-500/20",fg:"text-blue-400"};case"reply":case"chat_reply":case"community_reply":return{icon:K,bg:"bg-purple-500/20",fg:"text-purple-400"};case"follow":return{icon:y,bg:"bg-green-500/20",fg:"text-green-400"};case"friend_request":return{icon:y,bg:"bg-green-500/20",fg:"text-green-400"};case"friend_accepted":return{icon:ce,bg:"bg-emerald-500/20",fg:"text-emerald-400"};case"dm":case"chat_message":return{icon:N,bg:"bg-indigo-500/20",fg:"text-indigo-400"};case"marketplace":return{icon:C,bg:"bg-orange-500/20",fg:"text-orange-400"};case"pokemarket_offer":return{icon:ae,bg:"bg-yellow-500/20",fg:"text-yellow-400"};case"pokemarket_reminder":return{icon:M,bg:"bg-amber-500/20",fg:"text-amber-400"};case"price_alert":return{icon:b,bg:"bg-red-500/20",fg:"text-red-400"};case"news_broadcast":return{icon:R,bg:"bg-yellow-500/20",fg:"text-yellow-400"};case"stream_live":return{icon:E,bg:"bg-sky-500/20",fg:"text-sky-400"};default:return{icon:ie,bg:"bg-muted",fg:"text-muted-foreground"}}}const _=[{key:"all",labelKey:"notifications.filter.all",icon:A},{key:"mention",labelKey:"notifications.filter.mentions",icon:h,types:["mention","chat_mention","community_mention"]},{key:"reply",labelKey:"notifications.filter.replies",icon:K,types:["reply","chat_reply","community_reply"]},{key:"social",labelKey:"notifications.filter.social",icon:y,types:["follow","friend_request","friend_accepted"]},{key:"dm",labelKey:"notifications.filter.messages",icon:N,types:["dm","chat_message"]},{key:"marketplace",labelKey:"notifications.filter.market",icon:C,types:["marketplace","pokemarket_offer","pokemarket_reminder"]},{key:"price_alert",labelKey:"notifications.filter.prices",icon:b,types:["price_alert"]},{key:"communities",labelKey:"notifications.filter.communities",icon:q,types:["community_post","community_reply","community_mention"]},{key:"news",labelKey:"notifications.filter.news",icon:R,types:["news_broadcast"]}];function le(o,p){const m=new Date().getTime()-new Date(o).getTime(),i=Math.floor(m/6e4),c=Math.floor(m/36e5),d=Math.floor(m/864e5);return i<1?p("notifications.justNow"):i<60?`${i}m ago`:c<24?`${c}h ago`:d<7?`${d}
6d ago`:new Date(o).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const de=[{key:"dmEnabled",labelKey:"notifications.pref.dm",descKey:"notifications.pref.dm.desc",icon:N},{key:"mentionsEnabled",labelKey:"notifications.pref.mentions",descKey:"notifications.pref.mentions.desc",icon:h},{key:"chatMessagesEnabled",labelKey:"notifications.pref.chat",descKey:"notifications.pref.chat.desc",icon:ee},{key:"priceAlertsEnabled",labelKey:"notifications.pref.priceAlerts",descKey:"notifications.pref.priceAlerts.desc",icon:b},{key:"pokemarketRemindersEnabled",labelKey:"notifications.pref.pokemarket",descKey:"notifications.pref.pokemarket.desc",icon:M},{key:"streamLiveEnabled",labelKey:"notifications.pref.streams",descKey:"notifications.pref.streams.desc",icon:E}];function ge(){const{user:o}=U(),[,p]=B(),[f,m]=H.useState("all"),{t:i}=V(),c=l.useUtils(),{data:d}=l.auth.getNotificationPreferences.useQuery(void 0,{enabled:!!o}),k=l.auth.updateNotificationPreferences.useMutation({onSuccess:()=>{c.auth.getNotificationPreferences.invalidate(),w(i("notifications.settingsSaved"),{duration:1500})},onError:()=>{w(i("notifications.settingsError"),{duration:2e3})}}),T=(t,s)=>{k.mutate({[t]:s?1:0})},{data:r,isLoading:S}=l.notifications.getAll.useQuery({limit:200,offset:0},{enabled:!!o,refetchInterval:3e4}),D=l.notifications.markAsRead.useMutation({onMutate:async({notificationId:t})=>{await c.notifications.getAll.cancel();const s=c.notifications.getAll.getData({limit:200,offset:0});return c.notifications.getAll.setData({limit:200,offset:0},a=>a?.map(n=>n.id===t?{...n,isRead:!0}:n)),{prev:s}},onError:(t,s,a)=>{a?.prev&&c.notifications.getAll.setData({limit:200,offset:0},a.prev)}}),j=l.notifications.markAllAsRead.useMutation({onSuccess:()=>c.notifications.getAll.invalidate()}),L=l.notifications.delete.useMutation({onMutate:async({notificationId:t})=>{await c.notifications.getAll.cancel();const s=c.notifications.getAll.getData({limit:200,offset:0});return c.notifications.getAll.setData({limit:200,offset:0},a=>a?.filter(n=>n.id!==t)),{prev:s}},onError:(t,s,a)=>{a?.prev&&c.notifications.getAll.setData({limit:200,offset:0},a.prev)}}),I=t=>{t.isRead||D.mutate({notificationId:t.id}),t.link&&p(t.link)},v=(()=>{if(!r)return[];if(f==="all")return r;const t=_.find(s=>s.key===f);return!t||!("types"in t)?r:r.filter(s=>t.types.includes(s.type))})(),g=r?.filter(t=>!t.isRead).length??0;return o?e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:198",className:"min-h-screen bg-gradient-to-br from-background via-background to-card",children:[e.jsx(z,{"data-loc":"client/src/pages/Notifications.tsx:199"}),e.jsxs("main",{"data-loc":"client/src/pages/Notifications.tsx:200",className:"max-w-2xl mx-auto px-4 py-8",children:[e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:202",className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:203",className:"flex items-center gap-3",children:[e.jsx("h1",{"data-loc":"client/src/pages/Notifications.tsx:204",className:"text-2xl font-bold",children:i("notifications.title")}),g>0&&e.jsxs(Q,{"data-loc":"client/src/pages/Notifications.tsx:206",variant:"destructive",className:"text-xs",children:[g," ",i("notifications.unread")]})]}),g>0&&e.jsxs(u,{"data-loc":"client/src/pages/Notifications.tsx:212",variant:"outline",size:"sm",onClick:()=>j.mutate(),disabled:j.isPending,className:"gap-1.5",children:[e.jsx(Z,{"data-loc":"client/src/pages/Notifications.tsx:219",className:"w-4 h-4"}),i("notifications.markAllRead")]})]}),e.jsx(J,{"data-loc":"client/src/pages/Notifications.tsx:226",value:f,onValueChange:t=>m(t),className:"mb-6",children:e.jsx(Y,{"data-loc":"client/src/pages/Notifications.tsx:227",className:"flex flex-wrap h-auto gap-1 bg-muted/50 p-1",children:_.map(t=>{const s=t.icon,a=r?t.key==="all"?g:"types"in t?r.filter(n=>t.types.includes(n.type)&&!n.isRead).length:0:0;return e.jsxs(O,{"data-loc":"client/src/pages/Notifications.tsx:240",value:t.key,className:"flex items-center gap-1.5 text-xs px-3 py-1.5",children:[e.jsx(s,{"data-loc":"client/src/pages/Notifications.tsx:241",className:"w-3.5 h-3.5"}),i(t.labelKey),a>0&&e.jsx("span",{"data-loc":"client/src/pages/Notifications.tsx:244",className:"bg-destructive text-destructive-foreground rounded-full text-[10px] px-1.5 py-0 leading-4 min-w-[18px] text-center",children:a})]},t.key)})})}),S?e.jsx("div",{"data-loc":"client/src/pages/Notifications.tsx:256",className:"space-y-3",children:[...Array(6)].map((t,s)=>e.jsx("div",{"data-loc":"client/src/pages/Notifications.tsx:258",className:"h-20 rounded-xl bg-muted/40 animate-pulse"},s))}):v.length===0?e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:262",className:"flex flex-col items-center justify-center py-20 text-center gap-3",children:[e.jsx(W,{"data-loc":"client/src/pages/Notifications.tsx:263",className:"w-10 h-10 text-muted-foreground"}),e.jsx("p",{"data-loc":"client/src/pages/Notifications.tsx:264",className:"text-muted-foreground",children:i(f==="all"?"notifications.none":"notifications.noneInCategory")})]}):e.jsx("div",{"data-loc":"client/src/pages/Notifications.tsx:269",className:"space-y-2",children:v.map(t=>{const{icon:s,bg:a,fg:n}
6=re(t.type);return e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:273",onClick:()=>I(t),className:`flex items-start gap-3 p-4 rounded-xl border cursor-pointer transition-colors hover:bg-accent/40 ${t.isRead?"bg-card border-border/50":"bg-accent/20 border-primary/20"}`,children:[e.jsx("div",{"data-loc":"client/src/pages/Notifications.tsx:281",className:`w-9 h-9 rounded-full ${a} flex items-center justify-center flex-shrink-0 mt-0.5`,children:e.jsx(s,{"data-loc":"client/src/pages/Notifications.tsx:282",className:`w-4 h-4 ${n}`})}),e.jsx("div",{"data-loc":"client/src/pages/Notifications.tsx:286",className:"flex-1 min-w-0",children:e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:287",className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:288",className:"flex-1 min-w-0",children:[e.jsx("p",{"data-loc":"client/src/pages/Notifications.tsx:289",className:`text-sm font-semibold leading-tight ${t.isRead?"text-foreground/80":"text-foreground"}`,children:t.title}),e.jsx("p",{"data-loc":"client/src/pages/Notifications.tsx:292",className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:t.message}),e.jsx("p",{"data-loc":"client/src/pages/Notifications.tsx:293",className:"text-xs text-muted-foreground/60 mt-1.5",children:le(t.createdAt,i)})]}),e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:295",className:"flex items-center gap-1.5 flex-shrink-0",children:[!t.isRead&&e.jsx("div",{"data-loc":"client/src/pages/Notifications.tsx:296",className:"w-2 h-2 rounded-full bg-primary"}),e.jsx(u,{"data-loc":"client/src/pages/Notifications.tsx:297",variant:"ghost",size:"icon",className:"w-7 h-7 opacity-0 group-hover:opacity-100 hover:opacity-100 hover:text-destructive",onClick:x=>{x.stopPropagation(),L.mutate({notificationId:t.id})},children:e.jsx(X,{"data-loc":"client/src/pages/Notifications.tsx:306",className:"w-3.5 h-3.5"})})]})]})})]},t.id)})}),e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:318",className:"mt-10",children:[e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:319",className:"flex items-center gap-2 mb-4",children:[e.jsx(oe,{"data-loc":"client/src/pages/Notifications.tsx:320",className:"w-5 h-5 text-muted-foreground"}),e.jsx("h2",{"data-loc":"client/src/pages/Notifications.tsx:321",className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground",children:i("notifications.settings")})]}),e.jsx("div",{"data-loc":"client/src/pages/Notifications.tsx:325",className:"rounded-xl border border-border/60 bg-card divide-y divide-border/40",children:de.map(({key:t,labelKey:s,descKey:a,icon:n})=>{const x=d?d[t]:void 0,P=x===void 0?!0:x!==0;return e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:330",className:"flex items-center justify-between px-4 py-4 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:331",className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{"data-loc":"client/src/pages/Notifications.tsx:332",className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center flex-shrink-0",children:e.jsx(n,{"data-loc":"client/src/pages/Notifications.tsx:333",className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:335",className:"min-w-0",children:[e.jsx(te,{"data-loc":"client/src/pages/Notifications.tsx:336",className:"text-sm font-medium text-foreground cursor-pointer",children:i(s)}),e.jsx("p",{"data-loc":"client/src/pages/Notifications.tsx:337",className:"text-xs text-muted-foreground mt-0.5",children:i(a)})]})]}),e.jsx(ne,{"data-loc":"client/src/pages/Notifications.tsx:340",checked:P,onCheckedChange:F=>T(t,F),disabled:!d||k.isPending,className:"data-[state=checked]:bg-red-600 flex-shrink-0"})]},t)})})]})]}),e.jsx(se,{"data-loc":"client/src/pages/Notifications.tsx:352",onFeedbackClick:()=>{}})]}):e.jsx("div",{"data-loc":"client/src/pages/Notifications.tsx:187",className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{"data-loc":"client/src/pages/Notifications.tsx:188",className:"text-center space-y-4",children:[e.jsx(A,{"data-loc":"client/src/pages/Notifications.tsx:189",className:"w-12 h-12 text-muted-foreground mx-auto"}),e.jsx("p",{"data-loc":"client/src/pages/Notifications.tsx:190",className:"text-muted-foreground",children:i("notifications.loginPrompt")}),e.jsx(u,{"data-loc":"client/src/pages/Notifications.tsx:191",onClick:()=>window.location.href=G(),children:"Log In"})]})})}export{ge 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.