PageSourceSearch

https://nmbr.ai/app/assets/user-feed-grid-DMRqLDdL.js

js nmbr.ai collected 2026-10-05 12:20:06 UTC 8,682 bytes, 1 lines download raw bytes

1import{c as B,a7 as G,g as _,e as D,r as u,k as j,b as d,j as e,Y as H,B as m,Z as w,L as y,az as Y,a5 as Z,q as O}from"./index-DBkfqdJO.js";import{u as h}from"./useInfiniteQuery-8YEWEmUy.js";import{f as W}from"./message-formatter-lCApaW8T.js";import{I as J}from"./input-nSGw00ZS.js";import"./formatting-toolbar-BNAmU_4I.js";import{C as V}from"./create-post-modal-BLrAZulP.js";import{A as X}from"./arrow-left-CnKT2g2k.js";import{S as ee}from"./search-CN0N0IaO.js";import{P as te}from"./plus-BnnhYguj.js";import{B as k,H as P}from"./heart-DysurtRx.js";import{P as se}from"./media-utils-DX6yNx0o.js";import"./sparkle-text-B1-0_9eb.js";import"./file-text-C3mqxeX4.js";import"./list-DE5moYPz.js";import"./device-BYYezroz.js";import"./camera-DZCuMuzy.js";import"./check-Bwmdmnj-.js";import"./square-BdAsqSXI.js";import"./upload-utils-DkKGD7UF.js";import"./megaphone-DURwIjOj.js";import"./image-Bqqikl8c.js";const ae=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],re=B("grid-3x3",ae),x=12;function Ce(){const[,C]=G("/feed/user/:userId"),[,c]=_(),{user:z}=D(),o=C?.userId,[r,S]=u.useState(""),[s,p]=u.useState("posts"),[$,f]=u.useState(!1),n=z?.id===o,{data:L}=j({queryKey:["/api/onboarding/status"]}),F=()=>{L?.isComplete&&O(c)},{data:b}=j({queryKey:["/api/users",o],queryFn:async()=>{const t=await fetch(d(`/api/users/${o}`),{credentials:"include"});if(!t.ok)throw new Error("Failed to load user");return t.json()},enabled:!!o}),q=h({queryKey:["/api/users",o,"posts-grid"],queryFn:async({pageParam:t})=>{const a=new URLSearchParams({limit:String(x)});t&&a.set("cursor",t);const i=await fetch(d(`/api/users/${o}/posts?${a}`),{credentials:"include"});if(!i.ok)throw new Error("Failed to load posts");return i.json()},initialPageParam:void 0,getNextPageParam:t=>t.nextCursor??void 0,enabled:!!o}),M=h({queryKey:["/api/posts/saved-grid"],queryFn:async({pageParam:t})=>{const a=new URLSearchParams({limit:String(x)});t&&a.set("cursor",t);const i=await fetch(d(`/api/posts/saved?${a}`),{credentials:"include"});if(!i.ok)throw new Error("Failed to load saved posts");return i.json()},initialPageParam:void 0,getNextPageParam:t=>t.nextCursor??void 0,enabled:n&&s==="saved"}),U=h({queryKey:["/api/posts/liked-grid"],queryFn:async({pageParam:t})=>{const a=new URLSearchParams({limit:String(x)});t&&a.set("cursor",t);const i=await fetch(d(`/api/posts/liked?${a}`),{credentials:"include"});if(!i.ok)throw new Error("Failed to load liked posts");return i.json()},initialPageParam:void 0,getNextPageParam:t=>t.nextCursor??void 0,enabled:n&&s==="liked"}),l=s==="posts"?q:s==="saved"?M:U,g=l.data?.pages.flatMap(t=>t.posts)??[],v=b?.user?.firstName||b?.user?.displayName?.split(" ")[0]||"User",A=n?"My Feed":`${v}'s Feed`,N=r?g.filter(t=>{const a=r.toLowerCase(),i=t.author?`${t.author.firstName??""} ${t.author.lastName??""}`.trim().toLowerCase():"",Q=t.author?.nmbr??"",T=(t.caption??"").toLowerCase(),K=t.texts.map(R=>R.content).join(" ").toLowerCase();return i.includes(a)||Q.includes(a)||T.includes(a)||K.includes(a)}):g,I=s==="posts"?r?"No matching posts":"No posts yet":s==="saved"?r?"No matching saved posts":"No saved posts yet":r?"No matching liked posts":"No liked posts yet",E=s==="posts"?r?"Try a different search":n?"Your posts will appear here":`${v} hasn't posted yet`:s==="saved"?r?"Try a different search":"Posts you save will appear here":r?"Try a different search":"Posts you like will appear here";return e.jsxs(H,{className:"h-full pb-[100px] bg-background flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"bg-background pt-safe-20 px-6 pb-4 border-b border-white/5 shrink-0 z-30",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!n&&e.jsx(m,{variant:"outline",size:"icon",onClick:()=>c(`/user/${o}`),className:"shrink-0 text-zinc-400 bg-zinc-500/10 border-zinc-500/20 hover:bg-zinc-500/20","data-testid":"button-back",children:e.jsx(X,{className:"w-4 h-4"})}),e.jsx("h1",{className:"text-3xl font-bold","data-testid":"text-page-title",children:A})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ee,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(J,{placeholder:"Search posts...",value:r,onChange:t=>S(t.target.value),className:"pl-9 bg-white/5 border-white/10","data-testid":"input-search-feeds"})]}),e.jsxs(m,{variant:"ghost",size:"sm",onClick:F,className:"text-purple-400 hover:text-purple-300 hover:bg-purple-500/10 gap-1 h-9 px-3 shrink-0","data-testid":"button-ask-nmbr-feeds",children:[e.jsx(w,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:"Ask nmbr"})]})]}),n&&e.jsxs(m,{variant:"outline",className:"w-full text-purple-400 bg-purple-500/10 border-purple-500/20 hover:bg-purple-500/20 mt-4",onClick:()=>f(!0),"data-testid":"button-new-post",children:[e.jsx(te,{className:"w-4 h-4 mr-2"}),"Start A New Post"]}),n&&e.jsxs("div",{className:"flex items-center justify-center gap-8 mt-4 border-t border-white/5 pt-3",children:[e.jsxs("button",{onClick:()=>p("posts"),className:`flex flex-col items-center gap-1 pb-1 border-b-2 transition-colors ${s==="posts"?"border-purple-400 text-purple-400":"border-transparent text-white/40"}`,"data-testid":"tab-posts",children:[e.jsx(re,{size:22}),e.jsx("span",{className:"text-xs font-medium",children:"Posts"})]}),e.jsxs("button",{onClick:()=>p("saved"),className:`flex flex-col items-center gap-1 pb-1 border-b-2 transition-colors ${s==="saved"?"border-purple-400 text-purple-400":"border-transparent text-white/40"}`,"data-testid":"tab-saved",children:[e.jsx(k,{size:22}),e.jsx("span",{className:"text-xs font-medium",children:"Saved"})]}),e.jsxs("button",{onClick:()=>p("liked"),className:`flex flex-col items-center gap-1 pb-1 border-b-2 transition-colors ${s==="liked"?"border-purple-400 text-purple-400":"border-transparent text-white/40"}`,"data-testid":"tab-liked",children:[e.jsx(P,{size:22}),e.jsx("span",{className:"text-xs font-medium",children:"Liked"})]})]}),!n&&e.jsx("div",{className:"h-10 mt-4"})]}),l.isLoading?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(y,{size:28,className:"animate-spin text-white/40"})}):N.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 text-center",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-white/5 flex items-center justify-center mb-6",children:s==="saved"?e.jsx(k,{size:36,className:"text-white/20"}):s==="liked"?e.jsx(P,{size:36,className:"text-white/20"}):e.jsx(w,{size:36,className:"text-white/20"})}),e.jsx("h2",{className:"text-xl font-semibold text-white mb-2","data-testid":"text-empty-grid",children:I}),e.jsx("p",{className:"text-white/40 text-sm",children:E})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"grid grid-cols-3 gap-[2px]",children:N.map(t=>e.jsxs("button",{onClick:()=>{c(s==="posts"?`/feed/user/${o}/${t.id}`:`/feed/user/${t.authorId}/${t.id}`)},className:"relative aspect-[3/4] bg-zinc-900 overflow-hidden","data-testid":`card-post-${t.id}`,children:[t.type==="image"&&t.media[0]&&e.jsx("img",{src:t.media[0].mediaUrl,alt:"",loading:"lazy",className:"absolute inset-0 w-full h-full object-cover"}),t.type==="video"&&e.jsxs("div",{className:"absolute inset-0 bg-black flex items-center justify-center",children:[t.media[0]?.thumbnailUrl?.trim()&&e.jsx("img",{src:Y(t.media[0].thumbnailUrl)||t.media[0].thumbnailUrl,alt:"",loading:"lazy",className:"absolute inset-0 w-full h-full object-cover"}),e.jsx("div",{className:"relative w-10 h-10 rounded-full bg-white/20 flex items-center justify-center",children:e.jsx(se,{size:20,className:"text-white ml-0.5"})})]}),t.type==="text"&&e.jsx("div",{className:"absolute inset-0 bg-white/5 border border-white/10 flex items-center justify-center p-3",children:e.jsx("div",{className:"text-xs text-white/80 text-center line-clamp-4 leading-relaxed font-light whitespace-pre-wrap",children:W(t.texts[0]?.content||t.caption||"")})})]},t.id))}),l.hasNextPage&&!r&&e.jsx("div",{className:"flex justify-center py-6",children:e.jsx(m,{variant:"outline",size:"sm",onClick:()=>l.fetchNextPage(),disabled:l.isFetchingNextPage,className:"border-white/10 text-white/60 hover:text-white hover:bg-white/5 gap-2","data-testid":"button-load-more",children:l.isFetchingNextPage?e.jsxs(e.Fragment,{children:[e.jsx(y,{size:14,className:"animate-spin"}),"Loading..."]}):"Load More"})})]}),e.jsx(Z,{children:$&&e.jsx(V,{onClose:()=>f(!1)})})]})}export{Ce 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.