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
0d7e0518
Commit
0d7e0518
authored
Oct 04, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace complex logic with one more icon
parent
9df90f58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
27 deletions
+7
-27
merits_with_dot.svg
icons/merits_with_dot.svg
+4
-0
useNavItems.tsx
lib/hooks/useNavItems.tsx
+2
-27
name.d.ts
public/icons/name.d.ts
+1
-0
No files found.
icons/merits_with_dot.svg
0 → 100644
View file @
0d7e0518
<svg
viewBox=
"0 0 30 30"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<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"
/>
<circle
cx=
"24"
cy=
"7"
r=
"3"
fill=
"#E53E3E"
/>
</svg>
lib/hooks/useNavItems.tsx
View file @
0d7e0518
import
{
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -7,7 +6,6 @@ import type { NavItemInternal, NavItem, NavGroupItem } from 'types/client/naviga
...
@@ -7,7 +6,6 @@ import type { NavItemInternal, NavItem, NavGroupItem } from 'types/client/naviga
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
import
{
useRewardsContext
}
from
'
lib/contexts/rewards
'
;
import
{
useRewardsContext
}
from
'
lib/contexts/rewards
'
;
import
{
rightLineArrow
}
from
'
lib/html-entities
'
;
import
{
rightLineArrow
}
from
'
lib/html-entities
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
UserAvatar
from
'
ui/shared/UserAvatar
'
;
import
UserAvatar
from
'
ui/shared/UserAvatar
'
;
interface
ReturnType
{
interface
ReturnType
{
...
@@ -33,8 +31,6 @@ export default function useNavItems(): ReturnType {
...
@@ -33,8 +31,6 @@ export default function useNavItems(): ReturnType {
dailyReward
,
dailyReward
,
apiToken
:
rewardsApiToken
,
apiToken
:
rewardsApiToken
,
}
=
useRewardsContext
();
}
=
useRewardsContext
();
const
themeBgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
activeItemBgColor
=
useColorModeValue
(
'
blue.50
'
,
'
gray.800
'
);
return
React
.
useMemo
(()
=>
{
return
React
.
useMemo
(()
=>
{
let
blockchainNavItems
:
Array
<
NavItem
>
|
Array
<
Array
<
NavItem
>>
=
[];
let
blockchainNavItems
:
Array
<
NavItem
>
|
Array
<
Array
<
NavItem
>>
=
[];
...
@@ -280,28 +276,7 @@ export default function useNavItems(): ReturnType {
...
@@ -280,28 +276,7 @@ export default function useNavItems(): ReturnType {
text
:
rewardsBalance
?.
total
?
`
${
rewardsBalance
?.
total
}
Merits
` : 'Merits',
text
:
rewardsBalance
?.
total
?
`
${
rewardsBalance
?.
total
}
Merits
` : 'Merits',
nextRoute: { pathname: '/account/rewards' as const },
nextRoute: { pathname: '/account/rewards' as const },
onClick: rewardsApiToken ? undefined : openRewardsLoginModal,
onClick: rewardsApiToken ? undefined : openRewardsLoginModal,
iconComponent: () => (
icon: dailyReward?.available ? 'merits_with_dot' : 'merits',
<IconSvg
name="merits"
boxSize="30px"
flexShrink={ 0 }
position="relative"
_before={{
display: dailyReward?.available ? 'block' : 'none',
content: '""',
position: 'absolute',
top: '2px',
right: '1px',
width: '10px',
height: '10px',
boxSizing: 'border-box',
borderRadius: '50%',
backgroundColor: 'red.500',
border: '2px solid',
borderColor: pathname === '/account/rewards' ? activeItemBgColor : themeBgColor,
}}
/>
),
isActive: pathname === '/account/rewards',
isActive: pathname === '/account/rewards',
} : null,
} : null,
{
{
...
@@ -344,5 +319,5 @@ export default function useNavItems(): ReturnType {
...
@@ -344,5 +319,5 @@ export default function useNavItems(): ReturnType {
};
};
return { mainNavItems, accountNavItems, profileItem };
return { mainNavItems, accountNavItems, profileItem };
}, [ pathname, openRewardsLoginModal, rewardsBalance, dailyReward, rewardsApiToken
, activeItemBgColor, themeBgColor
]);
}, [ pathname, openRewardsLoginModal, rewardsBalance, dailyReward, rewardsApiToken ]);
}
}
public/icons/name.d.ts
View file @
0d7e0518
...
@@ -86,6 +86,7 @@
...
@@ -86,6 +86,7 @@
|
"
link
"
|
"
link
"
|
"
lock
"
|
"
lock
"
|
"
merits_colored
"
|
"
merits_colored
"
|
"
merits_with_dot
"
|
"
merits
"
|
"
merits
"
|
"
minus
"
|
"
minus
"
|
"
monaco/file
"
|
"
monaco/file
"
...
...
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