PageSourceSearch

https://www.drushimavodot.co.il/assets/PostPage-BiISHj9y.js

js drushimavodot.co.il collected 2026-09-24 15:02:32 UTC 13,208 bytes, 1 lines download raw bytes

1import{r as n,j as e,k as J,e as Q,L as W}from"./react-vendor-zfhxSVDm.js";import{h as O,z as $,B as j,a8 as Z,u as ee,b as te,as as se,cB as ae,e as M,n as re,k as ne}from"./index-BV0-2aDl.js";import{L as ie}from"./LocationChip-oOMI_JZ3.js";import{C as le}from"./ContentContactReveal-BvfixNRa.js";import{S as oe}from"./SafeHtml-CB06hmZf.js";import{A as U,a as R,b as H,g as ce,L as me}from"./LikeButton-CoexOR7a.js";import{S as de}from"./ShareButton-g8BhoStb.js";import{T as ue}from"./textarea-f3SxMAbO.js";import{a as xe,d as pe,b as he,g as fe}from"./commentsService-VTXUQbju.js";import{b as ge,g as be,d as je}from"./postsService-4BpeDPFU.js";import{c as Ne}from"./copyAndOpenGroup-Dlyb0Wuu.js";import{g as K}from"./date-DhoqQ65y.js";import{M as ve}from"./message-circle-DYvwzFmS.js";import{A as we,m as ye}from"./animation-vendor-DuSTuolt.js";import{T as X}from"./trash-2-BHj0qAA9.js";import{S as Ce}from"./send-CNsMpYOM.js";import{C as _e}from"./copy-D68MLBv-.js";import{S as Se}from"./SourceGroupBlock-Dl5XdWfl.js";import"./separator-CCjwB7BO.js";import{u as ke}from"./SourceGroupLine-D1YxyHBl.js";import{b as Te}from"./groupsService-CHiqSHMg.js";import{a as Pe,b as Ae}from"./groupConstants-PDs7t9hY.js";import{p as D}from"./design-BFzSJeXH.js";import{C as Le}from"./clock-Br2vbK-j.js";import{P as Oe}from"./phone-CpcVqBzE.js";import{P as Ee}from"./pencil-DVqfYvpW.js";import"./supabase-vendor-DqO-ystM.js";import"./ui-vendor-DS2gWKbO.js";import"./groupImage-u-SDYXHN.js";import"./imageThumbs-B8jHQgqV.js";import"./contactReferral-BZdZXs0k.js";import"./mail-qKyvuybu.js";import"./heart-qw4Ah3-a.js";import"./shortLinksService-Rv3Tfxr1.js";import"./share-2-BWE_HBO-.js";import"./campaignsService-TF9ozaAF.js";import"./date-vendor-DEheAXb3.js";import"./GroupChannelIcons-C7l5VdYf.js";import"./globe-DiZcc4BL.js";import"./groupsService-DhYyklyK.js";import"./profilesService-DTDHtbqc.js";import"./postStatus-C3JyJ8B4.js";import"./metricsService-CWFE5W0X.js";import"./jobValidUntil--RUMSZUD.js";const Ge=({postId:a,initialCount:i=0,userId:r,userProfile:m,defaultOpen:g=!1,alwaysOpen:t=!1})=>{const[u,x]=n.useState(g||t),[N,S]=n.useState(null),[k,v]=n.useState([]),[w,y]=n.useState(i),[C,T]=n.useState(!1),[h,P]=n.useState(""),[f,A]=n.useState(!1);n.useEffect(()=>{if(!u||!a)return;let s=!1;return(async()=>{T(!0);try{const d=await he(a);s||(v(d),y(d.length))}catch{}finally{s||T(!1)}})(),()=>{s=!0}},[u,a]);const L=n.useCallback(s=>{s.stopPropagation(),x(o=>!o)},[]),_=n.useCallback(async s=>{if(s.stopPropagation(),s.preventDefault(),!r){O("יש להתחבר כדי להגיב");return}const o=h.trim();if(!(!o||f)){A(!0);try{const d=await xe(a,r,o);v(p=>[...p,d]),y(p=>p+1),P(""),ge(a).then(p=>{p&&S({url:p,text:o})}).catch(()=>{})}catch{O("שגיאה בהוספת תגובה")}finally{A(!1)}}},[a,r,h,f]),b=n.useCallback(async s=>{try{await pe(s),v(o=>o.filter(d=>d.id!==s)),y(o=>Math.max(0,o-1))}catch{O("שגיאה במחיקת תגובה")}},[]);return e.jsxs("div",{onClick:s=>s.stopPropagation(),children:[!t&&e.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 p-2 rounded-full transition-colors duration-200 hover:bg-blue-50 text-muted-foreground hover:text-blue-500","aria-label":"תגובות",children:[e.jsx(ve,{className:"h-5 w-5"}),w>0&&e.jsx("span",{className:"text-xs font-medium",children:w})]}),e.jsx(we,{children:u&&e.jsx(ye.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden border-t border-border mt-2",children:e.jsxs("div",{className:"pt-4 px-4 pb-4 space-y-4",children:[C&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx($,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!C&&k.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"אין תגובות עדיין. היו הראשונים להגיב!"}),!C&&k.map(s=>e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(U,{className:"h-8 w-8 shrink-0",children:[e.jsx(R,{src:s.author?.profile_image}),e.jsx(H,{className:"text-xs bg-muted",children:(s.author?.full_name||"?").charAt(0).toUpperCase()})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-semibold",children:s.author?.full_name||"משתמש"}),e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:K(s.created_at)})]}),e.jsx("p",{className:"text-sm mt-1 whitespace-pre-line",children:s.content})]}),s.user_id===r&&e.jsxs("button",{onClick:()=>b(s.id),className:"text-xs text-muted-foreground hover:text-red-500 mt-1 me-2 transition-colors",children:[e.jsx(X,{className:"h-3 w-3 inline me-1"}),"מחק"]})]})]},s.id)),r&&e.jsxs("form",{onSubmit:_,className:"flex gap-3 items-start",children:[e.jsxs(U,{className:"h-8 w-8 shrink-0",children:[e.jsx(R,{src:m?.profile_image}),e.jsx(H,{className:"text-xs bg-muted",children:(m?.full_name||"?").charAt(0).toUpperCase()})]}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(ue,{value:h,onChange:s=>P(s.target.value),placeholder:"תגובה...",className:"min-h-[40px] max-h-[120px] pr-10 resize-none text-sm",dir:"rtl",onKeyDown:s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),_(s))}}),e.jsx(j,{type:"submit",size:"icon",variant:"ghost",disabled:!h.trim()||f,className:"absolute start-1 top-1 h-8 w-8",children:f?e.jsx($,{className:"h-4 w-4 animate-spin"}):e.jsx(Ce,{className:"h-4 w-4"})})]})]}),!r&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"יש להתחבר כדי להגיב"}),N&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-lg border border-slate-200 bg-slate-50 p-3",children:[e.jsx("span",{className:"text-sm font-semibold text-slate-700",children:"להעתיק את התגובה גם לפוסט בקבוצה?"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(j,{size:"sm",onClick:()=>Ne({url:N.url,text:N.text}),className:"h-7 text-xs bg-orange-500 hover:bg-orange-600 text-white",children:[e.jsx(_e,{className:"w-3 h-3 me-1"}),"העתק ופתח"]}),e.jsx(j,{size:"icon",variant:"ghost",onClick:()=>S(null),className:"h-7 w-7","aria-label":"סגירה",children:e.jsx(Z,{className:"h-3.5 w-3.5"})})]})]})]})})})]})},De=a=>Array.isArray(a.cta_buttons)&&a.cta_buttons.length>0?a.cta_buttons.filter(i=>i.text&&i.url):a.cta_button?.enabled&&a.cta_button.text&&a.cta_button.url?[{text:a.cta_button.text,url:a.cta_button.url}]:[],z=a=>(a||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),I=a=>`<a href="${z(a.url)}" target="_blank" rel="noopener noreferrer" class="cta-inline-btn">${z(a.text)}</a>
1`,Ie=(a,i)=>{if(!a||i.length===0)return a;let r=a;const m=new Set;r=r.replace(/\[CTA:(\d+)\]/g,(t,u)=>{const x=parseInt(u,10);return x>=0&&x<i.length?(m.add(x),I(i[x])):""}),r=r.replace(/\[CTA\]/g,()=>{for(let t=0;t<i.length;t+=1)if(!m.has(t))return m.add(t),I(i[t]);return""});const g=i.filter((t,u)=>!m.has(u));return g.length>0&&(r+=`<div class="cta-buttons-row">${g.map(I).join("")}</div>`),r},$e=a=>{const i=String(a||"").trim();return i?/<\/?(p|div|br|ul|ol|li|h[1-6]|blockquote|table|figure|img)\b/i.test(i)?i:i.split(/\n\s*\n/).map(r=>`<p>${z(r.trim()).replace(/\n/g,"<br>")}</p>`).join(""):""},q=["bg-gradient-to-br","bg-gradient-to-tl","bg-gradient-to-tr"],ze=new Set(["main","recruiters"]);function Pt(){const{postId:a}=J(),i=Q(),{currentUser:r,isLoadingUser:m}=ee(),{openEditPost:g}=te(),[t,u]=n.useState(null),[x,N]=n.useState([]),[S,k]=n.useState(!1),[v,w]=n.useState(!1),[y,C]=n.useState(0),[T,h]=n.useState(!0),[P,f]=n.useState(null),[A,L]=n.useState(!1);n.useEffect(()=>{if(m)return;let c=!0;return h(!0),f(null),Promise.all([be(a),Te().catch(()=>[])]).then(async([l,E])=>[l&&await se(M.POST,l,r)?l:null,E]).then(([l,E])=>{c&&(u(l||null),N(E||[]),l?.id&&ae(M.POST,l.id),l?.id&&(fe([l.id]).then(G=>{c&&C(G.get(l.id)||0)}).catch(()=>{}),r?.id&&ce(r.id,"post",[l.id]).then(G=>{c&&k(G.has(l.id))}).catch(()=>{})))}).catch(l=>{c&&f("התוכן לא נמצא")}).finally(()=>{c&&h(!1)}),()=>{c=!1}},[a,r?.id,r?.is_test_user,m]);const _=n.useMemo(()=>Object.fromEntries(x.map(c=>[c.id,c])),[x]),b=n.useMemo(()=>{for(const c of t?.target_groups||[]){const l=_[c];if(l?.is_internal&&l.slug&&!ze.has(l.slug))return l}return null},[t,_]),s=!!t&&!t.owner_user_id,o=ke(s,"article",t?.id),d=!!r&&!!t?.owner_user_id&&t.owner_user_id===r.id,p=n.useMemo(()=>t?Ie($e(t.content),De(t)):"",[t]);re(t?{title:t.title||"תוכן",description:(t.summary||(t.content||"").replace(/<[^>]*>/g,"")).slice(0,160)}:{title:"תוכן"});const F=async()=>{if(confirm("למחוק את התוכן? פעולה זו לא ניתנת לביטול.")){L(!0);try{await je(t.id),ne("התוכן נמחק"),i("/content")}catch{O("שגיאה במחיקת התוכן"),L(!1)}}};if(T)return e.jsx("div",{className:`${D.brand} flex items-center justify-center py-24`,dir:"rtl",children:e.jsx($,{className:"h-8 w-8 animate-spin text-brand-navy"})});if(P||!t)return e.jsxs("div",{className:`${D.brand} px-4 py-24 text-center`,dir:"rtl",children:[e.jsx("p",{className:"text-lg font-bold text-brand-navy",children:"התוכן לא נמצא"}),e.jsx(W,{to:"/content",className:"mt-3 inline-block text-sm font-semibold text-brand-blue hover:underline",children:"לכל התכנים"})]});const V=b&&Pe[b.name]||"from-purple-500 via-violet-500 to-fuchsia-500",Y=q[(t.title||"").length%q.length],B=!!t.image_url;return e.jsxs("div",{className:`${D.brand} p-0 md:p-6`,dir:"rtl",children:[e.jsx("div",{className:"mx-auto max-w-5xl px-4 pt-3 md:px-6 md:pt-0",children:e.jsx(ie,{targetGroups:t.target_groups,current:t.title||"תוכן"})}),e.jsx("div",{className:"mx-auto mt-4 max-w-5xl px-4 pb-12 md:px-6",children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_300px] md:grid-rows-[auto_1fr] md:gap-x-6",children:[e.jsxs("header",{className:"overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm md:col-start-1 md:row-start-1",children:[B?e.jsxs("div",{className:"relative h-64 overflow-hidden bg-slate-900 md:h-80",children:[e.jsx("img",{src:t.image_url,alt:"","aria-hidden":"true",className:"absolute inset-0 h-full w-full scale-110 object-cover opacity-60 blur-2xl"}),e.jsx("img",{src:t.image_url,alt:t.title||"",className:"relative h-full w-full object-contain"})]}):e.jsxs("div",{className:`relative h-44 md:h-56 ${Y} ${V}`,children:[e.jsx("div",{className:"absolute inset-x-0 bottom-0 h-2/3 bg-gradient-to-t from-black/45 to-transparent"}
1),b&&e.jsx("span",{className:"absolute end-4 top-4 rounded-full bg-white/20 px-3 py-1 text-xs font-bold text-white backdrop-blur-sm",children:Ae(b.name)}),e.jsx("h1",{className:"absolute inset-x-5 bottom-5 text-2xl font-extrabold leading-tight text-white line-clamp-3 md:text-3xl",children:t.title})]}),e.jsxs("div",{className:"space-y-2 p-5",children:[B&&e.jsx("h1",{className:"text-2xl font-extrabold leading-tight text-brand-navy md:text-3xl",children:t.title}),e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-slate-500",children:[e.jsx(Le,{className:"h-4 w-4 text-brand-blue"}),K(t.created_at)]})]})]}),e.jsxs("aside",{className:"space-y-4 rounded-2xl border border-slate-200 bg-white p-5 shadow-sm md:sticky md:top-4 md:col-start-2 md:row-span-2 md:row-start-1 md:self-start",children:[s&&o?.name?e.jsxs("div",{children:[e.jsx(Se,{typeLabel:"תוכן",kind:"article",itemId:t.id,targetGroups:t.target_groups,alsoLabel:"הופיע גם ב:"}),e.jsxs(j,{size:"sm",className:"mt-3 w-full gap-2",onClick:()=>w(!0),children:[e.jsx(Oe,{className:"h-4 w-4"}),"פרטי המפרסם"]}),e.jsx(le,{open:v,onClose:()=>w(!1),contentType:"post",contentId:t.id,itemTitle:t.title})]}):t.author_name?e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500",children:"מאת"}),e.jsx("p",{className:"text-base font-bold text-brand-navy",children:t.author_name})]}):null,e.jsxs("div",{className:"flex items-center gap-1 border-t border-slate-100 pt-4",children:[e.jsx(de,{contentType:"post",contentId:t.id,title:t.title}),e.jsx(me,{contentType:"post",contentId:t.id,liked:S,userId:r?.id})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 border-t border-slate-100 pt-4",children:[e.jsxs(j,{variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>g(t.id),children:[e.jsx(Ee,{className:"h-3.5 w-3.5"}),"עריכה"]}),e.jsxs(j,{variant:"ghost",size:"sm",className:"gap-1.5 text-red-600 hover:text-red-700",disabled:A,onClick:F,children:[e.jsx(X,{className:"h-3.5 w-3.5"}),"מחיקה"]})]})]}),e.jsxs("section",{className:"rounded-2xl border border-slate-200 bg-white p-5 shadow-sm md:col-start-1 md:row-start-2 md:p-6",children:[p?e.jsx(oe,{html:p,className:"rich-content text-start text-base leading-8 text-slate-700"}):t.summary?e.jsx("p",{className:"whitespace-pre-line text-base leading-8 text-slate-700",children:t.summary}):null,e.jsx("div",{className:"mt-6 border-t border-slate-100 pt-4",children:e.jsx(Ge,{postId:t.id,initialCount:y,userId:r?.id,userProfile:r,alwaysOpen:!0})})]})]})})]})}export{Pt 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.