From 4b1e27161f1df84d39996b669fc2abd6a66860c7 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 19 Sep 2023 14:12:59 -0700 Subject: [PATCH] Refactor out LogoutButton and match style of other header buttons (#2131) --- .../src/components/app/AppStatusHeader.tsx | 26 ++++--------- .../components/app/AppTestnetIndicator.tsx | 1 + .../gui/src/components/app/LogoutButton.tsx | 38 +++++++++++++++++++ .../notification/NotificationsDropdown.tsx | 5 ++- .../walletConnect/WalletConnectDropdown.tsx | 5 ++- 5 files changed, 53 insertions(+), 22 deletions(-) create mode 100644 packages/gui/src/components/app/LogoutButton.tsx diff --git a/packages/gui/src/components/app/AppStatusHeader.tsx b/packages/gui/src/components/app/AppStatusHeader.tsx index 37ec09aaf9..c91d26a9ec 100644 --- a/packages/gui/src/components/app/AppStatusHeader.tsx +++ b/packages/gui/src/components/app/AppStatusHeader.tsx @@ -1,11 +1,9 @@ -import { Color, Flex, useMode, Mode, useDarkMode, useAuth, Tooltip } from '@chia-network/core'; +import { Color, Flex, useMode, Mode, useDarkMode } from '@chia-network/core'; import { WalletConnections, WalletStatus, WalletReceiveAddressField } from '@chia-network/wallets'; import { Trans } from '@lingui/macro'; -import { Logout as LogoutIcon } from '@mui/icons-material'; -import { Box, ButtonGroup, Button, Popover, PopoverProps, IconButton } from '@mui/material'; +import { Box, ButtonGroup, Button, Popover, PopoverProps } from '@mui/material'; import { useTheme, styled, alpha } from '@mui/material/styles'; import React, { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; import Connections from '../fullNode/FullNodeConnections'; import FullNodeStateIndicator from '../fullNode/FullNodeStateIndicator'; @@ -13,6 +11,7 @@ import NotificationsDropdown from '../notification/NotificationsDropdown'; import WalletConnectDropdown from '../walletConnect/WalletConnectDropdown'; import AppTestnetIndicator from './AppTestnetIndicator'; +import LogoutButton from './LogoutButton'; const StyledPopover = styled((props: PopoverProps) => )(({ theme }) => ({ '& .MuiPopover-paper': { @@ -47,6 +46,9 @@ export default function AppStatusHeader() { const theme = useTheme(); const { isDarkMode } = useDarkMode(); const borderColor = (theme.palette as any).border[isDarkMode ? 'dark' : 'main']; + const ButtonGroupStyle = { + minHeight: '42px', + }; const ButtonStyle = { paddingTop: '3px', paddingBottom: 0, @@ -91,8 +93,6 @@ export default function AppStatusHeader() { }; const [mode] = useMode(); - const navigate = useNavigate(); - const { logOut } = useAuth(); const [anchorElFN, setAnchorElFN] = useState(null); const [anchorElW, setAnchorElW] = useState(null); @@ -113,18 +113,12 @@ export default function AppStatusHeader() { setAnchorElW(null); }; - async function handleLogout() { - await logOut(); - - navigate('/'); - } - return ( - + {mode === Mode.FARMING && ( <> + + ); +} diff --git a/packages/gui/src/components/notification/NotificationsDropdown.tsx b/packages/gui/src/components/notification/NotificationsDropdown.tsx index 9f8a83fdd5..b664f429cb 100644 --- a/packages/gui/src/components/notification/NotificationsDropdown.tsx +++ b/packages/gui/src/components/notification/NotificationsDropdown.tsx @@ -10,9 +10,10 @@ import NotificationsMenu from './NotificationsMenu'; const buttonStyle = (theme) => ({ minWidth: 0, - borderRadius: 2, + borderRadius: '8px', borderColor: theme.palette.mode === 'dark' ? 'border.dark' : 'border.main', - height: '42px', + width: '40px', + minHeight: '40px', '&:hover': { borderColor: theme.palette.mode === 'dark' ? 'border.dark' : 'border.main', }, diff --git a/packages/gui/src/components/walletConnect/WalletConnectDropdown.tsx b/packages/gui/src/components/walletConnect/WalletConnectDropdown.tsx index 6ca934e524..8b11e23467 100644 --- a/packages/gui/src/components/walletConnect/WalletConnectDropdown.tsx +++ b/packages/gui/src/components/walletConnect/WalletConnectDropdown.tsx @@ -13,8 +13,9 @@ export default function WalletConnectDropdown() { const ButtonStyle = { minWidth: 0, - height: '42px', - borderRadius: 2, + width: '40px', + minHeight: '40px', + borderRadius: '8px', }; const color = enabled && !isLoading && pairs.get().length > 0 ? 'primary' : 'info';