Skip to content

Commit

Permalink
explorer: Fix Txs occurrences
Browse files Browse the repository at this point in the history
Resolves #1766
  • Loading branch information
nortonandreev committed May 20, 2024
1 parent 2b021fa commit f43dc9c
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("Transactions Card", () => {
const baseProps = {
error: null,
loading: false,
txs: null,
txns: null,
};
const baseOptions = {
props: baseProps,
Expand Down Expand Up @@ -54,11 +54,11 @@ describe("Transactions Card", () => {

it("should disable the `Show More` button if there is no more data to display", async () => {
const loading = false;
const txs = data;
const txns = data;

const { container, getByRole } = render(TransactionsCard, {
...baseOptions,
props: { ...baseProps, loading, txs },
props: { ...baseProps, loading, txns },
});

expect(getByRole("button")).toBeDisabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ exports[`Navbar > renders the Navbar component 1`] = `
<form>
<div
class="textbox-button"
style="width: 150px;"
style="width: 190px;"
>
<input
class="dusk-textbox dusk-textbox-text textbox-button__input"
placeholder="Txs/Hash"
placeholder="Block/Hash"
required=""
type="text"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`TextField > renders the component with default values 1`] = `
<div
class="textbox-button foo bar"
style="width: 150px;"
style="width: 190px;"
>
<input
class="dusk-textbox dusk-textbox-text textbox-button__input"
Expand Down Expand Up @@ -38,7 +38,7 @@ exports[`TextField > renders the component with default values 1`] = `
exports[`TextField > updates input value on change 1`] = `
<div
class="textbox-button foo bar"
style="width: 150px;"
style="width: 190px;"
>
<input
class="dusk-textbox dusk-textbox-text textbox-button__input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
export let className = undefined;
/** @type {Transaction[]}*/
export let txs;
export let txns;
/** @type {Error | null}*/
export let error;
Expand All @@ -33,7 +33,7 @@
<svelte:window bind:outerWidth={clientWidth} />
<DataCard
on:retry
data={txs}
data={txns}
{error}
{loading}
className={classes}
Expand All @@ -48,10 +48,10 @@
: undefined}
>
{#if clientWidth > 768}
<TransactionsTable data={txs} />
<TransactionsTable data={txns} />
{:else}
{#each txs as tx (tx)}
<TransactionsList data={tx} />
{#each txns as txn (txn)}
<TransactionsList data={txn} />
{/each}
{/if}
</DataCard>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export let placeholder = "";
/** @type {number}*/
export let fieldWidth = 150;
export let fieldWidth = 190;
/** @type {number}*/
export let expandedFieldWidth = 300;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import "./TransactionsCard.css";
/** @type {Transaction[] | null}*/
export let txs;
export let txns;
/** @type {Error | null}*/
export let error;
Expand All @@ -26,22 +26,22 @@
let clientWidth;
/** @type {Transaction[]}*/
let displayedTxs;
let displayedTxns;
/** @type {Boolean}*/
let isLoadMoreDisabled = false;
const loadMoreItems = () => {
if (txs && itemsToDisplay < txs.length) {
if (txns && itemsToDisplay < txns.length) {
itemsToDisplay += ITEMS_TO_DISPLAY;
}
};
$: displayedTxs = txs ? txs.slice(0, itemsToDisplay) : [];
$: displayedTxns = txns ? txns.slice(0, itemsToDisplay) : [];
$: {
if (txs && itemsToDisplay >= txs.length) {
if (txns && itemsToDisplay >= txns.length) {
isLoadMoreDisabled = true;
} else if (loading && txs === null) {
} else if (loading && txns === null) {
isLoadMoreDisabled = true;
} else {
isLoadMoreDisabled = false;
Expand All @@ -52,7 +52,7 @@
<svelte:window bind:outerWidth={clientWidth} />
<DataCard
on:retry
data={txs}
data={txns}
{error}
{loading}
title="Transactions"
Expand All @@ -64,13 +64,13 @@
>
{#if clientWidth > 768}
<TransactionsTable
data={displayedTxs}
data={displayedTxns}
className="transactions-card__table"
/>
{:else}
<div class="transactions-card__list">
{#each displayedTxs as tx (tx)}
<TransactionsList data={tx} />
{#each displayedTxns as txn (txn)}
<TransactionsList data={txn} />
{/each}
</div>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<form on:submit|preventDefault={submitHandler}>
<TextboxAndButton
bind:value
placeholder="Txs/Hash"
placeholder="Block/Hash"
icon={{
path: mdiMagnify,
position: "after",
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<LatestTransactionsCard
on:retry={pollingDataStore.start}
className="tables-layout"
txs={data?.transactions}
txns={data?.transactions}
{error}
loading={isLoading}
/>
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/routes/blocks/block/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="block__transactions">
<LatestTransactionsCard
on:retry={getBlock}
txs={data?.transactions.data}
txns={data?.transactions.data}
{error}
loading={isLoading}
isOnHomeScreen={false}
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/routes/transactions/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<section id="transactions">
<TransactionsCard
on:retry={() => pollingDataStore.start(currentNetwork)}
txs={data}
txns={data}
{error}
loading={isLoading}
/>
Expand Down

0 comments on commit f43dc9c

Please sign in to comment.