feat(right sidebar): add nodes list to the right button

This commit is contained in:
Hristo Nedelkov 2024-03-06 16:08:03 +02:00 committed by Emil Ivanichkov
parent 7ae90bd7dd
commit bc4c46bea0
2 changed files with 74 additions and 48 deletions

View File

@ -1,6 +1,11 @@
import { Avatar, Popover, Text } from '@status-im/components' import { Avatar, Popover, Text } from '@status-im/components'
import { Stack, XStack, YStack } from 'tamagui' import { Stack, XStack, YStack } from 'tamagui'
import { AddSmallIcon, CopyIcon } from '@status-im/icons' import {
AddSmallIcon,
CloseIcon,
CopyIcon,
OptionsIcon,
} from '@status-im/icons'
import AlertsList from '../../../components/General/RightSideBar/AlertsList' import AlertsList from '../../../components/General/RightSideBar/AlertsList'
import LogsList from '../../../components/General/RightSideBar/LogsList' import LogsList from '../../../components/General/RightSideBar/LogsList'
@ -11,12 +16,17 @@ import ValidatorsCount from '../../../components/General/RightSideBar/Validators
import NodesList from './NodesList' import NodesList from './NodesList'
import DiamondCard from './DiamondCard' import DiamondCard from './DiamondCard'
import { useState } from 'react'
const DashboardSidebar = () => { const DashboardSidebar = () => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false)
const onCopyWalletAddress = () => { const onCopyWalletAddress = () => {
copyFunction('0xb9dc35') copyFunction('0xb9dc35')
} }
const handlePopoverOpenChange = (open: boolean) => {
setIsPopoverOpen(open)
}
return ( return (
<YStack <YStack
width={'320px'} width={'320px'}
@ -30,7 +40,12 @@ const DashboardSidebar = () => {
overflowY: 'auto', overflowY: 'auto',
}} }}
> >
<XStack alignItems="center" space={'$2'} backgroundColor={'#F5F5F5'}> <XStack
justifyContent="space-between"
alignItems="center"
alignContent="center"
>
<XStack space={'$2'} alignItems="center">
<Avatar type="user" size={32} name="Ethereum Mainnet" /> <Avatar type="user" size={32} name="Ethereum Mainnet" />
<YStack> <YStack>
<Text size={15} weight={'semibold'}> <Text size={15} weight={'semibold'}>
@ -47,40 +62,51 @@ const DashboardSidebar = () => {
</XStack> </XStack>
</YStack> </YStack>
</XStack> </XStack>
<Popover
side="top"
align="center"
onOpenChange={handlePopoverOpenChange}
children={[
<Stack
style={{
border: '1px solid #C8D0D8',
borderRadius: '9px',
marginRight: '10px',
padding: '3px',
cursor: 'pointer',
}}
>
{isPopoverOpen ? (
<CloseIcon size={20} />
) : (
<OptionsIcon size={20} />
)}
</Stack>,
<NodesList></NodesList>,
]}
></Popover>
</XStack>
<XStack space={'$2'} alignItems="center" justifyContent="space-between"> <XStack space={'$2'} alignItems="center" justifyContent="space-between">
<DiamondCard /> <DiamondCard />
</XStack> </XStack>
<ValidatorsCount /> <ValidatorsCount />
<Popover
side="top"
align="center"
children={[
<YStack
backgroundColor={'#757e8c'}
style={{
padding: '8px 12px',
borderRadius: '16px',
flexGrow: '1',
height: 'max-fit',
}}
>
<XStack <XStack
style={{ marginBottom: '8px' }} backgroundColor={'#757e8c'}
alignContent="center" alignContent="center"
alignItems="center" alignItems="center"
justifyContent="center" justifyContent="center"
space="$2" space="$2"
style={{
padding: '8px 12px',
borderRadius: '16px',
}}
> >
<AddSmallIcon size={20} color="#fff"></AddSmallIcon> <AddSmallIcon size={20} color="#fff"></AddSmallIcon>
<Text size={19} color={'#FFF'}> <Text size={19} color={'#FFF'}>
Add Validator Add Validator
</Text> </Text>
</XStack> </XStack>
</YStack>,
<NodesList></NodesList>,
]}
></Popover>
<ValidatorsTabs /> <ValidatorsTabs />
<AlertsList /> <AlertsList />
<LogsList /> <LogsList />

View File

@ -3,7 +3,7 @@ import { XStack } from 'tamagui'
import LeftSidebar from '../../components/General/LeftSidebar/LeftSidebar' import LeftSidebar from '../../components/General/LeftSidebar/LeftSidebar'
import DashboardContent from './DashboardContent' import DashboardContent from './DashboardContent'
import { useWindowSize } from '../../hooks/useWindowSize' import { useWindowSize } from '../../hooks/useWindowSize'
import DashboardSidebar from './DashboardSidebar/DashboardSidebar' import RightSideBar from '../../components/General/RightSideBar/RightSidebar'
const Dashboard = () => { const Dashboard = () => {
const { width } = useWindowSize() const { width } = useWindowSize()
@ -11,7 +11,7 @@ const Dashboard = () => {
<XStack style={{ height: '100vh' }}> <XStack style={{ height: '100vh' }}>
<LeftSidebar /> <LeftSidebar />
<DashboardContent /> <DashboardContent />
{width > 900 && <DashboardSidebar />} {width > 900 && <RightSideBar />}
</XStack> </XStack>
) )
} }