-
Notifications
You must be signed in to change notification settings - Fork 15
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
Hubble Stats Breadcrumbs #1470
Hubble Stats Breadcrumbs #1470
Conversation
✅ Deploy Preview for webb hubble statistic is ready! Thanks for the contribution @devpavan04
To edit notification comments on pull requests, go to your Netlify site settings. |
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.
Left some comments.
apps/hubble-stats/app/layout.tsx
Outdated
const pathname = usePathname(); | ||
|
||
const breadCrumbs = useMemo(() => { | ||
const parts = pathname.split('/'); | ||
const activeItem = parts[parts.length - 1]; | ||
|
||
const breadCrumbItems: Breadcrumb[] = [ | ||
{ | ||
label: 'Hubble Overview', | ||
isLast: activeItem !== '' ? false : true, | ||
icon: ( | ||
<ContrastLine className={activeItem !== '' ? 'fill-mono-120' : ''} /> | ||
), | ||
href: '/', | ||
}, | ||
]; | ||
|
||
if (activeItem !== '') { | ||
breadCrumbItems.push({ | ||
label: activeItem, | ||
isLast: true, | ||
icon: <CoinIcon />, | ||
href: '', | ||
}); | ||
} | ||
|
||
return breadCrumbItems; | ||
}, [pathname]); | ||
|
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.
This component should be the "server component" (or async component to fetch TVL and volume), passed fetched data into the Header
component to render. Move this logic to the Header
component, extract it into a React hook, and use it inside the Header
client component.
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.
Also, consider moving static variables (items
and footer
in this case) outside of the component.
return ( | ||
<Chip | ||
color="grey" |
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.
The default props should be defined in the component (isLast
here), instead of using BreadcrumbsItem.defaultProps = BreadcrumbsItemsDefaultProps;
as you did. You can read more about this here.
value={volume} | ||
isLoading={volume ? false : true} | ||
value={volumeValue} | ||
isLoading={volumeValue ? false : true} |
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.
isLoading
should be applied only when we are loading the tvl and volume value, not when the tvl and volume are undefined
. Maybe you can change the value
prop here to "-" if those values are undefined
.
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.
Left a comment
✅ Deploy Preview for webb hubble statistic is ready! Thanks for the contribution @devpavan04
To edit notification comments on pull requests, go to your Netlify site settings. |
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.
Left a comment, otherwise LG 👍
@@ -1,13 +1,15 @@ | |||
'use client'; |
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.
You can remove 'use client'
here.
Summary of changes
Breadcrumbs
toHeader
component inhubble-stats
dapp.Proposed area of change
apps/bridge-dapp
apps/hubble-stats
apps/stats-dapp
apps/webbsite
apps/faucet
apps/tangle-website
libs/webb-ui-components
Reference issue to close (if applicable)
Screen Recording
CleanShot.2023-07-28.at.09.33.38.mp4