PageSourceSearch

https://rubpage.com/assets/DashboardFeedPage-BXPY7IbS.js

js rubpage.com collected 2026-09-25 06:31:35 UTC 11,828 bytes, 6 lines download raw bytes

1import{j as e,u as T}from"./vendor-query-nkyHp8gL.js";import{r as c,L as P}from"./vendor-react-BNT0nzvx.js";import{D as z}from"./DashboardLayout-BQArLa03.js";import{a as A,b as E,d as R}from"./use-feed-CkPuES6R.js";import{W as q,h as I,n as F,B as b,s as D,ao as $,i as M,x as C,X as B}from"./index-BG1hbjB_.js";import{u as _}from"./use-role-guard-DUkhNAMS.js";import{u as H}from"./use-membership-YLjjDefL.js";import{s as G}from"./content-sanitizer-Ctif98Tc.js";import{T as O}from"./textarea-FN-yk0h5.js";import{S as V,a as U,b as W,c as X,d as Y}from"./select-BUhc_2te.js";import{N as k}from"./newspaper-CxHmHB1y.js";import{L as K}from"./lock-D3JPNhoF.js";import{C as Q}from"./crown-CsNa2Jyx.js";import{E as J}from"./eye-CbHUV7pU.js";import{T as Z}from"./trending-up-KUKOQM9c.js";import{P as ee}from"./pen-line-Ci5LfM3m.js";import{S as se}from"./send-Bg3nY7h4.js";import{I as te}from"./image-plus-BGJcn1h3.js";import{T as re}from"./trash-2-D8mh_ZKl.js";import{f as ae}from"./formatDistanceToNow-CKXtw6Zh.js";import"./input-otp-BmijqesX.js";import"./shield-check-BjMYzFta.js";import"./shield-D2cqmhBs.js";import"./chevron-right-Bjkf53ML.js";import"./mail-check-D7o3uZkb.js";import"./users-qXgsJLD-.js";import"./target-DCR3Hpgj.js";import"./list-CCtzf_Gh.js";import"./flag-BAn4BLiN.js";import"./vendor-ui-DPPUfW-O.js";import"./vendor-charts-B_MCcq71.js";import"./vendor-supabase-BRDBMtg7.js";import"./index-BdQq_4o_.js";import"./index-DcdyMenS.js";import"./chevron-up-oKYrdNHl.js";import"./check-YdSavKRT.js";import"./en-US-Dli8qwSn.js";import"./endOfMonth-DyeqHD7u.js";/**
2 * @license lucide-react v0.462.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 ie=q("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]),w=500,L=4,ne=()=>{const{user:t}=I();return T({queryKey:["user-role-meta",t?.id],enabled:!!t,staleTime:5*60*1e3,queryFn:async()=>{const{data:u}=await D.from("user_roles").select("role").eq("user_id",t.id);return(u?.map(a=>a.role)??[]).includes("admin")?"admin":null}})},oe=({onCreateClick:t})=>e.jsxs("div",{className:"border border-border rounded-lg bg-card p-6 text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:e.jsx(k,{className:"w-7 h-7 text-primary"})}),e.jsx("h2",{className:"text-lg font-semibold text-foreground mb-1",children:"Your Social Feed"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-5",children:"Share updates with clients who follow your listings"}),e.jsxs("div",{className:"grid gap-3 text-left max-w-sm mx-auto mb-6",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-secondary flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(J,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Visible on your profile"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'Posts appear as "Recent Updates" on your listing page'})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-secondary flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(ie,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Subscribers get notified"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Clients who saved you see your new posts in their Feed"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-secondary flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(Z,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Boost your listing ranking"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Fresh content signals activity and improves visibility"})]})]})]}),e.jsxs(b,{onClick:t,size:"lg",children:[e.jsx(ee,{className:"w-4 h-4 mr-2"}),"Create Your First Post"]})]}),le=({autoExpand:t})=>{const{data:u}
6=$(),r=E(),{toast:a}=M(),[n,m]=c.useState(""),[o,h]=c.useState(""),[l,d]=c.useState([]),[N,x]=c.useState(t??!1);c.useEffect(()=>{t&&x(!0)},[t]);const p=(u??[]).filter(s=>s.activated&&s.published),g=p.find(s=>s.id===o);if(p.length===0)return e.jsx("div",{className:"border border-border rounded-lg bg-card mb-6 p-4",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["You need an active listing to post. ",e.jsx(P,{to:"/dashboard/listings",className:"text-primary hover:underline",children:"Manage listings →"})]})});const f=g?.images?.filter(Boolean)??[],v=s=>{const i=G(s);i.length<=w&&m(i)},j=s=>{d(i=>i.includes(s)?i.filter(y=>y!==s):i.length<L?[...i,s]:i)},S=async()=>{if(!n.trim()){a({title:"Post content is required",variant:"destructive"});return}if(!o){a({title:"Please select a listing to post as",variant:"destructive"});return}try{await r.mutateAsync({content:n.trim(),listing_id:o||null,images:l}),a({title:"Post published!"}),m(""),h(""),d([]),x(!1)}catch(s){a({title:"Failed to post",description:s.message,variant:"destructive"})}};return e.jsx("div",{className:"border border-border rounded-lg bg-card mb-6",children:e.jsx("div",{className:"p-4",children:N?e.jsxs("div",{className:"space-y-3",children:[p.length>0&&e.jsxs(V,{value:o,onValueChange:h,children:[e.jsx(U,{className:"h-9",children:e.jsx(W,{placeholder:"Post as listing..."})}),e.jsx(X,{children:p.map(s=>e.jsx(Y,{value:s.id,children:C(s.title)},s.id))})]}),e.jsx(O,{value:n,onChange:s=>v(s.target.value),placeholder:"Write your update... (no HTML or emojis)",className:"min-h-[100px] resize-none",maxLength:w,autoFocus:!0}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:`text-xs ${n.length>w-50?"text-destructive":"text-muted-foreground"}`,children:[n.length,"/",w]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>{x(!1),m(""),h(""),d([])},children:"Cancel"}),e.jsxs(b,{size:"sm",onClick:S,disabled:!n.trim()||!o||r.isPending,children:[r.isPending?e.jsx(F,{className:"w-4 h-4 animate-spin mr-1"}):e.jsx(se,{className:"w-4 h-4 mr-1"}),"Post"]})]})]}),o&&f.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-1.5",children:[e.jsx(te,{className:"w-3.5 h-3.5 inline mr-1"}),"Attach photos (",l.length,"/",L,")"]}),e.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:f.map((s,i)=>{const y=l.includes(s);return e.jsxs("button",{type:"button",onClick:()=>j(s),className:`relative aspect-square rounded-md overflow-hidden border-2 transition-all ${y?"border-primary ring-2 ring-primary/20":"border-border hover:border-primary/40"}`,children:[e.jsx("img",{src:s,alt:"Selected photo",className:"w-full h-full object-cover"}),y&&e.jsx("div",{className:"absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-primary text-primary-foreground flex items-center justify-center",children:e.jsx(B,{className:"w-2.5 h-2.5"})})]},i)})})]})]}):e.jsx("button",{onClick:()=>x(!0),className:"w-full text-left text-sm text-muted-foreground bg-secondary/50 rounded-lg px-4 py-3 hover:bg-secondary transition-colors",children:"What's new? Share an update..."})})})},de=({post:t,isOwn:u})=>{const r=t.listing,a=r?.images?.[0]??"/placeholder.svg",n=t.images?.filter(Boolean)??[],m=R(),{toast:o}=M(),h=async()=>{try{await m.mutateAsync(t.id),o({title:"Post deleted"})}catch(l){o({title:"Delete failed",description:l.message,variant:"destructive"})}};return e.jsxs("article",{className:"border border-border rounded-lg bg-card overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 pb-2",children:[r?e.jsx(P,{to:`/profile/${r.slug}`,className:"shrink-0",children:e.jsx("img",{src:a,alt:`${C(r.title)} body rub provider`,className:"w-10 h-10 rounded-full object-cover"})}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:e.jsx(k,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[r?e.jsx(P,{to:`/profile/${r.slug}`,className:"text-sm font-semibold text-foreground hover:text-primary truncate block",children:C(r.title)}):e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Post"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:ae(new Date(t.created_at),{addSuffix:!0})})]}),u&&e.jsx(b,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive shrink-0",onClick:h,disabled:m.isPending,children:e.jsx(re,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:t.content})}),n.length>0&&e.jsx("div",{className:`grid gap-0.5 ${n.length===1?"grid-cols-1":"grid-cols-2"}`,children:n.map((l,d)=>e.jsx("img",{src:l,alt:`${r?C(r.title):"Provider"} body rub post photo ${d+1}`,className:"w-full aspect-square object-cover",loading:"lazy"},d))})]})},Xe=()=>{const{user:t}=I(),{isAdvertiser:u,isClient:r}=_();ne();const a=u&&!r,{hasMembership:n,isLoading:m}=H(),[o,h]=c.useState(!1),{data:l,fetchNextPage:d,hasNextPage:N,isFetchingNextPage:x,isLoading:p}=A(),g=l?.pages.flat()??[],f=c.useRef(null),v=c.useCallback(s=>{s[0].isIntersecting&&N&&!x&&d()},[d,N,x]);c.useEffect(()=>{const s=f.current;if(!s)return;const i=new IntersectionObserver(v,{threshold:.1});return i.observe(s),()=>i.disconnect()},[v]);const j=!a&&!m&&!n,S=j?g.slice(0,3):g;return e.jsx(z,{children:e.jsxs("div",{className:"max-w-[640px] mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(k,{className:"w-6 h-6 text-primary"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Feed"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a?"Share updates with your audience":"Latest updates from advertisers"})]})]}),p?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(F,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):a&&g.length===0&&!o?e.jsx(oe,{onCreateClick:()=>h(!0)}):e.jsxs(e.Fragment,{children:[a&&e.jsx(le,{autoExpand:o}),g.length===0&&!a?e.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[e.jsx(k,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"text-sm",children:"No posts yet"}),e.jsx("p",{className:"text-xs mt-1",children:"Check back soon for updates"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:S.map(s=>
6e.jsx(de,{post:s,isOwn:s.author_id===t?.id},s.id))}),j&&g.length>3&&e.jsxs("div",{className:"relative mt-4",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent via-background/80 to-background z-10"}),e.jsxs("div",{className:"relative z-20 text-center py-12",children:[e.jsx(K,{className:"w-8 h-8 text-muted-foreground mx-auto mb-3"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground mb-1",children:"Subscribe to unlock the Feed"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Get unlimited access to all advertiser updates"}),e.jsx(b,{asChild:!0,children:e.jsxs(P,{to:"/dashboard/membership",children:[e.jsx(Q,{className:"w-4 h-4 mr-2"})," View Plans"]})})]})]}),!j&&e.jsx("div",{ref:f,className:"py-8 text-center",children:x&&e.jsx(F,{className:"w-5 h-5 animate-spin mx-auto text-muted-foreground"})})]})]})]})})};export{Xe 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.