@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.
58 lines (55 loc) • 4.59 kB
JavaScript
import { T as store_get, a0 as ensure_array_like, Z as attr, _ as stringify, X as escape_html, W as unsubscribe_stores, a1 as bind_props, x as pop, $ as fallback, v as push } from './index-vBtQgGkr.js';
import './client-x9PZM0zh.js';
import { p as page } from './stores-B4ORdDby.js';
import { t as truncate } from './util-C18qA3ke.js';
import './exports-DAzLyLdf.js';
function EyeIcon($$payload, $$props) {
push();
let size = fallback($$props["size"], "24");
let strokeWidth = fallback($$props["strokeWidth"], 2);
let customClass = fallback($$props["class"], "");
if (size !== "100%") {
size = size.slice(-1) === "x" ? size.slice(0, size.length - 1) + "em" : parseInt(size) + "px";
}
$$payload.out += `<svg xmlns="http://www.w3.org/2000/svg"${attr("width", size)}${attr("height", size)} fill="none" viewBox="0 0 24 24" stroke="currentColor"${attr("stroke-width", strokeWidth)} stroke-linecap="round" stroke-linejoin="round"${attr("class", `feather feather-eye ${stringify(customClass)}`)}><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>`;
bind_props($$props, { size, strokeWidth, class: customClass });
pop();
}
function _page($$payload, $$props) {
push();
var $$store_subs;
let activeUrl;
let data = $$props["data"];
let pages = [];
console.log(data);
if (!data.govactions) data.govactions = [];
activeUrl = store_get($$store_subs ??= {}, "$page", page).url.searchParams.get("page");
{
pages.forEach((page2) => {
let splitUrl = page2.href.split("?");
let queryString = splitUrl.slice(1).join("?");
const hrefParams = new URLSearchParams(queryString);
let hrefValue = hrefParams.get("page");
if (hrefValue === activeUrl) {
page2.active = true;
} else {
page2.active = false;
}
});
pages = pages;
}
const each_array = ensure_array_like(data.govactions);
$$payload.out += `<section class="container mx-auto text-sm"><h2 class="text-xl font-bold text-center text-gray-500 mb-4">Proposals</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">Index</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">Action Type</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Return Address</th><th class="py-2 px-4 bg-gray-100 font-bold text-center">Details</th></tr></thead><tbody><!--[-->`;
for (let index = 0, $$length = each_array.length; index < $$length; index++) {
let govaction = each_array[index];
$$payload.out += `<tr${attr("class", index % 2 === 0 ? "bg-gray-50" : "bg-white")}><td class="py-2 px-4"><a${attr("href", `/transactions/${stringify(govaction.tx_hash)}`)} class="text-blue-500"><span class="ml-2">${escape_html(truncate(govaction.tx_hash, 30, "..."))}</span></a></td><td class="py-2 px-4 text-center">${escape_html(govaction.index)}</td><td class="py-2 px-4 text-center"><a${attr("href", `/blocks/${stringify(govaction.block_number)}`)} class="text-blue-500">${escape_html(govaction.block_number)}</a></td><td class="py-2 px-4 text-center">${escape_html(govaction.type)}</td><td class="py-2 px-4 tex">${escape_html(govaction.return_address)}</td><td class="py-2 px-4 text-center"><a${attr("href", `/governance/govactions/${stringify(govaction.tx_hash)}_${stringify(govaction.index)}`)} target="_blank">`;
EyeIcon($$payload, { size: "1.5x" });
$$payload.out += `<!----></a></td></tr>`;
}
$$payload.out += `<!--]--></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>`;
if ($$store_subs) unsubscribe_stores($$store_subs);
bind_props($$props, { data });
pop();
}
export { _page as default };
//# sourceMappingURL=_page.svelte-CAzLLc-T.js.map