UNPKG

@swap-coffee/ui-sdk

Version:

User Interface SDK of swap.coffee DEX aggregator for integration in web applications

2 lines (1 loc) 2.97 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./main-c-T-T2Zl.cjs"),u={name:"DistributionModal",components:{ModalWrapper:e.ModalWrapper,CrossArrowIcon:e.CrossArrowIcon},mixins:[e.transactionRoutesMixin,e.computedMixins],data(){return{routeCount:4}},computed:{getCaption(){return window.innerWidth>640?this.$t("dexRouteInfo.caption[0]"):this.$t("dexRouteInfo.caption[1]")},getBtnText(){return this.routeCount===4?"Show all":"Hide all"}},mounted(){},methods:{showMore(){this.routeCount===4?this.routeCount=20:this.routeCount=4},isSameToken(o,n){return o===n},isCrossDex(o){return o.dex.length>1}}},p={class:"distribution__scroll-block custom-scroll"},_={class:"distribution__tokens-list"},m={class:"distribution__group"},k={class:"distribution__dex-info"},h={key:0,class:"distribution__dex-icons"},g=["src","alt"],B=["src","alt"],C={class:"distribution__percentage"},b={class:"distribution__route-path"},f={key:0},y={key:1};function w(o,n,v,E,l,r){const a=e.resolveComponent("CrossArrowIcon"),c=e.resolveComponent("modal-wrapper");return e.openBlock(),e.createBlock(c,{title:r.getCaption,freeHeight:!0,onCloseModal:n[1]||(n[1]=t=>o.$emit("closeDistribution"))},{default:e.withCtx(()=>[e.createBaseVNode("div",p,[e.createBaseVNode("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.getRoutes.slice(0,l.routeCount),(t,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"distribution__flex"},[e.createBaseVNode("div",m,[e.createBaseVNode("div",k,[t.dex.length>1?(e.openBlock(),e.createElementBlock("div",h,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.dex,(i,s)=>(e.openBlock(),e.createElementBlock("img",{key:i.name,src:i.imageUrl,alt:i.name,class:"distribution__route-image stacked",style:e.normalizeStyle({marginLeft:s===0?"0px":"-14px"})},null,12,g))),128))])):(e.openBlock(),e.createElementBlock("img",{key:1,src:t.dex[0].imageUrl,alt:t.dex[0].name,class:"distribution__route-image"},null,8,B)),e.createBaseVNode("p",C,e.toDisplayString(t.inputPercentage)+"%",1)])]),e.createBaseVNode("p",b,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.path.split(" > "),(i,s)=>(e.openBlock(),e.createElementBlock("span",{key:s},[e.createTextVNode(e.toDisplayString(i)+" ",1),r.isCrossDex(t)&&s<t.path.split(" > ").length-1&&r.isSameToken(t.path.split(" > ")[s],t.path.split(" > ")[s+1])?(e.openBlock(),e.createElementBlock("span",f,[e.createVNode(a,{class:"custom-arrow"})])):s<t.path.split(" > ").length-1?(e.openBlock(),e.createElementBlock("span",y," > ")):e.createCommentVNode("",!0)]))),128))])]))),128)),o.getRoutes.length>4?(e.openBlock(),e.createElementBlock("button",{key:0,class:"distribution__toggle-btn",onClick:n[0]||(n[0]=(...t)=>r.showMore&&r.showMore(...t))},e.toDisplayString(r.getBtnText),1)):e.createCommentVNode("",!0)])])]),_:1},8,["title"])}const x=e._export_sfc(u,[["render",w],["__scopeId","data-v-9706ad80"]]);exports.default=x;