Files
appco_dist/.output/public/_nuxt/CaqTG2QR.js
T
2025-08-27 20:20:03 +03:30

2 lines
6.0 KiB
JavaScript

import{d as L,u as N,H as E,r as $,o as O,ah as T,y as v,z as u,C as m,A as s,I as t,D as C,a1 as q,a2 as R,F as V,ai as b,a6 as D,B as p,J as A,S as P,E as z,K as F,cD as H}from"./BAjARngS.js";import{e as B}from"./DWEdiVkG.js";import{f as U}from"./4rHVhLBf.js";import{S as J,a as K}from"./DCbXzl7s.js";/* empty css *//* empty css */import{P as W}from"./BehRsHSZ.js";import{i as I}from"./DyFKMDK_.js";import{B as j}from"./sroyubh1.js";import{_ as G}from"./DlAUqK2U.js";import{_ as Q}from"./Bnczqe4x.js";import{b as X,a as Y,e as Z}from"./CWwxf8qh.js";import{C as ee}from"./96trYotg.js";const se={class:"mt-.5rem"},te={key:0,class:"video-container"},oe=["src"],ie={key:1,class:"w-full aspect-square flex items-center"},ne=["alt"],ae={class:"font-semibold text-xs"},re={class:"flex items-center"},le={class:"text-xs"},de=L({__name:"Content",props:{media:{},name:{},id:{},scrollSave:{}},setup(k){const _=N(),f=E(),i=k,c=$([]);function n(r){const l=document.querySelector(".scrollHome");l&&(sessionStorage.setItem(i.scrollSave,l.scrollTop.toString()),console.log("content",l.scrollTop.toString(),i.scrollSave)),_.push({name:"product_detail-id",params:{id:r}})}O(()=>{const r={root:null,rootMargin:"0px",threshold:.5},l=d=>{d.forEach(y=>{const w=y.target;y.isIntersecting?w.play():w.pause()})},g=new IntersectionObserver(l,r);c.value.forEach(d=>{g.observe(d)})});const h=[W];return(r,l)=>{const g=T("lazy");return u(),v("div",se,[m(t(J),{pagination:!0,modules:h,class:"postConfig !h-unset !aspect-square !m-unset"},{default:C(()=>[(u(!0),v(q,null,R(r.media,d=>(u(),V(t(K),{class:"!w-full !h-unset !aspect-square"},{default:C(()=>[d.type==="video"?(u(),v("div",te,[s("video",{ref_for:!0,ref_key:"videos",ref:c,src:t(b)(d.url),playsinline:"",muted:"",loop:"",class:"video"},null,8,oe)])):(u(),v("div",ie,[D(s("img",{alt:t(f).appName.en,class:"w-full"},null,8,ne),[[g,{src:t(b)(d.url),loading:t(I),error:t(I)}]])]))]),_:2},1024))),256))]),_:1}),s("div",{class:"flex bg-[#0195f7] text-white px-3 py-3 items-center justify-between",onClick:l[0]||(l[0]=d=>n(r.id))},[s("div",ae,p(r.name),1),s("div",re,[s("div",le,p(t(f).useString("viewProduct")),1),m(j,{icon:t(f).isRTL?"vuesax-linear:arrow-left-1":"vuesax-linear:arrow-right-1",size:"16"},null,8,["icon"])])])])}}}),ce=G(de,[["__scopeId","data-v-8626c6d0"]]),pe=["id"],me={class:"flex px-3 items-center justify-between"},ue={alt:"instagram",class:"w-2rem h-2rem rounded-full"},fe={class:"ms-2"},ve={class:"text-sm font-semibold"},he={key:0},_e={class:"p-4"},ge={class:"flex gap-4 items-center justify-between"},ye={class:"flex items-center gap-4"},we=["aria-disabled"],$e={class:"mt-2 text-sm"},ke={class:"font-semibold text-sm ms1"},Se={class:"ms-2 text-caption whitespace-pre-line"},xe={class:"text-xs mt-1 text-gray-500"},M=100,Ce=L({__name:"Post",props:{post:{},index:{},scrollSave:{},addLikeLoading:{type:Boolean}},emits:["openOption","openComment","handleLike","handleSave"],setup(k,{emit:_}){const f=N(),i=_,c=E(),n=$({}),h=A(),r=e=>e?.length>M;function l(e){i("openOption",e)}function g(e){i("openComment",e)}async function d(e,o,S){if(navigator.share)try{await navigator.share({title:`${c.lang==="fa"?`${c.appName.fa} | ${o}`:`${c.appName.en} | ${o}`}`,text:`${S}`,url:`${window.location.origin}/product_detail/${e}`})}catch(a){console.error("Sharing failed",a)}else alert("Web Share API not supported in this browser.")}const y=e=>{n.value={...n.value,[e]:!n.value[e]}},w=e=>r(e)?e?.slice(0,M)+"...":e;return(e,o)=>{const S=T("lazy");return u(),v("div",{class:"w-full mb-2",id:"post-"+e.post.id},[s("div",me,[s("div",{class:"flex items-center",onClick:o[0]||(o[0]=a=>t(f).push({name:"user_detail-id",params:{id:e.post?.users?.id}}))},[D(s("img",ue,null,512),[[S,{src:t(b)(e.post?.users?.avatar),loading:t(B),error:t(B)}]]),s("div",fe,[s("div",ve,p(e.post?.users?.username),1)])]),e.post?.users?.id===t(h).user?.id?(u(),v("div",he,[m(j,{icon:"vuesax-linear:more",class:"rotate-90",size:"18",onClick:o[1]||(o[1]=a=>l(e.post.id))})])):P("",!0)]),m(ce,{media:e.post?.files,name:e.post.title_fa,id:e.post.id,scrollSave:e.scrollSave},null,8,["media","name","id","scrollSave"]),s("div",_e,[s("div",ge,[s("div",ye,[s("div",{class:"flex items-center gap-1","aria-disabled":e.addLikeLoading,onClick:o[2]||(o[2]=a=>i("handleLike",e.post.likes?.some(x=>x.user_id===t(h).user?.id),e.post?.id))},[m(Q,{"is-liked":e.post.likes?.some(a=>a.user_id===t(h).user?.id)},null,8,["is-liked"]),z(" "+p(e.post?.likes?.length??0),1)],8,we),s("div",{class:"flex items-center gap-1",onClick:o[3]||(o[3]=a=>g(e.post.id))},[m(X),z(" "+p(e.post?.comments?.length??0),1)]),s("div",{class:"flex items-center gap-1",onClick:o[4]||(o[4]=a=>d(e.post?.id,e.post?.title_fa,e.post?.description))},[m(Y)])]),s("div",{onClick:o[5]||(o[5]=a=>i("handleSave",e.post.saved?.some(x=>x.user_id===t(h).user?.id),e.post?.id))},[m(Z,{"is-saved":e.post.saved?.some(a=>a.user_id===t(h).user?.id)},null,8,["is-saved"])])]),s("div",$e,[s("span",ke,p(e.post?.users?.username),1),s("span",Se,p(n.value[e.index]?e.post?.description:w(e.post?.description)),1),r(e.post?.description)?(u(),v("span",{key:0,class:"text-gray cursor-pointer ms-1 whitespace-pre-line",onClick:o[6]||(o[6]=a=>y(e.index))},p(n.value[e.index]?t(c).useString("less"):t(c).useString("more")),1)):P("",!0),s("div",xe,p(t(U)(e.post?.created_at)),1)])])],8,pe)}}}),Ae=Object.assign(Ce,{__name:"Post"}),be=["width","height"],Pe=["y"],Le=["y"],Fe=L({__name:"PostCardSkeleton",setup(k){const _=$(!1),f=$(null),i=F(H(f,{width:0,height:0},{box:"border-box"}));return O(async()=>{_.value=!0}),(c,n)=>_.value?(u(),v("div",{key:0,ref_key:"skeletonRatio",ref:f,class:"h-fit"},[m(t(ee),{width:i.width,height:"800"},{default:C(()=>[n[0]||(n[0]=s("circle",{cx:30,cy:"30",r:"20"},null,-1)),n[1]||(n[1]=s("rect",{x:"60",y:"25",rx:"3",ry:"3",width:"100",height:"10"},null,-1)),s("rect",{x:"0",y:"60",rx:"0",ry:"0",width:Math.max(100,i.width),height:Math.max(0,i.width-100)},null,8,be),s("rect",{x:"20",y:Math.max(0,i.width-10),rx:"0",ry:"0",width:300,height:10},null,8,Pe),s("rect",{x:"20",y:Math.max(0,i.width+10),rx:"0",ry:"0",width:300,height:8},null,8,Le)]),_:1,__:[0,1]},8,["width"])],512)):P("",!0)}});export{Ae as P,Fe as _};