UNPKG

@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.1 kB
import{e as n,a as A,t as F}from"../chunks/disclose-version.BTC8Bk4r.js";import"../chunks/legacy.DKpsC3nd.js";import{p as Z,l as C,a as tt,f as et,b as rt,s as o,c as P,g as a,m as k,d as e,n as at,r as t,t as st}from"../chunks/runtime.NVyxXVLy.js";import{s as i}from"../chunks/render.Dr_6zaa7.js";import{e as ot,i as lt}from"../chunks/each.e-7RQQYD.js";import{r as ct,s as nt}from"../chunks/attributes.CqauuZ_8.js";import{s as it}from"../chunks/class.DCW6ehBg.js";import{b as pt,p as ut}from"../chunks/event-modifiers.nqz-IwUY.js";import{i as dt}from"../chunks/lifecycle.BF-zkLgr.js";import{p as ft}from"../chunks/props.Btle0pBM.js";import{s as mt,a as gt}from"../chunks/store.EL_7F1Fq.js";import{g as $}from"../chunks/entry.CYtqVooA.js";import{p as bt}from"../chunks/stores.DmQQ1jkb.js";var xt=F('<tr><td class="py-2 px-4 text-center"><a class="text-blue-500"> </a></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 text-center"> </td><td class="py-2 px-4 text-center"> </td></tr>'),vt=F('<section class="container mx-auto mt-4 text-sm"><div class="mb-4 flex justify-center"><form class="flex items-center w-full max-w-lg"><input type="search" id="search" placeholder="Block Number" required class="px-4 py-2 border border-gray-300 rounded-l-md focus:outline-none focus:ring-2 focus:ring-blue-500 w-96 mr-2"> <button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-r-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500">Search</button></form></div></section> <section class="container mx-auto text-sm"><div class="flex flex-wrap justify-between mb-2"><a href="#" class="px-4 py-2 text-blue-500 font-medium rounded-md bg-gray-100 hover:bg-gray-200 transition-colors" role="button">&lt; Previous</a> <a href="#" class="px-4 py-2 text-blue-500 font-medium rounded-md bg-gray-100 hover:bg-gray-200 transition-colors" role="button">Next &gt;</a></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">Blocks</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Slot</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Pool</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Size (kb)</th><th class="py-2 px-4 bg-gray-100 font-bold text-center"># of Txs</th></tr></thead><tbody></tbody></table></div> <div class="flex flex-wrap justify-between mt-2 mb-4"><a href="#" class="px-4 py-2 text-blue-500 font-medium rounded-md bg-gray-100 hover:bg-gray-200 transition-colors" role="button">&lt; Previous</a> <a href="#" class="px-4 py-2 text-blue-500 font-medium rounded-md bg-gray-100 hover:bg-gray-200 transition-colors" role="button">Next &gt;</a></div></section>',1);function Bt(G,S){Z(S,!1);const H=mt(),j=()=>gt(bt,"$page",H),f=k();let l=ft(S,"data",8),p=k([]);const N=()=>{let r=parseInt(l().page)-1;r<=0&&(r=1),$(`/blocks?page=${r}&count=${l().count}`)},U=()=>{let s=parseInt(l().page),r=s+1;l().blocks.length==0&&(r=s),$(`/blocks?page=${r}&count=${l().count}`)};let u=k("");const J=()=>{console.log("serach"+a(u)),$(`/blocks/${a(u)}`)};C(()=>j(),()=>{P(f,j().url.searchParams.get("page"))}),C(()=>(a(p),a(f)),()=>{a(p).forEach(s=>{let v=s.href.split("?").slice(1).join("?");new URLSearchParams(v).get("page")===a(f)?s.active=!0:s.active=!1}),P(p,a(p))}),tt(),dt();var q=vt(),m=et(q),z=e(m),g=e(z),B=e(g);ct(B),at(2),t(g),t(z),t(m);var I=o(m,2),b=e(I),V=e(b),K=o(V,2);t(b);var x=o(b,2),D=e(x),E=o(e(D));ot(E,5,()=>l().blocks,lt,(s,r,v)=>{var c=xt();it(c,v%2===0?"bg-gray-50":"bg-white");var d=e(c),h=e(d),O=e(h,!0);t(h),t(d);var y=o(d),Q=e(y,!0);t(y);var _=o(y),W=e(_,!0);t(_);var w=o(_),X=e(w,!0);t(w);var T=o(w),Y=e(T,!0);t(T),t(c),st(()=>{nt(h,"href",`/blocks/${a(r).number??""}`),i(O,a(r).number),i(Q,a(r).slot),i(W,a(r).slot_leader),i(X,a(r).size/1e3),i(Y,a(r).tx_count)}),A(s,c)}),t(E),t(D),t(x);var L=o(x,2),R=e(L),M=o(R,2);t(L),t(I),pt(B,()=>a(u),s=>P(u,s)),n("submit",g,ut(J)),n("click",V,N),n("click",K,U),n("click",R,N),n("click",M,U),A(G,q),rt()}export{Bt as component};