Files
tehran_tala/apps/user-app/dist/assets/HomeView-BJZDZ1Ex.js
T
s.esmaeiliandClaude Sonnet 5 c05352d6fd refactor(ui): replace modal dialogs with toast/sheet components
Remove DialogVant/NotifyVant and add Toast and Sheet components with
useToast, useReveal, and usePageTransition composables. Rework
Navigation, RegisterView, and styles across both apps; rebuild dist assets.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 13:57:25 +03:30

2 lines
11 KiB
JavaScript

import{_ as ie}from"./Spinner.vue_vue_type_style_index_0_lang-uVHC4xq0.js";import{d as T,o as ne,a as te,c as n,b as a,n as R,F as E,r as H,e as B,f as y,g as I,h as V,i as t,_ as j,t as O,w as re,u as e,j as ce,k as u,I as M,l as ue,m as de,p as le,q as G,s as D,v as se,x as q,L as Q,y as ve}from"./index-CRQPRp-C.js";import{u as _e,S as me}from"./SingleProduct-DKqhvwd1.js";import{R as ge}from"./RateStrip-BOe9RdS_.js";import{u as pe,a as he}from"./cartStore-CIlq1T4-.js";import{S as ae}from"./SectionHead-BjbRzluB.js";import{u as fe}from"./filtersStore-uk8-Faq9.js";import{u as ye}from"./useReveal-CPgwxGZp.js";import{P as be}from"./index-Btu2EoFw.js";import{D as ke}from"./index-BVow2xBt.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./DialogVant.vue_vue_type_style_index_0_lang-DFKmWR5Z.js";import"./dialogEmpty1-E3h_JfwQ.js";import"./filters-CLL9nGZ2.js";import"./classCallCheck-CJTmwORh.js";const we={key:0,class:"showcase"},Se=["onClick"],Ce=["src"],Ie={key:0,class:"showcase__dots"},$e=["aria-label","onClick"],oe=.18,Pe=6,xe=T({__name:"ShowcaseSlider",props:{slides:{}},emits:["select"],setup(l,{emit:g}){const r=l,A=g,d=I(0);let v;function k(o){d.value=o,h()}function h(){v&&clearInterval(v),r.slides.length>1&&(v=setInterval(()=>{d.value=(d.value+1)%r.slides.length},6e3))}ne(h),te(()=>{v&&clearInterval(v)});const $=I(null),p=I(!1),b=I(0);let c=null,P=0,w=0,z=0,C=!1;function U(o){var f;if(r.slides.length<2||c!==null)return;const _=$.value;_&&(c=o.pointerId,P=o.clientX,w=o.clientY,z=_.getBoundingClientRect().width||1,b.value=0,p.value=!0,C=!1,(f=_.setPointerCapture)==null||f.call(_,o.pointerId))}function N(o){if(!p.value||o.pointerId!==c)return;const _=o.clientX-P,f=o.clientY-w;!C&&Math.abs(_)>Math.abs(f)&&Math.abs(_)>Pe&&(C=!0),C&&(b.value=_)}function F(){if(!p.value)return;const _=b.value/z;p.value=!1,c=null,b.value=0,_<=-oe&&d.value<r.slides.length-1?d.value++:_>=oe&&d.value>0&&d.value--,C&&h(),C=!1}function Y(o){o.pointerId===c&&F()}function W(o){o.pointerId===c&&(p.value=!1,c=null,b.value=0,C=!1)}function X(o){C||A("select",o)}const J=V(()=>{const o=-d.value*100,_=z?b.value/z*100:0;return{transform:`translate3d(${o+_}%, 0, 0)`,transition:p.value?"none":void 0}});return te(()=>{if(c!==null&&$.value)try{$.value.releasePointerCapture(c)}catch{}}),(o,_)=>l.slides.length?(t(),n("section",we,[a("div",{ref_key:"root",ref:$,class:B(["showcase__frame",{"is-dragging":p.value}]),onPointerdown:U,onPointermove:N,onPointerup:Y,onPointercancel:W},[a("div",{class:"showcase__track",style:R(J.value)},[(t(!0),n(E,null,H(l.slides,(f,L)=>(t(),n("article",{key:f.key,class:B(["showcase__slide",{"is-active":L===d.value}]),onClick:K=>X(f)},[f.image?(t(),n("img",{key:0,src:f.image,alt:"",class:"showcase__art",draggable:"false"},null,8,Ce)):y("",!0)],10,Se))),128))],4)],34),l.slides.length>1?(t(),n("div",Ie,[(t(!0),n(E,null,H(l.slides,(f,L)=>(t(),n("button",{key:f.key,type:"button",class:B(["showcase__dot",{"is-active":L===d.value}]),"aria-label":f.title,onClick:K=>k(L)},null,10,$e))),128))])):y("",!0)])):y("",!0)}}),De=j(xe,[["__scopeId","data-v-95273507"]]),ze={class:"rail no-scrollbar"},Re=["onClick"],Ae={class:"rail__mark","aria-hidden":"true"},Le=["src"],Me={class:"rail__title"},Be=T({__name:"CategoryRail",props:{categories:{},activeId:{}},emits:["select"],setup(l,{emit:g}){const r=g;return(A,d)=>(t(),n("div",ze,[(t(!0),n(E,null,H(l.categories,v=>{var k;return t(),n("button",{key:v.id,type:"button",class:B(["rail__chip",{"is-active":v.id===l.activeId}]),onClick:h=>r("select",v)},[a("span",Ae,[(k=v.icon)!=null&&k.image?(t(),n("img",{key:0,src:v.icon.image,alt:""},null,8,Le)):y("",!0)]),a("span",Me,O(v.title),1)],10,Re)}),128))]))}}),Fe=j(Be,[["__scopeId","data-v-b5187cde"]]),Ve={class:"card__art"},Oe=["alt"],Xe={key:0,class:"card__badge"},qe={class:"card__body"},Ee={class:"card__title"},He={class:"card__meta"},Ue={class:"card__weight"},Ne={key:0,class:"card__wage"},Ye=T({__name:"ShowcaseCard",props:{value:{},wide:{type:Boolean},badge:{}},emits:["open"],setup(l,{emit:g}){const r=l,A=g,d=_e(),{image:v,id:k,title:h,min_gram:$,wage:p}=pe(r.value),b=V(()=>{const c=p.value;return c==null?"":c%1===0?String(c):c.toFixed(2)});return(c,P)=>{const w=ue("lazy");return t(),n("article",{class:B(["card",{"card--wide":l.wide}]),onClick:P[1]||(P[1]=z=>A("open",l.value))},[a("div",Ve,[re(a("img",{alt:e(h)},null,8,Oe),[[w,e(v)]]),a("button",{type:"button",class:B(["card__fav",{"is-on":e(d).isFavorite(e(k))}]),onClick:P[0]||(P[0]=ce(z=>e(d).toggle(e(k)),["stop"]))},[u(M,{icon:e(d).isFavorite(e(k))?"vuesax-linear:heart-fill":"vuesax-linear:heart",size:"17"},null,8,["icon"])],2),l.badge?(t(),n("span",Xe,O(l.badge),1)):y("",!0)]),a("div",qe,[a("h3",Ee,O(e(h)),1),a("div",He,[a("span",Ue,O(e($))+" گرم",1),e(p)!=null?(t(),n("span",Ne,"اجرت "+O(b.value)+"٪",1)):y("",!0)])])],2)}}}),Z=j(Ye,[["__scopeId","data-v-43c92533"]]),Ge="/assets/shipping-and-delivery-CyUGL93q.png",Te="/assets/sports-and-competition-ao926_SX.png",je=[{type:"popup",src:Ge,text:"ارسال سریع و مطمئن سفارش‌های شما به سراسر کشور.",link:void 0},{type:"popup",src:Te,text:"جدیدترین محصولات منتزر را در بخش محصولات جدید ببینید.",link:void 0},{type:"popup",src:le,text:"منتزر، همراه شما در خرید و فروش طلا.",link:void 0}],We=de("config",{state:()=>({config:{main_slider:je},cats:[],loaded:!1}),actions:{setCats(l){this.cats=l},async init(){try{const l=await G.listProducts(),g=new Map;for(const r of l)r.category&&!g.has(r.category.id)&&g.set(r.category.id,{id:r.category.id,title:r.category.title,icon:{image:le}});this.cats=[...g.values()],this.loaded=!0}catch(l){console.log(l)}}}}),Je={class:"home"},Ke={class:"home__bar"},Qe={class:"home__barInner"},Ze={key:0,class:"home__badge"},et={key:0,class:"home__grid"},tt={class:"home__reel no-scrollbar"},st={class:"home__trustItem"},at={class:"home__trustItem"},ot={class:"home__trustItem"},nt=T({__name:"HomeView",setup(l){const g=ve(),r=We(),A=he(),d=fe(),v=I(!0),k=I(!1),h=I([]),$=I(null),p=I(null),b=I(!1),c=I(null),{revealed:P,revealDelay:w,reveal:z}=ye("home"),C=V(()=>h.value[0]??null),U=V(()=>h.value.slice(1,5)),N=V(()=>h.value.slice(5,13)),F=[{eyebrow:"مجموعه منتزر",cta:"دیدن مجموعه"},{eyebrow:"انتخاب سردبیر",cta:"مشاهده"},{eyebrow:"پیشنهاد این هفته",cta:"بررسی کنید"}],Y=V(()=>{var s;if((s=p.value)!=null&&s.length)return p.value.filter(m=>m.image).map((m,x)=>({key:`${x}-${m.image}`,eyebrow:"مجموعه منتزر",title:"",subtitle:"",cta:"",image:m.image,link:m.link||void 0}));const i=r.cats.slice(0,3);return i.length?i.map((m,x)=>({key:m.id,eyebrow:F[x%F.length].eyebrow,title:m.title,subtitle:"ساخته‌شده از طلای ۱۸ عیار، با اجرت شفاف و اصالت تضمین‌شده.",cta:F[x%F.length].cta,image:W(m.id),categoryId:m.id})):[]});function W(i){var m,x;const s=h.value.find(S=>{var ee;return((ee=S.category)==null?void 0:ee.id)===i});return(x=(m=s==null?void 0:s.images)==null?void 0:m[0])==null?void 0:x.url}function X(i){c.value=i.id,b.value=!0}function J(i){d.query.cats=[i.id],g.push({name:"search"})}function o(i){if(i.link){/^https?:\/\//i.test(i.link)?window.open(i.link,"_blank","noopener"):g.push(i.link);return}i.categoryId&&(d.query.cats=[i.categoryId]),g.push({name:"search"})}function _(){g.push({name:"search"})}function f(){g.push({name:"newestProduct"})}async function L(){try{const[i]=await Promise.all([G.listProducts(),r.init()]);h.value=i}catch(i){console.log(i)}try{$.value=await G.getLatestGoldPrice()}catch{$.value=null}try{p.value=await G.getHomeSlider()}catch{p.value=null}}async function K(){await L(),k.value=!1}return ne(async()=>{await L(),v.value=!1,z()}),(i,s)=>{const m=se("router-link"),x=se("container");return t(),n("div",Je,[a("header",Ke,[a("div",Qe,[u(m,{to:{name:"cart"},class:"home__iconBtn","aria-label":"سبد خرید"},{default:D(()=>[u(M,{icon:"vuesax-linear:bag-2",size:"21"}),e(A).items.length?(t(),n("span",Ze,O(e(A).items.length),1)):y("",!0)]),_:1}),s[3]||(s[3]=a("img",{src:ie,alt:"منتزر",class:"home__logo"},null,-1)),u(m,{to:{name:"search"},class:"home__iconBtn","aria-label":"جستجو"},{default:D(()=>[u(M,{icon:"vuesax-linear:search-normal-1",size:"21"})]),_:1})])]),u(e(be),{modelValue:k.value,"onUpdate:modelValue":s[0]||(s[0]=S=>k.value=S),onRefresh:K},{pulling:D(()=>[u(e(Q),{size:"18"})]),loosing:D(()=>[u(e(Q),{size:"18"})]),loading:D(()=>[u(e(Q),{size:"18"})]),success:D(()=>[...s[4]||(s[4]=[a("span",null,null,-1)])]),default:D(()=>[u(x,{class:B(["home__body",{"is-revealed":e(P)}])},{default:D(()=>[u(ge,{quote:$.value,class:"home__rate reveal",style:R(e(w)(0))},null,8,["quote","style"]),Y.value.length?(t(),q(De,{key:0,slides:Y.value,class:"home__hero reveal",style:R(e(w)(1)),onSelect:o},null,8,["slides","style"])):y("",!0),e(r).cats.length?(t(),q(Fe,{key:1,categories:e(r).cats,"active-id":null,class:"home__rail reveal",style:R(e(w)(2)),onSelect:J},null,8,["categories","style"])):y("",!0),C.value?(t(),n("section",{key:2,class:"home__section reveal",style:R(e(w)(3))},[u(ae,{title:"برگزیده منتزر",subtitle:"انتخاب‌شده از میان مجموعه‌های موجود","action-label":"همه محصولات",onAction:_}),u(Z,{value:C.value,wide:"",badge:"برگزیده",onOpen:X},null,8,["value"]),U.value.length?(t(),n("div",et,[(t(!0),n(E,null,H(U.value,S=>(t(),q(Z,{key:S.id,value:S,onOpen:X},null,8,["value"]))),128))])):y("",!0)],4)):y("",!0),N.value.length?(t(),n("section",{key:3,class:"home__section reveal",style:R(e(w)(4))},[u(ae,{title:"تازه‌ها",subtitle:"آخرین افزوده‌های مجموعه","action-label":"مشاهده همه",onAction:f}),a("div",tt,[(t(!0),n(E,null,H(N.value,S=>(t(),q(Z,{key:S.id,value:S,class:"home__reelItem",onOpen:X},null,8,["value"]))),128))])],4)):y("",!0),!v.value&&!h.value.length?(t(),n("section",{key:4,class:"home__empty reveal",style:R(e(w)(3))},[u(M,{icon:"vuesax-linear:box",size:"26"}),s[5]||(s[5]=a("p",null,"هنوز محصولی در مجموعه ثبت نشده است.",-1))],4)):y("",!0),a("div",{class:"home__trust reveal",style:R(e(w)(5))},[a("div",st,[u(M,{icon:"vuesax-linear:shield-tick",size:"18"}),s[6]||(s[6]=a("span",null,"خرید امن",-1))]),a("div",at,[u(M,{icon:"vuesax-linear:verify",size:"18"}),s[7]||(s[7]=a("span",null,"اصالت کالا",-1))]),a("div",ot,[u(M,{icon:"vuesax-linear:box-tick",size:"18"}),s[8]||(s[8]=a("span",null,"ارسال بیمه‌شده",-1))])],4)]),_:1},8,["class"])]),_:1},8,["modelValue"]),u(e(ke),{visible:b.value,"onUpdate:visible":s[2]||(s[2]=S=>b.value=S),placement:"bottom",closable:!1,class:"rtl",height:"100vh",bodyStyle:{padding:0,position:"relative"}},{default:D(()=>[c.value?(t(),q(me,{key:0,id:c.value,onCloseDrawer:s[1]||(s[1]=S=>b.value=!1)},null,8,["id"])):y("",!0)]),_:1},8,["visible"])])}}}),kt=j(nt,[["__scopeId","data-v-54657bb9"]]);export{kt as default};