Commit 02026c49 authored by Max Alekseenko's avatar Max Alekseenko Committed by GitHub

Merits dashboard minor changes (#2637)

move hint, remove label
parent 7b45a38a
...@@ -67,12 +67,6 @@ const RewardsDashboard = () => { ...@@ -67,12 +67,6 @@ const RewardsDashboard = () => {
description="Claim your daily Merits and any Merits received from referrals." description="Claim your daily Merits and any Merits received from referrals."
direction="column-reverse" direction="column-reverse"
contentAfter={ <DailyRewardClaimButton/> } contentAfter={ <DailyRewardClaimButton/> }
>
<RewardsDashboardCardValue
label="Total balance"
value={ balancesQuery.data?.total || 'N/A' }
isLoading={ balancesQuery.isPending }
withIcon
hint={ ( hint={ (
<> <>
Total number of Merits earned from all activities.{ ' ' } Total number of Merits earned from all activities.{ ' ' }
...@@ -81,6 +75,11 @@ const RewardsDashboard = () => { ...@@ -81,6 +75,11 @@ const RewardsDashboard = () => {
</LinkExternal> </LinkExternal>
</> </>
) } ) }
>
<RewardsDashboardCardValue
value={ balancesQuery.data?.total || 'N/A' }
isLoading={ balancesQuery.isPending }
withIcon
/> />
</RewardsDashboardCard> </RewardsDashboardCard>
<RewardsDashboardCard <RewardsDashboardCard
...@@ -89,7 +88,6 @@ const RewardsDashboard = () => { ...@@ -89,7 +88,6 @@ const RewardsDashboard = () => {
direction="column-reverse" direction="column-reverse"
> >
<RewardsDashboardCardValue <RewardsDashboardCardValue
label="Referrals"
value={ referralsQuery.data?.referrals ? value={ referralsQuery.data?.referrals ?
`${ referralsQuery.data?.referrals } user${ Number(referralsQuery.data?.referrals) === 1 ? '' : 's' }` : `${ referralsQuery.data?.referrals } user${ Number(referralsQuery.data?.referrals) === 1 ? '' : 's' }` :
'N/A' 'N/A'
...@@ -111,16 +109,6 @@ const RewardsDashboard = () => { ...@@ -111,16 +109,6 @@ const RewardsDashboard = () => {
</LinkExternal> </LinkExternal>
</> </>
) } ) }
direction="column-reverse"
>
<RewardsDashboardCardValue
label="Streak"
value={
dailyRewardQuery.data?.streak ?
`${ dailyRewardQuery.data?.streak } day${ Number(dailyRewardQuery.data?.streak) === 1 ? '' : 's' }` :
'N/A'
}
isLoading={ dailyRewardQuery.isPending }
hint={ ( hint={ (
<> <>
See the{ ' ' } See the{ ' ' }
...@@ -133,6 +121,15 @@ const RewardsDashboard = () => { ...@@ -133,6 +121,15 @@ const RewardsDashboard = () => {
to learn how your streak number affects daily rewards to learn how your streak number affects daily rewards
</> </>
) } ) }
direction="column-reverse"
>
<RewardsDashboardCardValue
value={
dailyRewardQuery.data?.streak ?
`${ dailyRewardQuery.data?.streak } day${ Number(dailyRewardQuery.data?.streak) === 1 ? '' : 's' }` :
'N/A'
}
isLoading={ dailyRewardQuery.isPending }
/> />
</RewardsDashboardCard> </RewardsDashboardCard>
</Flex> </Flex>
......
import { Flex, Text, useColorModeValue, Tag } from '@chakra-ui/react'; import { Flex, Text, useColorModeValue, Tag } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import HintPopover from 'ui/shared/HintPopover';
type Props = { type Props = {
title?: string; title: string;
description: string | React.ReactNode; description: string | React.ReactNode;
hint?: string | React.ReactNode;
availableSoon?: boolean; availableSoon?: boolean;
blurFilter?: boolean; blurFilter?: boolean;
contentAfter?: React.ReactNode; contentAfter?: React.ReactNode;
...@@ -13,7 +16,7 @@ type Props = { ...@@ -13,7 +16,7 @@ type Props = {
}; };
const RewardsDashboardCard = ({ const RewardsDashboardCard = ({
title, description, availableSoon, contentAfter, title, description, hint, availableSoon, contentAfter,
direction = 'column', children, blurFilter, direction = 'column', children, blurFilter,
}: Props) => { }: Props) => {
return ( return (
...@@ -34,12 +37,19 @@ const RewardsDashboardCard = ({ ...@@ -34,12 +37,19 @@ const RewardsDashboardCard = ({
p={{ base: 1.5, md: 3 }} p={{ base: 1.5, md: 3 }}
w={{ base: 'full', md: direction === 'row' ? '340px' : 'full' }} w={{ base: 'full', md: direction === 'row' ? '340px' : 'full' }}
> >
{ title && (
<Flex alignItems="center" gap={ 2 }> <Flex alignItems="center" gap={ 2 }>
<Text fontSize={{ base: 'md', md: 'lg' }} fontWeight="500">{ title }</Text> <Text fontSize={{ base: 'md', md: 'lg' }} fontWeight="500">{ title }</Text>
{ hint && (
<HintPopover
label={ hint }
popoverContentProps={{
maxW: { base: 'calc(100vw - 8px)', lg: '210px' },
}}
popoverBodyProps={{ textAlign: 'center' }}
/>
) }
{ availableSoon && <Tag colorScheme="blue">Available soon</Tag> } { availableSoon && <Tag colorScheme="blue">Available soon</Tag> }
</Flex> </Flex>
) }
<Text as="div" fontSize="sm"> <Text as="div" fontSize="sm">
{ description } { description }
</Text> </Text>
......
...@@ -7,7 +7,7 @@ import HintPopover from 'ui/shared/HintPopover'; ...@@ -7,7 +7,7 @@ import HintPopover from 'ui/shared/HintPopover';
import MeritsIcon from '../MeritsIcon'; import MeritsIcon from '../MeritsIcon';
type Props = { type Props = {
label: string; label?: string;
value: number | string | undefined; value: number | string | undefined;
withIcon?: boolean; withIcon?: boolean;
hint?: string | React.ReactNode; hint?: string | React.ReactNode;
...@@ -16,6 +16,7 @@ type Props = { ...@@ -16,6 +16,7 @@ type Props = {
const RewardsDashboardCard = ({ label, value, withIcon, hint, isLoading }: Props) => ( const RewardsDashboardCard = ({ label, value, withIcon, hint, isLoading }: Props) => (
<Flex key={ label } flexDirection="column" alignItems="center" gap={ 2 }> <Flex key={ label } flexDirection="column" alignItems="center" gap={ 2 }>
{ label && (
<Flex alignItems="center" gap={ 1 }> <Flex alignItems="center" gap={ 1 }>
{ hint && ( { hint && (
<HintPopover <HintPopover
...@@ -28,6 +29,7 @@ const RewardsDashboardCard = ({ label, value, withIcon, hint, isLoading }: Props ...@@ -28,6 +29,7 @@ const RewardsDashboardCard = ({ label, value, withIcon, hint, isLoading }: Props
{ label } { label }
</Text> </Text>
</Flex> </Flex>
) }
<Skeleton <Skeleton
isLoaded={ !isLoading } isLoaded={ !isLoading }
display="flex" display="flex"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment