From 75aa2579a0cb37dd11cbcb17477c335a0c2c993e Mon Sep 17 00:00:00 2001 From: pierre Date: Thu, 7 Jul 2022 17:02:09 +0200 Subject: [PATCH] feat(wallet-bonding): node menu ui --- .../src/pages/bonding/components/NodeMenu.tsx | 28 ++++++++++++++----- .../src/pages/bonding/mixnode/MixnodeCard.tsx | 20 +++++++++---- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/nym-wallet/src/pages/bonding/components/NodeMenu.tsx b/nym-wallet/src/pages/bonding/components/NodeMenu.tsx index 0b9cc2318e..6e64de421c 100644 --- a/nym-wallet/src/pages/bonding/components/NodeMenu.tsx +++ b/nym-wallet/src/pages/bonding/components/NodeMenu.tsx @@ -1,13 +1,20 @@ import * as React from 'react'; -import { IconButton, Menu, MenuItem, Stack } from '@mui/material'; +import { Box, IconButton, Menu, MenuItem, Stack, Typography } from '@mui/material'; import { MoreVert } from '@mui/icons-material'; import { useEffect } from 'react'; import { MixnodeFlow } from '../mixnode/types'; import { GatewayFlow } from '../gateway/types'; +interface Item { + label: string; + flow: MixnodeFlow | GatewayFlow; + icon: React.ReactNode; + description?: string; +} + interface Props { onFlowChange: (flow: MixnodeFlow | GatewayFlow) => void; - items: { label: string; flow: MixnodeFlow | GatewayFlow; icon: React.ReactNode }[]; + items: Item[]; onOpen: (open: boolean) => void; } @@ -54,11 +61,18 @@ const NodeMenu = ({ onFlowChange, items, onOpen }: Props) => { }, }} > - {items.map(({ label, flow, icon }) => ( - onClick(flow)} key={flow} disableRipple> - - {icon} - {label} + {items.map(({ label, flow, icon, description }) => ( + onClick(flow)} key={flow} sx={{ px: 1.6 }} disableRipple> + + + {icon} + + + {label} + + {description} + + ))} diff --git a/nym-wallet/src/pages/bonding/mixnode/MixnodeCard.tsx b/nym-wallet/src/pages/bonding/mixnode/MixnodeCard.tsx index adac4b4dba..1ec5a26f24 100644 --- a/nym-wallet/src/pages/bonding/mixnode/MixnodeCard.tsx +++ b/nym-wallet/src/pages/bonding/mixnode/MixnodeCard.tsx @@ -2,7 +2,6 @@ import React, { useMemo, useState } from 'react'; import { Button, Typography } from '@mui/material'; import { useTheme } from '@mui/material/styles'; import { Link } from '@nymproject/react/link/Link'; -import EditIcon from '@mui/icons-material/Edit'; import { BondedMixnode } from '../../../context'; import { Node as NodeIcon } from '../../../svg-icons/node'; import { NodeTable, BondedNodeCard, Cell, Header, NodeMenu } from '../components'; @@ -12,6 +11,7 @@ import { MixnodeFlow } from './types'; import RedeemRewards from './redeem'; import Unbond from '../unbond'; import CompoundRewards from './compound'; +import { Bond as BondIcon, Unbond as UnbondIcon } from '../../../svg-icons'; const headers: Header[] = [ { @@ -100,10 +100,20 @@ const MixnodeCard = ({ mixnode }: { mixnode: BondedMixnode }) => { onFlowChange={(newFlow) => setFlow(newFlow as MixnodeFlow)} onOpen={(open) => setNodeMenuOpen(open)} items={[ - { label: 'Bond more', flow: 'bondMore', icon: }, - { label: 'Unbond', flow: 'unbond', icon: }, - { label: 'Compound rewards', flow: 'compound', icon: }, - { label: 'Redeem rewards', flow: 'redeem', icon: }, + { label: 'Bond more', flow: 'bondMore', icon: }, + { label: 'Unbond', flow: 'unbond', icon: }, + { + label: 'Compound rewards', + flow: 'compound', + icon: C, + description: 'Add operator rewards to bond', + }, + { + label: 'Redeem rewards', + flow: 'redeem', + icon: R, + description: 'Add your rewards to bonding pool', + }, ]} /> ),