1import{j as e}from"./react-oP8cqJFW.js";import{f as g,bx as f,by as h,bz as b,ab as y,ac as j,ag as N,q as _,H as u,A as w,m as v,n as k,af as A,t as F,aW as i,bt as C,r as P,bA as q,bB as I}from"./index-DHvy35rZ.js";import{S as R}from"./SideRailsAuto-DbAGuq76.js";import{u as S}from"./router-BqMuc5y6.js";import{A as L}from"./arrow-left-ChxApaex.js";import"./query-2Ep1yrI1.js";import"./supabase-KdB9RrlQ.js";import"./motion-SKSdPC_x.js";const z={like:u,reply:F,follow:i,follow_request:i,follow_accepted:i,tag:C,parrot:P},$={like:"liked your thought",reply:"replied to your thought",follow:"started following you",follow_request:"requested to follow you",follow_accepted:"accepted your follow request",tag:"tagged you in a thought",parrot:"parroted your thought"},B=({userId:t})=>{const{data:r}=q(t),o=I();return!r||r==="following"?null:e.jsx("button",{onClick:l=>{l.stopPropagation(),o.mutate({targetUserId:t,currentStatus:r})},disabled:o.isPending,className:"text-xs font-body font-semibold px-3 py-1 rounded-full bg-primary text-primary-foreground hover:opacity-90 transition-opacity shrink-0",children:r==="pending"?"Requested":"Follow back"})},J=()=>{const t=S(),{user:r}=g(),{data:o=[],isLoading:l}=f(),n=h(),c=b();return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(y,{}),e.jsxs("div",{className:"max-w-2xl mx-auto lg:border-x lg:border-border min-h-screen",children:[e.jsxs("div",{"data-ptr-header":!0,className:"sticky top-0 z-20 bg-background/80 backdrop-blur-lg border-b border-border px-4 py-3 pt-[max(0.75rem,env(safe-area-inset-top))] flex items-center gap-3",children:[e.jsx("button",{onClick:()=>t(-1),className:"p-2 -ml-2 rounded-full hover:bg-muted transition-colors",children:e.jsx(L,{size:20,className:"text-foreground"})}),e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsx("img",{src:j,alt:"&",className:"h-6 w-6 object-contain -mr-1 dark:brightness-0 dark:invert"}),e.jsx("span",{className:"font-display font-bold text-lg text-foreground",children:"Notifications"})]}),e.jsx("span",{className:"text-sm text-muted-foreground font-body ml-auto",children:o.length})]}),e.jsx("div",{className:"divide-y divide-border/50",children:l?e.jsx("div",{className:"p-4 space-y-3",children:[...Array(5)].map((s,a)=>e.jsx(N,{className:"h-14 rounded-xl"},a))}):o.length===0?e.jsx("div",{className:"flex items-center justify-center h-32 text-muted-foreground font-body text-sm",children:"No notifications yet"}):o.map(s=>{const a=s.type==="reply"&&s.reply?.is_private,m=a?_:z[s.type]||u,p=a?"sent a private reply to your thought":$[s.type]||s.type,x=s.from_user?.display_name?.split(" ").map(d=>d[0]).join("")||"?";return e.jsxs("div",{className:`px-4 py-3 flex items-center gap-3 ${s.read?"":"bg-primary/5"}`,children:[e.jsx("button",{onClick:()=>{s.from_user?.username&&t(`/${s.from_user.username}`)},className:"shrink-0",children:e.jsxs(w,{className:"w-10 h-10",children:[e.jsx(v,{src:s.from_user?.avatar_url||void 0}),e.jsx(k,{className:"bg-primary text-primary-foreground font-display text-xs font-semibold",children:x})]})}),e.jsxs("button",{className:"flex-1 min-w-0 text-left",onClick:()=>{s.thought_id?t(`/thought/${s.thought_id}`):s.from_user?.username&&t(`/${s.from_user.username}`)},children:[e.jsxs("p",{className:"text-sm font-body",children:[e.jsx("span",{className:"font-semibold text-foreground",children:s.from_user?.display_name||"Someone"})," ",e.jsx("span",{className:"text-muted-foreground",children:p})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A(new Date(s.created_at),{addSuffix:!0})}),s.type==="follow_request"&&s.from_user_id&&e.jsxs("div",{className:"flex gap-2 mt-2",onClick:d=>d.stopPropagation(),children:[e.jsx("button",{onClick:()=>n.mutate({followerId:s.from_user_id}),disabled:n.isPending,className:"text-xs font-body font-semibold px-3 py-1 rounded-full bg-primary text-primary-foreground",children:"Accept"}),e.jsx("button",{onClick:()=>c.mutate({followerId:s.from_user_id}),disabled:c.isPending,className:"text-xs font-body font-semibold px-3 py-1 rounded-full bg-muted text-muted-foreground",children:"Decline"})]})]}),(s.type==="follow"||s.type==="follow_accepted")&&s.from_user_id&&s.from_user_id!==r?.id?e.jsx(B,{userId:s.from_user_id}):e.jsx(m,{size:14,className:"text-muted-foreground shrink-0"})]},s.id)})})]}),e.jsx(R,{})]})};export{J 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.