-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #819 from alleslabs/feature/cfe-34-validator-desc
[CFE-33,34]: Feat - validator details overview section
- Loading branch information
Showing
18 changed files
with
421 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { ImageProps } from "@chakra-ui/react"; | ||
import { Image, SkeletonCircle } from "@chakra-ui/react"; | ||
|
||
import { useValidatorImage } from "lib/services/validatorService"; | ||
import type { Nullable, Validator } from "lib/types"; | ||
|
||
interface ValidatorImageProps { | ||
validator: Nullable<Validator>; | ||
boxSize?: ImageProps["boxSize"]; | ||
} | ||
|
||
export const ValidatorImage = ({ | ||
validator, | ||
boxSize = 10, | ||
}: ValidatorImageProps) => { | ||
const { data, isLoading } = useValidatorImage(validator); | ||
|
||
if (!validator) { | ||
return ( | ||
<Image | ||
boxSize={boxSize} | ||
minWidth={boxSize} | ||
src="https://raw.githubusercontent.com/alleslabs/assets/main/webapp-assets/asset/na-token.svg" | ||
alt="N/A" | ||
borderRadius="50%" | ||
/> | ||
); | ||
} | ||
|
||
return isLoading || !data || !validator.moniker ? ( | ||
<SkeletonCircle boxSize={boxSize} /> | ||
) : ( | ||
<Image | ||
boxSize={boxSize} | ||
minWidth={boxSize} | ||
src={data} | ||
alt={validator.moniker} | ||
borderRadius="50%" | ||
fallbackSrc="https://assets.alleslabs.dev/webapp-assets/placeholder/validator.svg" | ||
fallbackStrategy="beforeLoadOrError" | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 15 additions & 9 deletions
24
src/lib/pages/validator-details/components/bonded-token-changes/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
import { Flex } from "@chakra-ui/react"; | ||
|
||
import { RelatedTransactionTable } from "../tables/RelatedTransactionsTable"; | ||
import type { ValidatorAddr } from "lib/types"; | ||
import type { AssetInfos, Option, ValidatorAddr } from "lib/types"; | ||
|
||
import { VotingPowerChart } from "./VotingPowerChart"; | ||
|
||
interface BondedTokenChangesProps { | ||
validatorAddress: ValidatorAddr; | ||
singleStakingDenom: Option<string>; | ||
assetInfos: Option<AssetInfos>; | ||
} | ||
|
||
export const BondedTokenChanges = ({ | ||
validatorAddress, | ||
}: BondedTokenChangesProps) => { | ||
return ( | ||
<Flex direction="column" gap={{ base: 4, md: 8 }} pt={6}> | ||
<VotingPowerChart validatorAddress={validatorAddress} /> | ||
<RelatedTransactionTable /> | ||
</Flex> | ||
); | ||
}; | ||
singleStakingDenom, | ||
assetInfos, | ||
}: BondedTokenChangesProps) => ( | ||
<Flex direction="column" gap={{ base: 4, md: 8 }} pt={6}> | ||
<VotingPowerChart | ||
validatorAddress={validatorAddress} | ||
singleStakingDenom={singleStakingDenom} | ||
assetInfos={assetInfos} | ||
/> | ||
<RelatedTransactionTable /> | ||
</Flex> | ||
); |
30 changes: 20 additions & 10 deletions
30
src/lib/pages/validator-details/components/validator-overview/ValidatorDescription.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
import { Flex, Heading, Text } from "@chakra-ui/react"; | ||
import { Flex, Text } from "@chakra-ui/react"; | ||
|
||
export const ValidatorDescription = () => ( | ||
<Flex direction="column" gap={2}> | ||
<Heading variant="h6" as="h6" color="text.main"> | ||
interface ValidatorDescriptionProps { | ||
details: string; | ||
} | ||
|
||
export const ValidatorDescription = ({ | ||
details, | ||
}: ValidatorDescriptionProps) => ( | ||
<Flex | ||
direction="column" | ||
gap={2} | ||
backgroundColor="gray.900" | ||
p={{ base: 4, md: 6 }} | ||
rounded={8} | ||
w="100%" | ||
> | ||
<Text variant="body2" fontWeight={500} as="h6" color="text.dark"> | ||
Validator Description | ||
</Heading> | ||
<Text variant="body1" color="text.main"> | ||
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Ullam ad vel | ||
assumenda, temporibus maiores quidem quibusdam sapiente expedita officiis | ||
minus! Officiis itaque nisi reprehenderit tempora eaque eos quam, in | ||
excepturi. | ||
</Text> | ||
<Text variant="body2" color="text.main"> | ||
{details} | ||
</Text> | ||
</Flex> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.