Skip to content

Commit

Permalink
feat(core): enhance validator's loading state with skeleton components
Browse files Browse the repository at this point in the history
  • Loading branch information
panteleymonchuk committed Dec 18, 2024
1 parent aab3a17 commit fe9ca29
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 16 additions & 1 deletion apps/core/src/components/Validator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
CardType,
Badge,
BadgeType,
ImageShape,
Skeleton,
} from '@iota/apps-ui-kit';
import { formatAddress } from '@iota/iota-sdk/utils';

Expand Down Expand Up @@ -50,7 +52,20 @@ export function Validator({
});

if (isPendingValidators) {
return <div className="flex items-center justify-center">...</div>;
return (
<Card>
<CardImage shape={ImageShape.Rounded}>
<Skeleton widthClass="w-10" heightClass="h-10" />
</CardImage>
<div className="flex flex-col gap-y-xs">
<Skeleton widthClass="w-40" heightClass="h-3.5" />
<Skeleton widthClass="w-32" heightClass="h-3" hasSecondaryColors />
</div>
<div className="ml-auto flex flex-col gap-y-xs">
<Skeleton widthClass="w-20" heightClass="h-3.5" />
</div>
</Card>
);
}
// for inactive validators, show the epoch number
const fallBackText = activeEpoch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import React from 'react';
import { useFormatCoin, useStakeTxnInfo } from '@iota/core';
import { useFormatCoin, useStakeTxnInfo, Validator } from '@iota/core';
import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
import {
Button,
Expand All @@ -20,8 +20,6 @@ import {
import { Field, type FieldProps, useFormikContext } from 'formik';
import { Exclamation, Loader } from '@iota/ui-icons';
import { useIotaClientQuery } from '@iota/dapp-kit';

import { Validator } from './Validator';
import { StakedInfo } from './StakedInfo';
import { DialogLayout, DialogLayoutBody, DialogLayoutFooter } from '../../layout';

Expand Down

0 comments on commit fe9ca29

Please sign in to comment.