Files
appco_dist/.output/public/_nuxt/BkfqMY9L.js
T
2025-08-24 13:00:31 +03:30

2 lines
6.1 KiB
JavaScript

import{d as L,u as N,H as O,r as $,o as T,ap as j,y as u,z as m,C as p,A as s,I as t,D as C,a5 as R,a6 as V,F as U,ar as b,aa as q,an as A,B as c,K as F,U as P,E as z,J as B,L as H,a$ as J}from"./BYv1load.js";import{e as I}from"./DWEdiVkG.js";import{f as K}from"./DpM3tgat.js";import{S as W,a as G}from"./C4k1TTnq.js";/* empty css *//* empty css */import{P as Q}from"./C-mFdmjM.js";import{i as M}from"./11yttv_H.js";import{B as D}from"./D-ODqOh1.js";import{_ as X}from"./DlAUqK2U.js";import{_ as Y}from"./BoSlxJZ1.js";import{b as Z,a as ee,e as se}from"./uNkX2JKs.js";import{C as te}from"./BdncHQdI.js";const oe={class:"mt-.5rem"},ie={key:0,class:"video-container"},ne=["src"],ae={key:1,class:"w-full aspect-square flex items-center"},re=["alt"],le={class:"font-semibold text-xs"},de={class:"flex items-center"},ce={class:"text-xs"},pe=L({__name:"Content",props:{media:{},name:{},id:{},scrollSave:{}},setup(k){const _=N(),f=O(),i=k,v=$([]);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}})}T(()=>{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);v.value.forEach(d=>{g.observe(d)})});const h=[Q];return(r,l)=>{const g=j("lazy");return m(),u("div",oe,[p(t(W),{pagination:!0,modules:h,class:"postConfig !h-unset !aspect-square !m-unset"},{default:C(()=>[(m(!0),u(R,null,V(r.media,d=>(m(),U(t(G),{class:"!w-full !h-unset !aspect-square"},{default:C(()=>[d.type==="video"?(m(),u("div",ie,[s("video",{ref_for:!0,ref_key:"videos",ref:v,src:t(b)(d.url),playsinline:"",muted:"",loop:"",class:"video"},null,8,ne)])):(m(),u("div",ae,[q(s("img",{alt:t(A),class:"w-full"},null,8,re),[[g,{src:t(b)(d.url),loading:t(M),error:t(M)}]])]))]),_: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",le,c(r.name),1),s("div",de,[s("div",ce,c(t(f).useString("viewProduct")),1),p(D,{icon:t(f).isRTL?"vuesax-linear:arrow-left-1":"vuesax-linear:arrow-right-1",size:"16"},null,8,["icon"])])])])}}}),me=X(pe,[["__scopeId","data-v-8e4a6eda"]]),ue=["id"],fe={class:"flex px-3 items-center justify-between"},ve={alt:"instagram",class:"w-2rem h-2rem rounded-full"},he={class:"ms-2"},_e={class:"text-sm font-semibold"},ge={key:0},ye={class:"p-4"},we={class:"flex gap-4 items-center justify-between"},$e={class:"flex items-center gap-4"},ke=["aria-disabled"],Se={class:"mt-2 text-sm"},xe={class:"font-semibold font-iran-sans text-sm ms1"},Ce={class:"ms-2 font-iran-sans text-caption whitespace-pre-line"},be={class:"text-xs mt-1 text-gray-500"},E=100,Pe=L({__name:"Post",props:{post:{},index:{},scrollSave:{},addLikeLoading:{type:Boolean}},emits:["openOption","openComment","handleLike","handleSave"],setup(k,{emit:_}){const f=N(),i=_,v=O(),n=$({}),h=F(),r=e=>e?.length>E;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:`${v.lang==="fa"?`${B.fa} | ${o}`:`${B.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,E)+"...":e;return(e,o)=>{const S=j("lazy");return m(),u("div",{class:"w-full mb-2",id:"post-"+e.post.id},[s("div",fe,[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}}))},[q(s("img",ve,null,512),[[S,{src:t(b)(e.post?.users?.avatar),loading:t(I),error:t(I)}]]),s("div",he,[s("div",_e,c(e.post?.users?.username),1)])]),e.post?.users?.id===t(h).user?.id?(m(),u("div",ge,[p(D,{icon:"vuesax-linear:more",class:"rotate-90",size:"18",onClick:o[1]||(o[1]=a=>l(e.post.id))})])):P("",!0)]),p(me,{media:e.post?.files,name:e.post.title_fa,id:e.post.id,scrollSave:e.scrollSave},null,8,["media","name","id","scrollSave"]),s("div",ye,[s("div",we,[s("div",$e,[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))},[p(Y,{"is-liked":e.post.likes?.some(a=>a.user_id===t(h).user?.id)},null,8,["is-liked"]),z(" "+c(e.post?.likes?.length??0),1)],8,ke),s("div",{class:"flex items-center gap-1",onClick:o[3]||(o[3]=a=>g(e.post.id))},[p(Z),z(" "+c(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))},[p(ee)])]),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))},[p(se,{"is-saved":e.post.saved?.some(a=>a.user_id===t(h).user?.id)},null,8,["is-saved"])])]),s("div",Se,[s("span",xe,c(e.post?.users?.username),1),s("span",Ce,c(n.value[e.index]?e.post?.description:w(e.post?.description)),1),r(e.post?.description)?(m(),u("span",{key:0,class:"text-gray cursor-pointer ms-1 whitespace-pre-line",onClick:o[6]||(o[6]=a=>y(e.index))},c(n.value[e.index]?t(v).useString("less"):t(v).useString("more")),1)):P("",!0),s("div",be,c(t(K)(e.post?.created_at)),1)])])],8,ue)}}}),Fe=Object.assign(Pe,{__name:"Post"}),Le=["width","height"],ze=["y"],Be=["y"],He=L({__name:"PostCardSkeleton",setup(k){const _=$(!1),f=$(null),i=H(J(f,{width:0,height:0},{box:"border-box"}));return T(async()=>{_.value=!0}),(v,n)=>_.value?(m(),u("div",{key:0,ref_key:"skeletonRatio",ref:f,class:"h-fit"},[p(t(te),{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,Le),s("rect",{x:"20",y:Math.max(0,i.width-10),rx:"0",ry:"0",width:300,height:10},null,8,ze),s("rect",{x:"20",y:Math.max(0,i.width+10),rx:"0",ry:"0",width:300,height:8},null,8,Be)]),_:1,__:[0,1]},8,["width"])],512)):P("",!0)}});export{Fe as P,He as _};