Files
appco_dist/.output/public/_nuxt/Da76ymsg.js
T
2026-03-07 13:18:15 +03:30

2 lines
6.3 KiB
JavaScript

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