-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add new label to swaps button [SWAP-86] #3763
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,16 @@ const isRouteEnabled = (route: string, chain?: ChainInfo) => { | |
return !featureRoute || hasFeature(chain, featureRoute) | ||
} | ||
|
||
const NavItemTag = ({ item }: { item: NavItem }) => { | ||
const queueSize = useQueuedTxsLength() | ||
|
||
if (item.href === AppRoutes.transactions.history) { | ||
return <SidebarListItemCounter count={queueSize} /> | ||
} | ||
|
||
return item.tag | ||
} | ||
|
||
const Navigation = (): ReactElement => { | ||
const chain = useCurrentChain() | ||
const router = useRouter() | ||
|
@@ -56,13 +66,6 @@ const Navigation = (): ReactElement => { | |
} | ||
} | ||
|
||
const getCounter = (item: NavItem) => { | ||
// Indicate qeueued txs | ||
if (item.href === AppRoutes.transactions.history) { | ||
return queueSize | ||
} | ||
} | ||
|
||
// Route Transactions to Queue if there are queued txs, otherwise to History | ||
const getRoute = (href: string) => { | ||
if (href === AppRoutes.transactions.history && queueSize) { | ||
|
@@ -98,7 +101,7 @@ const Navigation = (): ReactElement => { | |
<SidebarListItemText data-testid="sidebar-list-item" bold> | ||
{item.label} | ||
|
||
<SidebarListItemCounter count={getCounter(item)} /> | ||
<NavItemTag item={item} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could pass queue size here to avoid calling the useQueuedTxsLength for each item. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, i've refactored it. |
||
</SidebarListItemText> | ||
</SidebarListItemButton> | ||
</ListItem> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ const darkPalette = { | |
secondary: { | ||
dark: '#636669', | ||
main: '#FFFFFF', | ||
light: '#12FF80', | ||
light: '#B0FFC9', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was synced with @TanyaEfremova |
||
background: '#1B2A22', | ||
}, | ||
border: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Alternatively it could be a boolean prop like
isNew
. Both are fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I like it being a react component. This way we could add whatever we want to other items