PageSourceSearch

https://app.valinity.io/assets/Orders-DIyaNArQ.js

js valinity.io collected 2026-10-02 15:22:06 UTC 4,917 bytes, 1 lines download raw bytes

1import{u as h,g as m,r as D,m as t,P as S,F as l,o as x,V as A,B as g,I as p,c$ as I,T as o,d3 as k,S as v,cR as R,cS as E,cT as O,cl as C,c2 as z}from"./index-BVQYYB-n.js";import{a as N,o as P}from"./koywe-CHRKQny9.js";import{B as T}from"./chunk-FQXH56BT-BQCRYl0s.js";const W={PENDING_PAYMENT:"yellow",PROCESSING:"blue",COMPLETED:"green",FAILED:"red",CANCELLED:"gray",EXPIRED:"orange"},M=30*60*1e3;function f(e,s){const r=s==="in"?e.amountIn:e.amountOut,a=s==="in"?e.symbolIn:e.symbolOut;return r==null||!a?"-":`${new Intl.NumberFormat("en-US",{maximumFractionDigits:8}).format(r)} ${a}`}function w(e){if(e.expiresAt)return Date.now()<=e.expiresAt;if(!e.createdAt)return!1;const s=new Date(e.createdAt).getTime();return Number.isNaN(s)?!1:Date.now()-s<=M}function b(e){return e.paymentUrl??e.url}function $(e){return e.type==="DEPOSIT"&&(e.status==="PENDING_PAYMENT"||e.status==="PROCESSING")&&!!b(e)&&w(e)}function B(e){return e.type==="WITHDRAW"&&e.status==="PENDING_PAYMENT"&&w(e)}function F(e){return[...e].sort((s,r)=>{const a=s.createdAt?new Date(s.createdAt).getTime():0;return(r.createdAt?new Date(r.createdAt).getTime():0)-a})}const L=({order:e})=>{const{t:s}=h(),r=m(),a=C(),n=e.status,c=b(e),d=$(e),i=!!e.orderId&&B(e),u=d||i,y=e.statusDetails??(e.statusDetailsCode?s(`views.koywe.orders.statusDetails.${e.statusDetailsCode}`,{defaultValue:e.statusDetailsCode}):null),j=()=>{if(d&&c){globalThis.location.href=c;return}i&&e.orderId&&r(`/koywe/orders/${encodeURIComponent(e.orderId)}`)};return t.jsxs(x,{as:u?"button":"div",w:"full",border:"1px solid",borderColor:"gray.200",borderRadius:"xl",px:4,py:3,bg:"white",textAlign:"left",cursor:u?"pointer":"default",transition:"background 0.15s ease, border-color 0.15s ease",_hover:u?{bg:"gray.50",borderColor:"blue.200"}:void 0,onClick:u?j:void 0,children:[t.jsxs(l,{align:"flex-start",justify:"space-between",gap:3,mb:3,children:[t.jsxs(x,{children:[t.jsx(o,{fontSize:"13px",fontWeight:"bold",color:"gray.800",children:e.type==="WITHDRAW"?s("views.koywe.orders.withdraw"):s("views.koywe.orders.deposit")}),e.createdAt&&t.jsx(o,{fontSize:"11px",color:"gray.400",children:a.date(new Date(e.createdAt),"PP p")})]}),t.jsxs(l,{align:"center",gap:1,children:[n&&t.jsx(T,{colorScheme:W[n]??"gray",borderRadius:"full",px:2,py:.5,fontSize:"10px",children:s(`views.koywe.orders.status.${n}`,{defaultValue:n})}),u&&t.jsx(p,{as:z,boxSize:"16px",color:"gray.400"})]})]}),y&&t.jsx(o,{mt:-2,mb:3,fontSize:"11px",color:"red.500",children:y}),t.jsxs(x,{bg:"gray.50",borderRadius:"lg",px:3,py:2,children:[t.jsxs(l,{justify:"space-between",gap:3,mb:1,children:[t.jsx(o,{fontSize:"11px",color:"gray.500",children:s("views.koywe.orders.amountIn")}),t.jsx(o,{fontSize:"12px",color:"gray.700",fontWeight:"semibold",children:f(e,"in")})]}),t.jsxs(l,{justify:"space-between",gap:3,children:[t.jsx(o,{fontSize:"11px",color:"gray.500",children:s("views.koywe.orders.amountOut")}),t.jsx(o,{fontSize:"12px",color:"green.600",fontWeight:"semibold",children:f(e,"out")})]})]}),e.orderId&&t.jsx(o,{mt:2,fontSize:"10px",color:"gray.400",fontFamily:"mono",wordBreak:"break-all",children:e.orderId})]})},V=()=>{const{t:e}=h(),s=m(),{token:r,ensureToken:a}=N(),n=P(r),c=D.useMemo(()=>F(n.data??[]),[n.data]),d=async()=>{try{await a(),await n.refetch()}catch{}};return t.jsx(S,{title:e("views.koywe.orders.title"),display:"flex",flexDir:"column",children:t.jsx(l,{flex:1,direction:"column",align:"center",justify:"flex-start",pt:{base:8,sm:12},px:4,pb:8,children:t.jsx(x,{w:"full",maxW:"380px",bg:"white",borderRadius:"2xl",shadow:"lg",p:6,border:"1px solid",borderColor:"gray.100",children:t.jsxs(A,{spacing:4,align:"stretch",children:[t.jsxs(l,{w:"full",align:"center",gap:2,children:[t.jsx(g,{size:"xs",variant:"ghost",leftIcon:t.jsx(p,{as:I}),onClick:()=>s("/koywe"),color:"gray.500",px:1,children:e("views.koywe.back")}),t.jsx(o,{flex:1,fontWeight:"bold",fontSize:"md",color:"gray.800",textAlign:"center",children:e("views.koywe.orders.title")}),t.jsx(g,{size:"xs",variant:"ghost",onClick:d,color:"gray.500",px:1,isLoading:n.isFetching,children:t.jsx(p,{as:k,boxSize:"16px"})})]}),!r&&t.jsx(g,{w:"full",size:"sm",borderRadius:"full",onClick:d,children:e("actions.connectWallet")}),r&&n.isLoading&&t.jsx(l,{align:"center",justify:"center",py:8,children:t.jsx(v,{color:"blue.500"})}),r&&n.isError&&t.jsxs(R,{status:"error",borderRadius:"xl",fontSize:"xs",children:[t.jsx(E,{boxSize:"14px"}),t.jsx(O,{children:e("views.koywe.orders.loadError")})]}),r&&!n.isLoading&&!n.isError&&c.length===0&&t.jsxs(x,{bg:"gray.50",borderRadius:"xl",px:4,py:5,textAlign:"center",children:[t.jsx(o,{fontSize:"sm",fontWeight:"semibold",color:"gray.700",children:e("views.koywe.orders.emptyTitle")}),t.jsx(o,{fontSize:"xs",color:"gray.500",mt:1,children:e("views.koywe.orders.emptyBody")})]}),c.map(i=>t.jsx(L,{order:i},i.orderId??`${i.createdAt}-${i.amountIn}-${i.amountOut}`))]})})})})};export{V as KoyweOrders};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.