Skip to content

Commit

Permalink
feat(explorer): polish validators view and bring back actions in Table (
Browse files Browse the repository at this point in the history
#4153)

* fix action in table and remove validators count

* polish validators view

* fix import

---------

Co-authored-by: cpl121 <[email protected]>
  • Loading branch information
evavirseda and cpl121 authored Nov 25, 2024
1 parent 1a54b01 commit 16292bc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export function TopValidatorsCard({ limit, showIcon }: TopValidatorsCardProps):
data={data.activeValidators}
columns={tableColumns}
viewAll="/validators"
totalLabel={data ? data.activeValidators.length.toString() : '--'}
/>
</ErrorBoundary>
)}
Expand Down
44 changes: 23 additions & 21 deletions apps/explorer/src/pages/validators/Validators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
InfoBox,
InfoBoxStyle,
InfoBoxType,
TableHeader,
Panel,
Title,
TooltipPosition,
} from '@iota/apps-ui-kit';
import { useIotaClientQuery } from '@iota/dapp-kit';
Expand Down Expand Up @@ -155,26 +156,27 @@ function ValidatorPageResult(): JSX.Element {
/>
))}
</div>
<div>
<ErrorBoundary>
<TableHeader>All Validators</TableHeader>
{(isPending || validatorsEventsLoading) && (
<PlaceholderTable
rowCount={20}
rowHeight="13px"
colHeadings={['Name', 'Address', 'Stake']}
/>
)}

{isSuccess && tableData && tableColumns && (
<TableCard
data={tableData}
columns={tableColumns}
areHeadersCentered={false}
/>
)}
</ErrorBoundary>
</div>
<Panel>
<Title title="All Validators" />
<div className="p-md">
<ErrorBoundary>
{(isPending || validatorsEventsLoading) && (
<PlaceholderTable
rowCount={20}
rowHeight="13px"
colHeadings={['Name', 'Address', 'Stake']}
/>
)}
{isSuccess && tableData && tableColumns && (
<TableCard
data={tableData}
columns={tableColumns}
areHeadersCentered={false}
/>
)}
</ErrorBoundary>
</div>
</Panel>
</div>
)
}
Expand Down
64 changes: 34 additions & 30 deletions apps/ui-kit/src/lib/components/organisms/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,37 +99,41 @@ export function Table({
'justify-end': !paginationOptions && action,
})}
>
{paginationOptions && (
{(paginationOptions || action) && (
<div className="flex gap-2">
<Button
type={ButtonType.Secondary}
size={ButtonSize.Small}
icon={<DoubleArrowLeft />}
disabled={!paginationOptions.hasFirst}
onClick={paginationOptions.onFirst}
/>
<Button
type={ButtonType.Secondary}
size={ButtonSize.Small}
icon={<ArrowLeft />}
disabled={!paginationOptions.hasPrev}
onClick={paginationOptions.onPrev}
/>
<Button
type={ButtonType.Secondary}
size={ButtonSize.Small}
icon={<ArrowRight />}
disabled={!paginationOptions.hasNext}
onClick={paginationOptions.onNext}
/>
<Button
type={ButtonType.Secondary}
size={ButtonSize.Small}
icon={<DoubleArrowRight />}
disabled={!paginationOptions.hasLast}
onClick={paginationOptions.onLast}
/>
{action}
{paginationOptions && (
<>
<Button
type={ButtonType.Secondary}
size={ButtonSize.Small}
icon={<DoubleArrowLeft />}
disabled={!paginationOptions.hasFirst}
onClick={paginationOptions.onFirst}
/>
<Button
type={ButtonType.Secondary}
size={ButtonSize.Small}
icon={<ArrowLeft />}
disabled={!paginationOptions.hasPrev}
onClick={paginationOptions.onPrev}
/>
<Button
type={ButtonType.Secondary}
size={ButtonSize.Small}
icon={<ArrowRight />}
disabled={!paginationOptions.hasNext}
onClick={paginationOptions.onNext}
/>
<Button
type={ButtonType.Secondary}
size={ButtonSize.Small}
icon={<DoubleArrowRight />}
disabled={!paginationOptions.hasLast}
onClick={paginationOptions.onLast}
/>
</>
)}
{action && action}
</div>
)}
{supportingLabel || pageSizeSelector ? (
Expand Down

0 comments on commit 16292bc

Please sign in to comment.