Skip to content
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

πŸš€ New features and improvements (#18) #19

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

56 changes: 0 additions & 56 deletions .eslintrc.json

This file was deleted.

Binary file added bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SnackbarProvider } from 'notistack'
import React, { useMemo } from 'react'

import { Box, GlobalStyles, NoSsr, darken, useMediaQuery, useTheme } from '@mui/material'
import { Box, GlobalStyles, NoSsr, lighten, useMediaQuery, useTheme } from '@mui/material'

import { ConsentBlock } from 'components/consent/ConsentBlock'

Expand Down Expand Up @@ -98,7 +98,7 @@ const Layout = ({ children, hasSearchBar = true, pageTitle }: LayoutProps) => {
height: '8px',
},
'*::-webkit-scrollbar-thumb': {
backgroundColor: darken(`${theme.palette.border?.level2}55`, 0.3),
backgroundColor: lighten(`${theme.palette.border?.level3}55`, 0.4),
borderRadius: '8px',
},
'*::-webkit-scrollbar-track': {
Expand Down
2 changes: 2 additions & 0 deletions components/Layout/components/Sidebar/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export enum PAGES {
HOME = 'Home',
EXPLORE = 'Explore',
LEADERBOARD = 'Leaderboard',
CONTRACTS_LEADERBOARD = 'Contracts Leaderboard',
RECENT_ACTIVITY = 'Recent Activity',
DASHBOARD = 'Dashboard',
MEMPOOL = 'Mempool',
Expand All @@ -40,6 +41,7 @@ export enum PAGES {
TERMS_OF_SERVICE = 'Terms Of Service',
CHANGELOG = 'Changelog',
RESOURCES = 'Resources',
TOKENS = 'Tokens',
}

/**
Expand Down
40 changes: 21 additions & 19 deletions components/Layout/components/TopBar/Buttons/WalletButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,30 @@ interface WalletButtonProps {
}

/**
* Buttons component.
* WalletButton component.
*
* This component provides the interface for the top bar buttons.
* This component renders a button in the top bar for wallet interactions.
*
* @param menuItems - The menu items.
* @param setMenuItems - The function to set the menu items.
*
* @returns The JSX element of the Buttons component.
* @param {WalletButtonProps} props - The props for the component.
* @returns {JSX.Element} The rendered component.
*/
const WalletButton: React.FC<WalletButtonProps> = ({ level = 'second' }) => {
const { t } = useTranslation()
const theme = useTheme()
const { isConnected, provider, gatherData, openWallet, setOpenWallet, switchChain } = useWalletStore(s => s)
const { filAddr, ethAddr, network: walletNetwork } = useWalletStore(s => s.walletInfo)
const { network } = useAppSettingsStore(state => ({ network: state.network }))
const [open, setOpen] = useState(false)
const [open, setOpen] = useState<boolean>(false)

const address = useMemo(() => {
return filAddr ?? ethAddr
}, [filAddr, ethAddr])
const address = useMemo(() => filAddr ?? ethAddr, [filAddr, ethAddr])

const handleClick = useCallback(() => {
setOpen(prev => !prev)
}, [setOpen])
}, [])

const handleClickAway = useCallback(() => {
setOpen(false)
}, [setOpen])
}, [])

useEffect(() => {
if (isConnected && walletNetwork) {
Expand All @@ -53,20 +49,20 @@ const WalletButton: React.FC<WalletButtonProps> = ({ level = 'second' }) => {
subscribeNatsSync(network, 'mempool')
} else {
switchChain(network)
handleClick()
setOpen(true)
}
}
}, [walletNetwork, gatherData, isConnected, network, switchChain, handleClick])

useEffect(() => {
if (openWallet) {
handleClick()
setOpen(true)
setOpenWallet(false)
}
}, [handleClick, openWallet, setOpenWallet])
}, [openWallet, setOpenWallet])

return (
<ClickAwayListener onClickAway={handleClickAway}>
const renderWallet = useCallback(() => {
return (
<Box>
<Tooltip
title={!isConnected ? t('Connect wallet') : t('Open wallet')}
Expand Down Expand Up @@ -120,8 +116,14 @@ const WalletButton: React.FC<WalletButtonProps> = ({ level = 'second' }) => {
</Box>
</Grow>
</Box>
</ClickAwayListener>
)
)
}, [address, handleClick, isConnected, level, network, open, provider, t, theme])

if (open) {
return <ClickAwayListener onClickAway={handleClickAway}>{renderWallet()}</ClickAwayListener>
}

return renderWallet()
}

export default WalletButton
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const NotificationsPopup = () => {
}}
>
{notifications.map(notification => (
<NotificationBody notification={notification} isFromStore key={notification.id} />
<NotificationBody notification={notification} isFromStore key={notification.id} shadow={false} />
))}
</Box>
</>
Expand Down
Loading
Loading