Commit 805ad3de authored by Max Alekseenko's avatar Max Alekseenko

post-review changes

parent 3451a0a4
...@@ -801,7 +801,7 @@ This feature enables Blockscout Merits program. It requires that the [My account ...@@ -801,7 +801,7 @@ This feature enables Blockscout Merits program. It requires that the [My account
| Variable | Type| Description | Compulsoriness | Default value | Example value | Version | | Variable | Type| Description | Compulsoriness | Default value | Example value | Version |
| --- | --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- | --- |
| NEXT_PUBLIC_REWARDS_SERVICE_API_HOST | `string` | API url | - | - | `https://example.com` | v1.36.0+ | | NEXT_PUBLIC_REWARDS_SERVICE_API_HOST | `string` | API URL | - | - | `https://example.com` | v1.36.0+ |
## External services configuration ## External services configuration
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" fill="none">
<path d="M10.229 6.946c.401 0 .727.329.727.735v.636a.731.731 0 0 1-.727.735h-.353a.731.731 0 0 0-.727.735v6.532a.731.731 0 0 1-.727.735h-.695A.731.731 0 0 1 7 16.32V9.787c0-.406.326-.735.727-.735h.353c.401 0 .727-.33.727-.736v-.635c0-.406.325-.735.727-.735h.694ZM14.54 6.946c.403 0 .728.329.728.735v.635c0 .407.326.736.727.736h.278c.401 0 .727.329.727.735v6.532a.731.731 0 0 1-.727.735h-.695a.731.731 0 0 1-.727-.735V9.787a.731.731 0 0 0-.727-.735h-.278a.731.731 0 0 1-.727-.735V7.68c0-.406.326-.735.727-.735h.695ZM12.362 10.977c.402 0 .727.33.727.735v2.622a.731.731 0 0 1-.727.735h-.694a.731.731 0 0 1-.728-.736v-2.62c0-.407.326-.736.728-.736h.694Z" fill="currentColor"/> <path d="M13.229 9.946c.401 0 .727.329.727.735v.636a.731.731 0 0 1-.727.735h-.353a.731.731 0 0 0-.727.735v6.532a.731.731 0 0 1-.727.735h-.695A.731.731 0 0 1 10 19.32v-6.532c0-.406.326-.735.727-.735h.352c.402 0 .728-.33.728-.736v-.635a.73.73 0 0 1 .727-.735h.694Zm4.311 0c.402 0 .728.329.728.735v.636c0 .405.326.735.727.735h.278c.401 0 .727.329.727.735v6.532a.731.731 0 0 1-.727.735h-.695a.731.731 0 0 1-.727-.735v-6.532a.731.731 0 0 0-.727-.735h-.278a.731.731 0 0 1-.727-.736v-.635c0-.406.326-.735.727-.735h.695Zm-2.178 4.031c.402 0 .727.33.727.735v2.622a.731.731 0 0 1-.727.735h-.694a.731.731 0 0 1-.728-.735v-2.622c0-.406.326-.735.728-.735h.694Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.894 1.213a1.98 1.98 0 0 0-1.788 0l-8 4.044A2.024 2.024 0 0 0 2 7.065v9.87c0 .766.428 1.466 1.106 1.808l8 4.044a1.981 1.981 0 0 0 1.788 0l8-4.044A2.024 2.024 0 0 0 22 16.935v-9.87c0-.766-.428-1.466-1.106-1.808l-8-4.044ZM4 7.065l8-4.043 8 4.043v9.87l-8 4.043-8-4.043v-9.87Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M15.894 4.213a1.98 1.98 0 0 0-1.788 0l-8 4.044A2.024 2.024 0 0 0 5 10.065v9.87c0 .766.428 1.466 1.106 1.808l8 4.044a1.981 1.981 0 0 0 1.788 0l8-4.044A2.024 2.024 0 0 0 25 19.935v-9.87c0-.766-.428-1.466-1.106-1.808l-8-4.044ZM7 10.065l8-4.043 8 4.043v9.87l-8 4.043-8-4.043v-9.87Z" fill="currentColor"/>
</svg> </svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" fill="none"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
<path d="M13.229 9.946c.401 0 .727.329.727.735v.636a.731.731 0 0 1-.727.735h-.353a.731.731 0 0 0-.727.735v6.532a.731.731 0 0 1-.727.735h-.695A.731.731 0 0 1 10 19.32v-6.532c0-.406.326-.735.727-.735h.352c.402 0 .728-.33.728-.736v-.635a.73.73 0 0 1 .727-.735h.694ZM17.54 9.946c.402 0 .728.329.728.735v.636c0 .405.326.735.727.735h.278c.401 0 .727.329.727.735v6.532a.731.731 0 0 1-.727.735h-.695a.731.731 0 0 1-.727-.735v-6.532a.731.731 0 0 0-.727-.735h-.278a.731.731 0 0 1-.727-.736v-.635c0-.406.326-.735.727-.735h.695ZM15.362 13.977c.402 0 .727.33.727.735v2.622a.731.731 0 0 1-.727.735h-.694a.731.731 0 0 1-.728-.735v-2.622c0-.406.326-.735.728-.735h.694Z" fill="currentColor"/> <path d="M10.229 6.946c.401 0 .727.329.727.735v.636a.731.731 0 0 1-.727.735h-.353a.731.731 0 0 0-.727.735v6.532a.731.731 0 0 1-.727.735h-.695A.731.731 0 0 1 7 16.32V9.787c0-.406.326-.735.727-.735h.353c.401 0 .727-.33.727-.736v-.635a.73.73 0 0 1 .727-.735h.694Zm4.311 0a.73.73 0 0 1 .728.735v.635c0 .407.326.736.727.736h.278c.401 0 .727.329.727.735v6.532a.731.731 0 0 1-.727.735h-.695a.731.731 0 0 1-.727-.735V9.787a.731.731 0 0 0-.727-.735h-.278a.731.731 0 0 1-.727-.735V7.68c0-.406.326-.735.727-.735h.695Zm-2.178 4.031c.402 0 .727.33.727.735v2.622a.731.731 0 0 1-.727.735h-.694a.731.731 0 0 1-.728-.736v-2.62c0-.407.326-.736.728-.736h.694Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.894 4.213a1.98 1.98 0 0 0-1.788 0l-8 4.044A2.024 2.024 0 0 0 5 10.065v9.87c0 .766.428 1.466 1.106 1.808l8 4.044a1.981 1.981 0 0 0 1.788 0l8-4.044A2.024 2.024 0 0 0 25 19.935v-9.87c0-.766-.428-1.466-1.106-1.808l-8-4.044ZM7 10.065l8-4.043 8 4.043v9.87l-8 4.043-8-4.043v-9.87Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M12.894 1.213a1.98 1.98 0 0 0-1.788 0l-8 4.044A2.024 2.024 0 0 0 2 7.065v9.87c0 .766.428 1.466 1.106 1.808l8 4.044a1.981 1.981 0 0 0 1.788 0l8-4.044A2.024 2.024 0 0 0 22 16.935v-9.87c0-.766-.428-1.466-1.106-1.808l-8-4.044ZM4 7.065l8-4.043 8 4.043v9.87l-8 4.043-8-4.043v-9.87Z" fill="currentColor"/>
</svg> </svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="m16.133 2.85-3.239-1.637a1.98 1.98 0 0 0-1.788 0l-8 4.044A2.024 2.024 0 0 0 2 7.065v9.87c0 .766.428 1.466 1.106 1.808l8 4.044a1.981 1.981 0 0 0 1.788 0l8-4.044A2.024 2.024 0 0 0 22 16.935V8.9a5.022 5.022 0 0 1-2 0v8.035l-8 4.043-8-4.043v-9.87l8-4.043 4.123 2.083a5.02 5.02 0 0 1 .01-2.255Zm-5.177 4.83a.731.731 0 0 0-.727-.734h-.695a.731.731 0 0 0-.727.735v.635a.731.731 0 0 1-.727.736h-.353A.731.731 0 0 0 7 9.787v6.532c0 .406.326.735.727.735h.695c.401 0 .727-.329.727-.735V9.787c0-.406.326-.735.727-.735h.353c.401 0 .727-.33.727-.735V7.68Zm4.312 0a.731.731 0 0 0-.727-.734h-.695a.731.731 0 0 0-.727.735v.636c0 .406.326.735.727.735h.278c.401 0 .727.329.727.735v6.532c0 .406.326.735.727.735h.695c.401 0 .727-.329.727-.735V9.787a.731.731 0 0 0-.727-.735h-.278a.731.731 0 0 1-.727-.736v-.635Zm-2.906 3.297c.402 0 .727.33.727.735v2.622a.731.731 0 0 1-.727.735h-.694a.731.731 0 0 1-.728-.736v-2.62c0-.407.326-.736.728-.736h.694Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="m19.133 5.85-3.239-1.637a1.98 1.98 0 0 0-1.788 0l-8 4.044A2.024 2.024 0 0 0 5 10.065v9.87c0 .766.428 1.466 1.106 1.808l8 4.044a1.981 1.981 0 0 0 1.788 0l8-4.044A2.024 2.024 0 0 0 25 19.935V11.9a5.022 5.022 0 0 1-2 0v8.035l-8 4.043-8-4.043v-9.87l8-4.043 4.123 2.083a5.02 5.02 0 0 1 .01-2.255Zm-5.177 4.83a.731.731 0 0 0-.727-.734h-.695a.731.731 0 0 0-.727.735v.636a.731.731 0 0 1-.728.735h-.352a.731.731 0 0 0-.727.735v6.532c0 .406.326.735.727.735h.695a.731.731 0 0 0 .727-.735v-6.532c0-.406.326-.735.727-.735h.353c.401 0 .727-.33.727-.736v-.635Zm4.312 0a.731.731 0 0 0-.727-.734h-.695a.731.731 0 0 0-.727.735v.636c0 .406.326.735.727.735h.278a.73.73 0 0 1 .727.735v6.532c0 .406.326.735.727.735h.695a.731.731 0 0 0 .727-.735v-6.532a.731.731 0 0 0-.727-.735h-.278a.731.731 0 0 1-.727-.736v-.635Zm-2.906 3.297c.402 0 .727.33.727.735v2.622a.731.731 0 0 1-.727.735h-.694a.731.731 0 0 1-.728-.735v-2.622c0-.406.326-.735.728-.735h.694Z" fill="currentColor"/>
<circle cx="21" cy="4" r="3" fill="#E53E3E"/> <circle cx="24" cy="7" r="3" fill="#E53E3E"/>
</svg> </svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" fill="none"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="m19.133 5.85-3.239-1.637a1.98 1.98 0 0 0-1.788 0l-8 4.044A2.024 2.024 0 0 0 5 10.065v9.87c0 .766.428 1.466 1.106 1.808l8 4.044a1.981 1.981 0 0 0 1.788 0l8-4.044A2.024 2.024 0 0 0 25 19.935V11.9a5.022 5.022 0 0 1-2 0v8.035l-8 4.043-8-4.043v-9.87l8-4.043 4.123 2.083a5.02 5.02 0 0 1 .01-2.255Zm-5.177 4.83a.731.731 0 0 0-.727-.734h-.695a.731.731 0 0 0-.727.735v.636a.731.731 0 0 1-.728.735h-.352a.731.731 0 0 0-.727.735v6.532c0 .406.326.735.727.735h.695c.401 0 .727-.329.727-.735v-6.532c0-.406.326-.735.727-.735h.353c.401 0 .727-.33.727-.736v-.635Zm4.312 0a.731.731 0 0 0-.727-.734h-.695a.731.731 0 0 0-.727.735v.636c0 .406.326.735.727.735h.278c.402 0 .727.329.727.735v6.532c0 .406.326.735.727.735h.695c.401 0 .727-.329.727-.735v-6.532a.731.731 0 0 0-.727-.735h-.278a.731.731 0 0 1-.727-.736v-.635Zm-2.906 3.297c.402 0 .727.33.727.735v2.622a.731.731 0 0 1-.727.735h-.694a.731.731 0 0 1-.728-.735v-2.622c0-.406.326-.735.728-.735h.694Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="m16.133 2.85-3.239-1.637a1.98 1.98 0 0 0-1.788 0l-8 4.044A2.024 2.024 0 0 0 2 7.065v9.87c0 .766.428 1.466 1.106 1.808l8 4.044a1.981 1.981 0 0 0 1.788 0l8-4.044A2.024 2.024 0 0 0 22 16.935V8.9a5.022 5.022 0 0 1-2 0v8.035l-8 4.043-8-4.043v-9.87l8-4.043 4.123 2.083a5.02 5.02 0 0 1 .01-2.255Zm-5.177 4.83a.731.731 0 0 0-.727-.734h-.695a.731.731 0 0 0-.727.735v.635a.731.731 0 0 1-.727.736h-.353A.731.731 0 0 0 7 9.787v6.532c0 .406.326.735.727.735h.695a.731.731 0 0 0 .727-.735V9.787c0-.406.326-.735.727-.735h.353c.401 0 .727-.33.727-.735V7.68Zm4.312 0a.731.731 0 0 0-.727-.734h-.695a.731.731 0 0 0-.727.735v.636c0 .406.326.735.727.735h.278c.401 0 .727.329.727.735v6.532c0 .406.326.735.727.735h.695a.731.731 0 0 0 .727-.735V9.787a.731.731 0 0 0-.727-.735h-.278a.731.731 0 0 1-.727-.736v-.635Zm-2.906 3.297c.402 0 .727.33.727.735v2.622a.731.731 0 0 1-.727.735h-.694a.731.731 0 0 1-.728-.736v-2.62c0-.407.326-.736.728-.736h.694Z" fill="currentColor"/>
<circle cx="24" cy="7" r="3" fill="#E53E3E"/> <circle cx="21" cy="4" r="3" fill="#E53E3E"/>
</svg> </svg>
...@@ -227,7 +227,7 @@ export function RewardsContextProvider({ children }: Props) { ...@@ -227,7 +227,7 @@ export function RewardsContextProvider({ children }: Props) {
saveApiToken(loginResponse.token); saveApiToken(loginResponse.token);
return { isNewUser: loginResponse.created }; return { isNewUser: loginResponse.created };
} catch (_error) { } catch (_error) {
errorToast(_error as ResourceError<{ message: string }>); errorToast(_error);
throw _error; throw _error;
} }
}, [ apiFetch, address, signMessageAsync, errorToast, saveApiToken, checkUserQuery ]); }, [ apiFetch, address, signMessageAsync, errorToast, saveApiToken, checkUserQuery ]);
...@@ -242,7 +242,7 @@ export function RewardsContextProvider({ children }: Props) { ...@@ -242,7 +242,7 @@ export function RewardsContextProvider({ children }: Props) {
}, },
}) as RewardsUserDailyClaimResponse; }) as RewardsUserDailyClaimResponse;
} catch (_error) { } catch (_error) {
errorToast(_error as ResourceError<{ message: string }>); errorToast(_error);
throw _error; throw _error;
} }
}, [ apiFetch, errorToast, fetchParams ]); }, [ apiFetch, errorToast, fetchParams ]);
......
...@@ -7,7 +7,7 @@ import { apos } from 'lib/html-entities'; ...@@ -7,7 +7,7 @@ import { apos } from 'lib/html-entities';
import DailyRewardClaimButton from 'ui/rewards/dashboard/DailyRewardClaimButton'; import DailyRewardClaimButton from 'ui/rewards/dashboard/DailyRewardClaimButton';
import RewardsDashboardCard from 'ui/rewards/dashboard/RewardsDashboardCard'; import RewardsDashboardCard from 'ui/rewards/dashboard/RewardsDashboardCard';
import RewardsDashboardCardValue from 'ui/rewards/dashboard/RewardsDashboardCardValue'; import RewardsDashboardCardValue from 'ui/rewards/dashboard/RewardsDashboardCardValue';
import ReadOnlyInputWithCopy from 'ui/rewards/ReadOnlyInputWithCopy'; import RewardsReadOnlyInputWithCopy from 'ui/rewards/RewardsReadOnlyInputWithCopy';
import LinkExternal from 'ui/shared/links/LinkExternal'; import LinkExternal from 'ui/shared/links/LinkExternal';
import PageTitle from 'ui/shared/Page/PageTitle'; import PageTitle from 'ui/shared/Page/PageTitle';
import useRedirectForInvalidAuthToken from 'ui/snippets/auth/useRedirectForInvalidAuthToken'; import useRedirectForInvalidAuthToken from 'ui/snippets/auth/useRedirectForInvalidAuthToken';
...@@ -107,13 +107,13 @@ const RewardsDashboard = () => { ...@@ -107,13 +107,13 @@ const RewardsDashboard = () => {
py={{ base: 4, md: 0 }} py={{ base: 4, md: 0 }}
flexDirection={{ base: 'column', md: 'row' }} flexDirection={{ base: 'column', md: 'row' }}
> >
<ReadOnlyInputWithCopy <RewardsReadOnlyInputWithCopy
label="Referral link" label="Referral link"
value={ `https://eth.blockscout.com?ref=${ referralsQuery.data?.code }` } value={ referralsQuery.data?.link || '' }
isLoading={ referralsQuery.isPending } isLoading={ referralsQuery.isPending }
flex={ 2 } flex={ 2 }
/> />
<ReadOnlyInputWithCopy <RewardsReadOnlyInputWithCopy
label="Referral code" label="Referral code"
value={ referralsQuery.data?.code || '' } value={ referralsQuery.data?.code || '' }
isLoading={ referralsQuery.isPending } isLoading={ referralsQuery.isPending }
......
...@@ -50,7 +50,7 @@ const RewardsButton = ({ variant = 'header', size }: Props) => { ...@@ -50,7 +50,7 @@ const RewardsButton = ({ variant = 'header', size }: Props) => {
}} }}
> >
<IconSvg <IconSvg
name={ dailyRewardQuery.data?.available ? 'merits_with_dot' : 'merits' } name={ dailyRewardQuery.data?.available ? 'merits_with_dot_slim' : 'merits_slim' }
boxSize={ variant === 'hero' ? 6 : 5 } boxSize={ variant === 'hero' ? 6 : 5 }
flexShrink={ 0 } flexShrink={ 0 }
/> />
......
...@@ -77,7 +77,7 @@ const RewardsNavLink = ({ isCollapsed, onClick }: Props) => { ...@@ -77,7 +77,7 @@ const RewardsNavLink = ({ isCollapsed, onClick }: Props) => {
margin={ 0 } margin={ 0 }
> >
<HStack spacing={ 0 } overflow="hidden"> <HStack spacing={ 0 } overflow="hidden">
<NavLinkIcon item={{ icon: dailyRewardQuery.data?.available ? 'merits_with_dot_slim' : 'merits_slim' } as NavItem}/> <NavLinkIcon item={{ icon: dailyRewardQuery.data?.available ? 'merits_with_dot' : 'merits' } as NavItem}/>
<Text { ...styleProps.textProps } as="span" ml={ 3 }> <Text { ...styleProps.textProps } as="span" ml={ 3 }>
Merits Merits
</Text> </Text>
......
...@@ -11,7 +11,7 @@ type Props = { ...@@ -11,7 +11,7 @@ type Props = {
isLoading?: boolean; isLoading?: boolean;
}; };
const ReadOnlyInputWithCopy = ({ label, value, className, isLoading }: Props) => ( const RewardsReadOnlyInputWithCopy = ({ label, value, className, isLoading }: Props) => (
<FormControl variant="floating" id={ label } className={ className }> <FormControl variant="floating" id={ label } className={ className }>
<Skeleton isLoaded={ !isLoading }> <Skeleton isLoaded={ !isLoading }>
<InputGroup> <InputGroup>
...@@ -36,4 +36,4 @@ const ReadOnlyInputWithCopy = ({ label, value, className, isLoading }: Props) => ...@@ -36,4 +36,4 @@ const ReadOnlyInputWithCopy = ({ label, value, className, isLoading }: Props) =>
</FormControl> </FormControl>
); );
export default chakra(ReadOnlyInputWithCopy); export default chakra(RewardsReadOnlyInputWithCopy);
...@@ -37,7 +37,7 @@ const DailyRewardClaimButton = () => { ...@@ -37,7 +37,7 @@ const DailyRewardClaimButton = () => {
const formattedDate = dailyRewardQuery.data.reset_at.replace(' ', 'T').replace(' UTC', 'Z'); const formattedDate = dailyRewardQuery.data.reset_at.replace(' ', 'T').replace(' UTC', 'Z');
const target = new Date(formattedDate).getTime(); const target = new Date(formattedDate).getTime();
let interval: ReturnType<typeof setTimeout>; // eslint-disable-line prefer-const let interval = 0;
const updateCountdown = (target: number) => { const updateCountdown = (target: number) => {
const now = new Date().getTime(); const now = new Date().getTime();
...@@ -55,7 +55,7 @@ const DailyRewardClaimButton = () => { ...@@ -55,7 +55,7 @@ const DailyRewardClaimButton = () => {
updateCountdown(target); updateCountdown(target);
interval = setInterval(() => { interval = window.setInterval(() => {
updateCountdown(target); updateCountdown(target);
}, SECOND); }, SECOND);
......
...@@ -7,7 +7,7 @@ import { useRewardsContext } from 'lib/contexts/rewards'; ...@@ -7,7 +7,7 @@ import { useRewardsContext } from 'lib/contexts/rewards';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
import MeritsIcon from '../../MeritsIcon'; import MeritsIcon from '../../MeritsIcon';
import ReadOnlyInputWithCopy from '../../ReadOnlyInputWithCopy'; import RewardsReadOnlyInputWithCopy from '../../RewardsReadOnlyInputWithCopy';
type Props = { type Props = {
isReferral: boolean; isReferral: boolean;
...@@ -89,7 +89,7 @@ const CongratsStepContent = ({ isReferral }: Props) => { ...@@ -89,7 +89,7 @@ const CongratsStepContent = ({ isReferral }: Props) => {
</Skeleton> </Skeleton>
{ ' ' }bonus on all merits earned by your referrals { ' ' }bonus on all merits earned by your referrals
</Text> </Text>
<ReadOnlyInputWithCopy <RewardsReadOnlyInputWithCopy
label="Referral link" label="Referral link"
value={ refLink } value={ refLink }
isLoading={ referralsQuery.isLoading } isLoading={ referralsQuery.isLoading }
......
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