Skip to content

Commit

Permalink
Merge branch 'develop' into feat/storybook-init
Browse files Browse the repository at this point in the history
  • Loading branch information
songwongtp committed Jan 18, 2024
2 parents 2b65375 + 73f5e38 commit a7c7e9a
Show file tree
Hide file tree
Showing 106 changed files with 1,717 additions and 760 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Features

- [#721](https://github.com/alleslabs/celatone-frontend/pull/721) Migrate to pnpm
- [#727](https://github.com/alleslabs/celatone-frontend/pull/727) Add amp nft pages
- [#720](https://github.com/alleslabs/celatone-frontend/pull/720) Add delegations for contract detail
- [#684](https://github.com/alleslabs/celatone-frontend/pull/684) Add nft page
- [#717](https://github.com/alleslabs/celatone-frontend/pull/717) Add total value for contract detail
- [#711](https://github.com/alleslabs/celatone-frontend/pull/711) Refactor assetInfos and add movePoolInfos to tx details
- [#724](https://github.com/alleslabs/celatone-frontend/pull/724) Add stone-13

### Improvements

- [#725](https://github.com/alleslabs/celatone-frontend/pull/725) Adjust unsupported asset display in account and contract detail
- [#728](https://github.com/alleslabs/celatone-frontend/pull/728) Support tx events for cosmos sdk 0.50
- [#729](https://github.com/alleslabs/celatone-frontend/pull/729) Add missing title for block transactions
- [#726](https://github.com/alleslabs/celatone-frontend/pull/726) Add missing title for instantiate permission and adjust contract menu in nav bar
- [#713](https://github.com/alleslabs/celatone-frontend/pull/713) Adjust search state consistency
- [#712](https://github.com/alleslabs/celatone-frontend/pull/712) api v1 - proposal list
Expand Down
Binary file removed public/PilatWide-Bold.woff2
Binary file not shown.
6 changes: 0 additions & 6 deletions public/validator.svg

This file was deleted.

2 changes: 1 addition & 1 deletion src/config/chain/neutron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const NEUTRON_CHAIN_CONFIGS: ChainConfigs = {
enabled: false,
},
nft: {
enabled: true,
enabled: false,
},
},
gas: {
Expand Down
28 changes: 16 additions & 12 deletions src/lib/amplitude/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export enum AmpEvent {
// NAVIGATE
TO_OVERVIEW = "To Overview",
TO_BLOCKS = "To Blocks",
TO_BLOCK_DETAIL = "To Block Detail",
TO_BLOCK_DETAILS = "To Block Detail",
TO_TXS = "To Txs",
TO_MODULES = "To Modules",
TO_PAST_TXS = "To Past Txs",
Expand All @@ -51,25 +51,25 @@ export enum AmpEvent {
TO_LIST_OTHERS = "To List Others",
TO_ALL_LISTS = "To All Lists",
TO_ALL_PROJECTS = "To All Public Projects",
TO_ACCOUNT_DETAIL = "To Account Detail",
TO_CONTRACT_DETAIL = "To Contract Detail",
TO_CODE_DETAIL = "To Code Detail",
TO_PROJECT_DETAIL = "To Public Project Detail",
TO_TRANSACTION_DETAIL = "To Transaction Detail",
TO_ACCOUNT_DETAILS = "To Account Detail",
TO_CONTRACT_DETAILS = "To Contract Detail",
TO_CODE_DETAILS = "To Code Detail",
TO_PROJECT_DETAILS = "To Public Project Detail",
TO_TRANSACTION_DETAILS = "To Transaction Detail",
TO_NOT_FOUND = "To 404 Not Found",
TO_FAUCET = "To Faucet",
TO_POOL_LIST = "To Pool List",
TO_POOL_DETAIL = "To Pool Detail",
TO_POOL_DETAILS = "To Pool Detail",
TO_PROPOSAL_TO_STORE_CODE = "To Proposal To Store Code",
TO_PROPOSAL_TO_WHITELIST = "To Proposal To Whitelist",
TO_MODULE_DETAIL = "To Module Detail",
TO_MODULE_DETAILS = "To Module Detail",
TO_MODULE_INTERACTION = "To Module Interaction",
TO_PUBLISH_MODULE = "To Publish Module",
TO_DEPLOY_SCRIPT = "To Deploy Script",
TO_MY_PUBLISHED_MODULES = "To My Published Modules",
TO_NFT_COLLECTIONS = "To NFT Collections",
TO_NFT_COLLECTION_DETAIL = "To NFT Collection Detail",
TO_NFT_DETAIL = "To NFT Detail",
TO_NFT_COLLECTIONS_LIST = "To NFT Collections List",
TO_NFT_COLLECTION_DETAILS = "To NFT Collection Detail",
TO_NFT_DETAILS = "To NFT Detail",
// ACTIONS
ACTION_UPLOAD = "Action Upload",
ACTION_INSTANTIATE = "Action Instantiate",
Expand Down Expand Up @@ -152,7 +152,7 @@ export enum AmpEvent {
USE_CONTRACT_STATES_DOWNLOAD = "Use Contract States Download",
USE_NAMESPACE_TAB = "Use Namespace Tab",
USE_NAVIGATING_BUTTON = "Use Navigating Button",
USE_MODULE_DETAIL_MAIN_CTA = "Use Module Detail Main CTA",
USE_MODULE_DETAILS_MAIN_CTA = "Use Module Detail Main CTA",
USE_MODULE_FUNCTION_CTA = "Use Module Function CTA",
USE_BREADCRUMB = "Use Breadcrumb",
USE_MODULE_SELECTION_DRAWER = "Use Module Selection Drawer",
Expand All @@ -175,6 +175,10 @@ export enum AmpEvent {
USE_MY_PUBLISHED_MODULES_CTA = "Use My Publised Modules CTA",
USE_SELECT_RESOURCE_GROUP = "Use Select Resource Group",
USE_MODULE_CARD = "Use Module Card",
USE_NFT_COLLECTION_INFO_CARD = "Use NFT Collection Info Card",
USE_NFT_VIEW_RESOURCE_CTA = "Use NFT View Resource CTA",
USE_NFT_CARD = "Use NFT Card",
USE_SELECT_NFT_COLLECTION_GROUP = "Use Select NFT Selection Group",

// TX
TX_SUCCEED = "Tx Succeed",
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/CustomTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const CustomTab = ({
lineHeight="24px"
letterSpacing="0.4px"
variant="ghost-gray"
minW="fit-content"
mb={0}
sx={{
"&[aria-selected=true]": {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/components/TotalValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export const TotalValue = ({
<Flex
p={isCompact ? 3 : 4}
direction="column"
border="2px solid"
border="1px solid"
borderColor="gray.700"
borderRadius={4}
borderRadius={8}
>
<Text variant="body2" fontWeight={500} color="text.dark">
{label}
Expand All @@ -36,8 +36,8 @@ export const TotalValue = ({
/>
) : (
<Heading
as="h6"
variant="h6"
as="h5"
variant="h5"
color={
!totalAccountValue || totalAccountValue.eq(0)
? "text.disabled"
Expand Down
6 changes: 3 additions & 3 deletions src/lib/components/ValidatorBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { ImageProps } from "@chakra-ui/react";
import { Spinner, Flex, Image, Text } from "@chakra-ui/react";

import validatorDefaultImg from "../../../public/validator.svg";
import { useMobile } from "lib/app-provider";
import { ExplorerLink } from "lib/components/ExplorerLink";
import { MobileLabel } from "lib/components/table";
import { useValidatorImage } from "lib/services/validatorService";
import type { Nullable, Validator } from "lib/types";

import { MobileLabel } from "./table/MobileLabel";

interface ValidatorBadgeProps {
validator: Nullable<Validator>;
badgeSize?: ImageProps["boxSize"];
Expand Down Expand Up @@ -55,7 +55,7 @@ export const ValidatorBadge = ({
src={valImgSrc}
alt={validator.moniker}
borderRadius="50%"
fallbackSrc={validatorDefaultImg.src}
fallbackSrc="https://assets.alleslabs.dev/webapp-assets/placeholder/validator.svg"
fallbackStrategy="beforeLoadOrError"
/>
)}
Expand Down
84 changes: 84 additions & 0 deletions src/lib/components/asset/AssetSectionOverview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { Flex, Grid, GridItem, Text } from "@chakra-ui/react";

import { ViewMore } from "../table";
import type { Option, TokenWithValue, USD } from "lib/types";

import { SupportedAssetSectionContent } from "./SupportedAssetSectionContent";
import { SupportedAssetTitle } from "./SupportedAssetTitle";
import { UnsupportedAssetSectionContent } from "./UnsupportedAssetSectionContent";
import { UnsupportedAssetTitle } from "./UnsupportedAssetTitle";

const MAX_SUPPORTED_ASSETS_SHOW = 6;
const MAX_UNSUPPORTED_ASSETS_SHOW = 3;

interface AssetSectionOverviewProps {
isAccount: boolean;
supportedAssets: TokenWithValue[];
totalSupportedAssetsValue: Option<USD<Big>>;
unsupportedAssets: TokenWithValue[];
onViewMore: () => void;
}

export const AssetSectionOverview = ({
isAccount,
supportedAssets,
totalSupportedAssetsValue,
unsupportedAssets,
onViewMore,
}: AssetSectionOverviewProps) => {
if (!supportedAssets.length && !unsupportedAssets.length)
return (
<Text variant="body2" color="text.dark">
This {isAccount ? "address" : "contract"} does not hold any assets
</Text>
);

return (
<Grid gridTemplateColumns={{ base: "1fr", xl: "2fr 1fr" }} gridGap={4}>
<GridItem border="1px solid" borderColor="gray.700" borderRadius="8px">
<Flex direction="column" justifyContent="space-between" h="full">
<Flex direction="column">
<SupportedAssetTitle
supportedAssets={supportedAssets}
totalSupportedAssetsValue={totalSupportedAssetsValue}
/>
<SupportedAssetSectionContent
isAccount={isAccount}
supportedAssets={supportedAssets.slice(
0,
MAX_SUPPORTED_ASSETS_SHOW
)}
onViewMore={onViewMore}
/>
</Flex>
{onViewMore && supportedAssets.length > MAX_SUPPORTED_ASSETS_SHOW && (
<ViewMore
onClick={onViewMore}
borderRadius="0px 0px 8px 8px"
minH="48px"
/>
)}
</Flex>
</GridItem>
<GridItem border="1px solid" borderColor="gray.700" borderRadius="8px">
<UnsupportedAssetTitle unsupportedAssets={unsupportedAssets} />
<UnsupportedAssetSectionContent
isAccount={isAccount}
unsupportedAssets={unsupportedAssets.slice(
0,
MAX_UNSUPPORTED_ASSETS_SHOW
)}
onViewMore={onViewMore}
/>
{onViewMore &&
unsupportedAssets.length > MAX_UNSUPPORTED_ASSETS_SHOW && (
<ViewMore
onClick={onViewMore}
borderRadius="0px 0px 8px 8px"
minH="48px"
/>
)}
</GridItem>
</Grid>
);
};
47 changes: 47 additions & 0 deletions src/lib/components/asset/SupportedAssetSectionContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Flex, Grid, Text } from "@chakra-ui/react";

import { TokenCard } from "lib/components/token";
import type { TokenWithValue } from "lib/types";

interface SupportedAssetSectionContentProps {
supportedAssets: TokenWithValue[];
isAccount?: boolean;
onViewMore?: () => void;
}

export const SupportedAssetSectionContent = ({
supportedAssets,
isAccount = false,
onViewMore,
}: SupportedAssetSectionContentProps) => {
if (!supportedAssets.length)
return (
<Flex
w="full"
alignItems="center"
justifyContent="center"
h="calc(100% - 45px)"
minH={20}
>
<Text variant="body2" color="text.dark">
This {isAccount ? "address" : "contract"} does not hold any supported
assets
</Text>
</Flex>
);

return (
<Grid
p={4}
gridGap={4}
gridTemplateColumns={{
base: "1 fr",
md: onViewMore ? "repeat(3, 1fr)" : "repeat(4, 1fr)",
}}
>
{supportedAssets.map((asset) => (
<TokenCard key={asset.denom} token={asset} minW="full" />
))}
</Grid>
);
};
49 changes: 49 additions & 0 deletions src/lib/components/asset/SupportedAssetTitle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Flex, Heading } from "@chakra-ui/react";

import { TableTitle } from "../table";
import { useMobile } from "lib/app-provider";
import type { Option, TokenWithValue, USD } from "lib/types";
import { formatPrice } from "lib/utils";

interface SupportedAssetTitleProps {
supportedAssets: TokenWithValue[];
totalSupportedAssetsValue: Option<USD<Big>>;
}

export const SupportedAssetTitle = ({
supportedAssets,
totalSupportedAssetsValue,
}: SupportedAssetTitleProps) => {
const isMobile = useMobile();
const isZeroValue =
!totalSupportedAssetsValue || totalSupportedAssetsValue.eq(0);

return (
<Flex
w="full"
bg="gray.900"
py={2}
px={4}
borderRadius="8px 8px 0px 0px"
justifyContent="space-between"
>
<TableTitle
title="Supported Assets"
count={supportedAssets.length}
mb={0}
/>
{!isMobile && (
<Heading
mt={1}
as="h6"
variant="h6"
color={isZeroValue ? "text.dark" : "text.main"}
>
{totalSupportedAssetsValue
? formatPrice(totalSupportedAssetsValue)
: "N/A"}
</Heading>
)}
</Flex>
);
};
48 changes: 48 additions & 0 deletions src/lib/components/asset/UnsupportedAssetSectionContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Flex, Grid, Text } from "@chakra-ui/react";

import { UnsupportedToken } from "../token";
import type { TokenWithValue } from "lib/types";

interface UnsupportedAssetSectionContentProps {
unsupportedAssets: TokenWithValue[];
isAccount?: boolean;
onViewMore?: () => void;
}

export const UnsupportedAssetSectionContent = ({
unsupportedAssets,
onViewMore,
isAccount = false,
}: UnsupportedAssetSectionContentProps) => {
if (!unsupportedAssets.length)
return (
<Flex
w="full"
alignItems="center"
justifyContent="center"
h="calc(100% - 45px)"
minH={20}
>
<Text variant="body2" color="text.dark">
This {isAccount ? "address" : "contract"} does not hold any
unsupported assets
</Text>
</Flex>
);

return (
<Flex direction="column" gap={5} p={4}>
<Grid
gridGap={4}
gridTemplateColumns={{
base: "1 fr",
md: onViewMore ? "1fr" : "repeat(2, 1fr)",
}}
>
{unsupportedAssets.map((asset) => (
<UnsupportedToken key={asset.denom} token={asset} />
))}
</Grid>
</Flex>
);
};
Loading

0 comments on commit a7c7e9a

Please sign in to comment.