diff --git a/.github/workflows/dashboard-ci.yaml b/.github/workflows/dashboard-ci.yaml index 2ac8e255f..8f3e1bed2 100644 --- a/.github/workflows/dashboard-ci.yaml +++ b/.github/workflows/dashboard-ci.yaml @@ -1,6 +1,8 @@ name: Token Dashboard / CI on: + schedule: + - cron: "0 0 * * *" push: branches: - main diff --git a/src/components/ExternalLink/index.tsx b/src/components/ExternalLink/index.tsx index 8a285cb9a..ba2f4ad78 100644 --- a/src/components/ExternalLink/index.tsx +++ b/src/components/ExternalLink/index.tsx @@ -1,4 +1,4 @@ -import { FC } from "react" +import { FC, ReactElement } from "react" import { Icon, Link, LinkProps, useColorModeValue } from "@chakra-ui/react" import { FiArrowUpRight } from "react-icons/all" @@ -6,12 +6,14 @@ interface Props { href: string text: string withArrow?: boolean + icon?: ReactElement } const ExternalLink: FC = ({ text, href, withArrow, + icon, ...props }) => { const defaultColor = useColorModeValue("brand.500", "white") @@ -26,9 +28,11 @@ const ExternalLink: FC = ({ textDecoration="underline" {...props} > - {text}{" "} - {withArrow && ( - + {text} + {withArrow ? ( + + ) : ( + icon )} ) diff --git a/src/components/LinkDetailsListItem/index.tsx b/src/components/LinkDetailsListItem/index.tsx new file mode 100644 index 000000000..cd6075840 --- /dev/null +++ b/src/components/LinkDetailsListItem/index.tsx @@ -0,0 +1,43 @@ +import { FC } from "react" +import { Box, HStack, ListItem, ListItemProps } from "@chakra-ui/react" +import { ExternalLinkIcon } from "@chakra-ui/icons" +import { Body1, Body3 } from "../Typography" +import ExternalLink from "../ExternalLink" +import { ExternalHref } from "../../enums" + +interface LinkDetailsListItemProps extends ListItemProps { + title: string + subTitle?: string + href: ExternalHref + cta?: string +} + +const LinkDetailsListItem: FC = ({ + title, + subTitle, + href, + cta = "Learn more", + ...props +}) => ( + + + + + {title} + {subTitle} + + } + /> + + +) + +export default LinkDetailsListItem diff --git a/src/components/TokenBalanceInput/index.tsx b/src/components/TokenBalanceInput/index.tsx index 46295ff5b..3a357e9e6 100644 --- a/src/components/TokenBalanceInput/index.tsx +++ b/src/components/TokenBalanceInput/index.tsx @@ -13,10 +13,13 @@ import { } from "@chakra-ui/react" import { createIcon } from "@chakra-ui/icons" import { formatUnits, parseUnits } from "@ethersproject/units" +import { Zero } from "@ethersproject/constants" +import { BigNumber } from "@ethersproject/bignumber" import NumberInput, { NumberInputValues, NumberInputProps, } from "../NumberInput" +import { web3 as web3Constants } from "../../constants" export interface TokenBalanceInputProps extends InputProps, @@ -59,7 +62,20 @@ const TokenBalanceInput: FC = ({ }) const setToMax = () => { - _setAmount(formatUnits(max)) + let remainder = Zero + const { decimalScale } = inputProps + if ( + decimalScale && + decimalScale > 0 && + decimalScale < web3Constants.STANDARD_ERC20_DECIMALS + ) { + remainder = BigNumber.from(max).mod( + BigNumber.from(10).pow( + web3Constants.STANDARD_ERC20_DECIMALS - decimalScale + ) + ) + } + _setAmount(formatUnits(BigNumber.from(max).sub(remainder))) setAmount(valueRef.current) } diff --git a/src/constants/index.ts b/src/constants/index.ts index 1c1cacece..d8ca99051 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -1,2 +1,3 @@ export * as vendingMachine from "./vendingMachine" export * as stakingBonus from "./stakingBonus" +export * as web3 from "./web3" diff --git a/src/constants/vendingMachine.ts b/src/constants/vendingMachine.ts index 89489827d..73f1f249c 100644 --- a/src/constants/vendingMachine.ts +++ b/src/constants/vendingMachine.ts @@ -1,6 +1,6 @@ import { BigNumber } from "@ethersproject/bignumber" +import { STANDARD_ERC20_DECIMALS } from "./web3" -const STANDARD_ERC20_DECIMALS = 18 export const WRAPPED_TOKEN_CONVERSION_PRECISION = 3 export const FLOATING_POINT_DIVISOR = BigNumber.from(10).pow( BigNumber.from(STANDARD_ERC20_DECIMALS - WRAPPED_TOKEN_CONVERSION_PRECISION) diff --git a/src/constants/web3.ts b/src/constants/web3.ts new file mode 100644 index 000000000..fce9d7b94 --- /dev/null +++ b/src/constants/web3.ts @@ -0,0 +1 @@ +export const STANDARD_ERC20_DECIMALS = 18 diff --git a/src/pages/Staking/HowItWorks/AboutAddressesCard.tsx b/src/pages/Staking/HowItWorks/AboutAddressesCard.tsx index 5388aa380..3a9b9b33e 100644 --- a/src/pages/Staking/HowItWorks/AboutAddressesCard.tsx +++ b/src/pages/Staking/HowItWorks/AboutAddressesCard.tsx @@ -1,23 +1,23 @@ import { FC, ComponentProps } from "react" import { List, ListItem } from "@chakra-ui/react" import Card from "../../../components/Card" -import { Label3 } from "../../../components/Typography" +import { Label3, Body2 } from "../../../components/Typography" import BoxLabel from "../../../components/BoxLabel" export const AboutAddressesCard: FC> = (props) => { return ( about the Addresses you need to provide - + {aboutAddresses.map((action) => ( - + {action.sectionName} {action.items.map((item, index) => ( - {item} + {item} ))} diff --git a/src/pages/Staking/HowItWorks/ProvidersCard.tsx b/src/pages/Staking/HowItWorks/ProvidersCard.tsx index b3e7704f5..f1d7d5a70 100644 --- a/src/pages/Staking/HowItWorks/ProvidersCard.tsx +++ b/src/pages/Staking/HowItWorks/ProvidersCard.tsx @@ -1,9 +1,9 @@ import { FC, ComponentProps } from "react" -import { Box, List, ListItem, HStack } from "@chakra-ui/react" +import { List } from "@chakra-ui/react" import Card from "../../../components/Card" -import { Body1, Body3, Label3 } from "../../../components/Typography" +import { Label3 } from "../../../components/Typography" import BoxLabel from "../../../components/BoxLabel" -import ExternalLink from "../../../components/ExternalLink" +import LinkDetailsListItem from "../../../components/LinkDetailsListItem" import { ExternalHref } from "../../../enums" export const ProvidersCard: FC> = (props) => { @@ -30,26 +30,13 @@ type ProviderItem = { link: ExternalHref } -const ProviderListItem: FC = ({ name, email, link }) => ( - - - - {name} - {email} - - - -) - const renderProviderListItem = (provider: ProviderItem) => ( - + ) const providers = [ diff --git a/src/pages/Staking/HowItWorks/StakingActionsCard.tsx b/src/pages/Staking/HowItWorks/StakingActionsCard.tsx index 779b32321..22d8c0e2b 100644 --- a/src/pages/Staking/HowItWorks/StakingActionsCard.tsx +++ b/src/pages/Staking/HowItWorks/StakingActionsCard.tsx @@ -1,23 +1,23 @@ import { FC, ComponentProps } from "react" import { List, ListItem } from "@chakra-ui/react" import Card from "../../../components/Card" -import { Label3 } from "../../../components/Typography" +import { Label3, Body2 } from "../../../components/Typography" import BoxLabel from "../../../components/BoxLabel" export const StakingActionsCard: FC> = (props) => { return ( - + staking actions - + {stakingActions.map((action) => ( - + {action.sectionName} {action.items.map((item, index) => ( - {item} + {item} ))} diff --git a/src/pages/Staking/HowItWorks/ThresholdStakesCard.tsx b/src/pages/Staking/HowItWorks/ThresholdStakesCard.tsx index 0a027e138..84471b45b 100644 --- a/src/pages/Staking/HowItWorks/ThresholdStakesCard.tsx +++ b/src/pages/Staking/HowItWorks/ThresholdStakesCard.tsx @@ -1,5 +1,5 @@ import { FC, ComponentProps } from "react" -import { UnorderedList, ListItem } from "@chakra-ui/react" +import { UnorderedList, ListItem, useColorModeValue } from "@chakra-ui/react" import Card from "../../../components/Card" import { Body2, Label3 } from "../../../components/Typography" import ViewInBlockExplorer from "../../../components/ViewInBlockExplorer" @@ -8,6 +8,9 @@ import { ExplorerDataType } from "../../../utils/createEtherscanLink" export const ThresholdStakesCard: FC< ComponentProps & { tStakingContractAddress: string } > = ({ tStakingContractAddress, ...props }) => { + const bulletColor = useColorModeValue("gray.700", "gray.300") + const bulletColorStyle = { "::marker": { color: bulletColor } } + return ( threshold stakes @@ -21,12 +24,16 @@ export const ThresholdStakesCard: FC< id={tStakingContractAddress} type={ExplorerDataType.ADDRESS} text="Threshold Staking Contract" - /> + />{" "} supports two types of stakes: - - Legacy Stakes (NuCypher and Keep Network stakes) - New T Stakes + + + Legacy Stakes (NuCypher and Keep Network stakes) + + + New T Stakes + ) diff --git a/src/pages/Staking/HowItWorks/index.tsx b/src/pages/Staking/HowItWorks/index.tsx index c35be9a5f..b5c681802 100644 --- a/src/pages/Staking/HowItWorks/index.tsx +++ b/src/pages/Staking/HowItWorks/index.tsx @@ -29,6 +29,7 @@ const HowItWorksPage: PageComponent = (props) => { "legacy-stakes new-t-stakes" "legacy-stakes staking-actions" "addresses staking-actions" + "addresses staking-actions" "addresses providers" `, }}