@bloxbean/yaci-viewer
Version:
A Cardano blockchain data viewer for developers. It works with the Yaci-Store backend, supporting both a local devnet and public networks.
2 lines (1 loc) • 4.53 kB
JavaScript
import{e as g,a as x,t as v}from"../chunks/disclose-version.BTC8Bk4r.js";import"../chunks/legacy.DKpsC3nd.js";import{p as pt,l as D,a as it,b as dt,s,d as a,r as e,t as u,g as r,c as F,f as bt,n as gt,m as J}from"../chunks/runtime.NVyxXVLy.js";import{s as l}from"../chunks/render.Dr_6zaa7.js";import{i as xt}from"../chunks/if.DkuB8BPo.js";import{e as ut,i as vt}from"../chunks/each.e-7RQQYD.js";import{s as I}from"../chunks/attributes.CqauuZ_8.js";import{s as ft}from"../chunks/class.DCW6ehBg.js";import{i as ht}from"../chunks/lifecycle.BF-zkLgr.js";import{p as mt}from"../chunks/props.Btle0pBM.js";import{s as _t,a as yt}from"../chunks/store.EL_7F1Fq.js";import{g as K}from"../chunks/entry.CYtqVooA.js";import{p as Pt}from"../chunks/stores.DmQQ1jkb.js";import{t as M}from"../chunks/util.8sVtkjoC.js";var kt=v('<td class="py-2 px-4"><a target="_blank"> </a></td> <td class="py-2 px-4"> </td>',1),wt=v('<td class="py-2 px-4 text-center">_</td> <td class="py-2 px-4 text-center">_</td>',1),$t=v('<tr><td class="py-2 px-4"><a class="text-blue-500"><span class="ml-2"> </span></a></td><td class="py-2 px-4 text-center"><a class="text-blue-500"> </a></td><td class="py-2 px-4"> </td><td class="py-2 px-4 text-center"> </td><td class="py-2 px-4 text-center"> </td><td class="py-2 px-4"> </td><!></tr>'),Vt=v('<section class="container mx-auto text-sm"><h2 class="text-xl font-bold text-center text-gray-500 mb-4">Votes</h2> <div class="flex flex-wrap justify-between mt-4 mb-2"><button class="px-4 py-2 text-blue-500 font-medium rounded-md bg-gray-100 hover:bg-gray-200 transition-colors" role="button">< Previous</button> <button class="px-4 py-2 text-blue-500 font-medium rounded-md bg-gray-100 hover:bg-gray-200 transition-colors" role="button">Next ></button></div> <div class="overflow-x-auto"><table class="w-full bg-white border border-gray-300"><thead><tr><th class="py-2 px-4 bg-gray-100 font-bold text-center">Transaction Hash</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Block</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Gov Action Id</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Voter Type</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Vote</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Voter Hash</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Anchor URL</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Anchor Hash</th></tr></thead><tbody></tbody></table></div> <div class="flex flex-wrap justify-between mt-2 mb-2"><button class="px-4 py-2 text-blue-500 font-medium rounded-md bg-gray-100 hover:bg-gray-200 transition-colors" role="button">< Previous</button> <button class="px-4 py-2 text-blue-500 font-medium rounded-md bg-gray-100 hover:bg-gray-200 transition-colors" role="button">Next ></button></div></section>');function zt(O,L){pt(L,!1);const Q=_t(),N=()=>yt(Pt,"$page",Q),f=J();let o=mt(L,"data",12),i=J([]);const R=()=>{let t=parseInt(o().page)-1;t<=0&&(t=1),K(`/governance/votes?page=${t}&count=${o().count}`)},S=()=>{let n=parseInt(o().page),t=n+1;o().votes.length==0&&(t=n),K(`/governance/votes?page=${t}&count=${o().count}`)};console.log(o()),o().votes||o(o().votes=[],!0),D(()=>N(),()=>{F(f,N().url.searchParams.get("page"))}),D(()=>(r(i),r(f)),()=>{r(i).forEach(n=>{let y=n.href.split("?").slice(1).join("?");new URLSearchParams(y).get("page")===r(f)?n.active=!0:n.active=!1}),F(i,r(i))}),it(),ht();var h=Vt(),m=s(a(h),2),T=a(m),W=s(T,2);e(m);var _=s(m,2),q=a(_),B=s(a(q));ut(B,5,()=>o().votes,vt,(n,t,y)=>{var p=$t();ft(p,y%2===0?"bg-gray-50":"bg-white");var d=a(p),P=a(d),z=a(P),Y=a(z,!0);u(()=>l(Y,M(r(t).tx_hash,30,"..."))),e(z),e(P),e(d);var k=s(d),w=a(k),Z=a(w,!0);e(w),e(k);var $=s(k),tt=a($);e($);var V=s($),et=a(V,!0);e(V);var U=s(V),at=a(U,!0);e(U);var j=s(U),rt=a(j,!0);u(()=>l(rt,M(r(t).voter_hash,30,"..."))),e(j);var st=s(j);{var ot=c=>{var b=kt(),A=bt(b),H=a(A),lt=a(H,!0);e(H),e(A);var C=s(A,2),ct=a(C,!0);e(C),u(()=>{I(H,"href",r(t).anchor_url),l(lt,r(t).anchor_url),l(ct,r(t).anchor_hash)}),x(c,b)},nt=c=>{var b=wt();gt(2),x(c,b)};xt(st,c=>{r(t).anchor_url?c(ot):c(nt,!1)})}e(p),u(()=>{I(P,"href",`/transactions/${r(t).tx_hash??""}`),I(w,"href",`/blocks/${r(t).block_number??""}`),l(Z,r(t).block_number),l(tt,`${r(t).gov_action_tx_hash??""}#${r(t).gov_action_index??""}`),l(et,r(t).voter_type),l(at,r(t).vote)}),x(n,p)}),e(B),e(q),e(_);var E=s(_,2),G=a(E),X=s(G,2);e(E),e(h),g("click",T,R),g("click",W,S),g("click",G,R),g("click",X,S),x(O,h),dt()}export{zt as component};