Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
f80e9fa5
Commit
f80e9fa5
authored
Oct 24, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add loaders and skeletons
parent
d7a501e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
RewardsDashboard.tsx
ui/pages/RewardsDashboard.tsx
+11
-5
RewardsDashboardCardValue.tsx
ui/rewards/RewardsDashboardCardValue.tsx
+5
-4
No files found.
ui/pages/RewardsDashboard.tsx
View file @
f80e9fa5
...
@@ -77,7 +77,11 @@ const RewardsDashboard = () => {
...
@@ -77,7 +77,11 @@ 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=
{
(
contentAfter=
{
(
<
Button
isDisabled=
{
!
dailyRewardQuery
.
data
?.
available
}
onClick=
{
handleClaim
}
isLoading=
{
isClaiming
}
>
<
Button
isDisabled=
{
!
dailyRewardQuery
.
data
?.
available
}
onClick=
{
handleClaim
}
isLoading=
{
isClaiming
||
dailyRewardQuery
.
isPending
}
>
{
dailyRewardQuery
.
data
?.
available
?
{
dailyRewardQuery
.
data
?.
available
?
`Claim ${ dailyRewardValue } Merits`
:
`Claim ${ dailyRewardValue } Merits`
:
`Next claim in ${ timeLeft }`
`Next claim in ${ timeLeft }`
...
@@ -87,7 +91,8 @@ const RewardsDashboard = () => {
...
@@ -87,7 +91,8 @@ const RewardsDashboard = () => {
>
>
<
RewardsDashboardCardValue
<
RewardsDashboardCardValue
label=
"Total balance"
label=
"Total balance"
value=
{
balancesQuery
.
data
?.
total
}
value=
{
balancesQuery
.
data
?.
total
||
0
}
isLoading=
{
balancesQuery
.
isPending
}
withIcon
withIcon
hint=
{
(
hint=
{
(
<>
<>
...
@@ -107,6 +112,7 @@ const RewardsDashboard = () => {
...
@@ -107,6 +112,7 @@ const RewardsDashboard = () => {
<
RewardsDashboardCardValue
<
RewardsDashboardCardValue
label=
"Referrals"
label=
"Referrals"
value=
{
`${ numberOfReferrals } user${ numberOfReferrals === 1 ? '' : 's' }`
}
value=
{
`${ numberOfReferrals } user${ numberOfReferrals === 1 ? '' : 's' }`
}
isLoading=
{
referralsQuery
.
isPending
}
hint=
"The number of referrals who registered with your code/link."
hint=
"The number of referrals who registered with your code/link."
/>
/>
</
RewardsDashboardCard
>
</
RewardsDashboardCard
>
...
@@ -125,7 +131,7 @@ const RewardsDashboard = () => {
...
@@ -125,7 +131,7 @@ const RewardsDashboard = () => {
description=
{
(
description=
{
(
<>
<>
Refer friends and boost your merits! You receive a
{
'
'
}
Refer friends and boost your merits! You receive a
{
'
'
}
<
Skeleton
as=
"span"
isLoaded=
{
!
rewardsConfigQuery
.
is
Loa
ding
}
>
<
Skeleton
as=
"span"
isLoaded=
{
!
rewardsConfigQuery
.
is
Pen
ding
}
>
{
Number
(
rewardsConfigQuery
.
data
?.
rewards
.
referral_share
||
0
)
*
100
}
%
{
Number
(
rewardsConfigQuery
.
data
?.
rewards
.
referral_share
||
0
)
*
100
}
%
</
Skeleton
>
</
Skeleton
>
{
'
'
}
bonus on all merits earned by your referrals.
{
'
'
}
bonus on all merits earned by your referrals.
...
@@ -143,12 +149,12 @@ const RewardsDashboard = () => {
...
@@ -143,12 +149,12 @@ const RewardsDashboard = () => {
<
CopyField
<
CopyField
label=
"Referral link"
label=
"Referral link"
value=
{
`https://eth.blockscout.com?ref=${ referralsQuery.data?.code }`
}
value=
{
`https://eth.blockscout.com?ref=${ referralsQuery.data?.code }`
}
isLoading=
{
referralsQuery
.
is
Loa
ding
}
isLoading=
{
referralsQuery
.
is
Pen
ding
}
/>
/>
<
CopyField
<
CopyField
label=
"Referral code"
label=
"Referral code"
value=
{
referralsQuery
.
data
?.
code
||
''
}
value=
{
referralsQuery
.
data
?.
code
||
''
}
isLoading=
{
referralsQuery
.
is
Loa
ding
}
isLoading=
{
referralsQuery
.
is
Pen
ding
}
/>
/>
</
Flex
>
</
Flex
>
</
RewardsDashboardCard
>
</
RewardsDashboardCard
>
...
...
ui/rewards/RewardsDashboardCardValue.tsx
View file @
f80e9fa5
import
{
Flex
,
Text
,
Icon
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Text
,
Icon
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
// This icon doesn't work properly when it is in the sprite
// This icon doesn't work properly when it is in the sprite
...
@@ -12,9 +12,10 @@ type Props = {
...
@@ -12,9 +12,10 @@ type Props = {
value
:
number
|
string
|
undefined
;
value
:
number
|
string
|
undefined
;
withIcon
?:
boolean
;
withIcon
?:
boolean
;
hint
?:
string
|
React
.
ReactNode
;
hint
?:
string
|
React
.
ReactNode
;
isLoading
?:
boolean
;
}
}
const
RewardsDashboardCard
=
({
label
,
value
,
withIcon
,
hint
}:
Props
)
=>
{
const
RewardsDashboardCard
=
({
label
,
value
,
withIcon
,
hint
,
isLoading
}:
Props
)
=>
{
return
(
return
(
<
Flex
key=
{
label
}
flexDirection=
"column"
alignItems=
"center"
gap=
{
2
}
>
<
Flex
key=
{
label
}
flexDirection=
"column"
alignItems=
"center"
gap=
{
2
}
>
<
Flex
alignItems=
"center"
gap=
{
1
}
>
<
Flex
alignItems=
"center"
gap=
{
1
}
>
...
@@ -29,14 +30,14 @@ const RewardsDashboardCard = ({ label, value, withIcon, hint }: Props) => {
...
@@ -29,14 +30,14 @@ const RewardsDashboardCard = ({ label, value, withIcon, hint }: Props) => {
{
label
}
{
label
}
</
Text
>
</
Text
>
</
Flex
>
</
Flex
>
<
Flex
alignItems=
"center
"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
display=
"flex"
alignItems=
"center"
justifyContent=
"center"
minW=
"100px
"
>
{
withIcon
&&
(
{
withIcon
&&
(
<
Icon
as=
{
meritsIcon
}
boxSize=
{
12
}
mt=
{
-
2
}
mb=
{
-
2.5
}
/>
<
Icon
as=
{
meritsIcon
}
boxSize=
{
12
}
mt=
{
-
2
}
mb=
{
-
2.5
}
/>
)
}
)
}
<
Text
fontSize=
{
{
base
:
'
24px
'
,
md
:
'
32px
'
}
}
lineHeight=
{
{
base
:
'
24px
'
,
md
:
1.5
}
}
fontWeight=
"500"
>
<
Text
fontSize=
{
{
base
:
'
24px
'
,
md
:
'
32px
'
}
}
lineHeight=
{
{
base
:
'
24px
'
,
md
:
1.5
}
}
fontWeight=
"500"
>
{
value
}
{
value
}
</
Text
>
</
Text
>
</
Flex
>
</
Skeleton
>
</
Flex
>
</
Flex
>
);
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment