Skip to content

Commit

Permalink
refactor(explorer): Update Placeholder table with the new ui kit Ta…
Browse files Browse the repository at this point in the history
…ble API (#2238)

* refactor(explorer): Update `Placeholder` table with the new ui kit Table API

* fmt

* chore: Remove unnecessary import

---------

Co-authored-by: cpl121 <[email protected]>
  • Loading branch information
marc2332 and cpl121 authored Sep 5, 2024
1 parent 1a72993 commit d08f5de
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export function EpochsActivityTable({
'Storage Net Inflow',
'Epoch End',
]}
colWidths={['100px', '120px', '40px', '204px', '90px', '38px']}
/>
) : (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export function TransactionsActivityTable({
rowCount={limit}
rowHeight="16px"
colHeadings={['Digest', 'Sender', 'Txns', 'Gas', 'Time']}
colWidths={['30%', '30%', '10%', '20%', '10%']}
/>
) : (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export function CheckpointsTable({
rowCount={Number(limit)}
rowHeight="16px"
colHeadings={['Digest', 'Sequence Number', 'Time', 'Transaction Count']}
colWidths={['100px', '120px', '204px', '90px', '38px']}
/>
) : (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export function TopPackagesTable({ data, isLoading }: TopPackagesTableProps) {
colHeadings={['Module', 'Function', 'Package ID', 'Count']}
rowCount={10}
rowHeight="15px"
colWidths={['100px', '120px', '40px', '204px']}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export function TopValidatorsCard({ limit, showIcon }: TopValidatorsCardProps):
rowCount={limit || NUMBER_OF_VALIDATORS}
rowHeight="13px"
colHeadings={['Name', 'Address', 'Stake']}
colWidths={['220px', '220px', '220px']}
/>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export function TransactionBlocksForAddress({
rowCount={DEFAULT_TRANSACTIONS_LIMIT}
rowHeight="16px"
colHeadings={['Digest', 'Sender', 'Txns', 'Gas', 'Time']}
colWidths={['30%', '30%', '10%', '20%', '10%']}
/>
) : (
<div>
Expand Down
10 changes: 5 additions & 5 deletions apps/explorer/src/components/ui/PlaceholderTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { Placeholder } from '@iota/ui';
import { useMemo } from 'react';

import { TableCard } from './TableCard';
import { TableCellType } from '@iota/apps-ui-kit';

export interface PlaceholderTableProps {
rowCount: number;
rowHeight: string;
colHeadings: string[];
colWidths: string[];
}

export function PlaceholderTable({
rowCount,
rowHeight,
colHeadings,
colWidths,
}: PlaceholderTableProps): JSX.Element {
const rowEntry = useMemo(
() =>
Object.fromEntries(
colHeadings.map((header, index) => [
`a${index}`,
<Placeholder key={index} width={colWidths[index]} height={rowHeight} />,
{
type: TableCellType.Placeholder,
},
]),
),
[colHeadings, colWidths, rowHeight],
[colHeadings, rowHeight],
);

const loadingTable = useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const VaryingWidth: StoryObj<PlaceholderTableProps> = {
rowCount={5}
rowHeight="16px"
colHeadings={['Sardine', 'Herring', 'Salmon', 'Barracuda']}
colWidths={['38px', '90px', '120px', '204px']}
/>
),
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export function CheckpointTransactionBlocks({ id }: { id: string }): JSX.Element
rowCount={20}
rowHeight="16px"
colHeadings={['Digest', 'Sender', 'Txns', 'Gas', 'Time']}
colWidths={['30%', '30%', '10%', '20%', '10%']}
/>
) : (
<div>
Expand Down
1 change: 0 additions & 1 deletion apps/explorer/src/pages/validators/Validators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ function ValidatorPageResult(): JSX.Element {
rowCount={20}
rowHeight="13px"
colHeadings={['Name', 'Address', 'Stake']}
colWidths={['220px', '220px', '220px']}
/>
)}

Expand Down

0 comments on commit d08f5de

Please sign in to comment.