Skip to content

Commit

Permalink
Support optional onMessagesClicked() handler for menu item (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
qrtp authored Sep 26, 2024
1 parent f337b70 commit 89f1b3f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/ui-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unstoppabledomains/ui-components",
"version": "0.0.50-browser-extension.3",
"version": "0.0.50-browser-extension.4",
"private": true,
"description": "An open and reusable suite of Unstoppable Domains management components",
"keywords": [
Expand Down
10 changes: 8 additions & 2 deletions packages/ui-components/src/components/Wallet/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';
import Typography from '@mui/material/Typography';
import type {Theme} from '@mui/material/styles';
import {useTheme,styled} from '@mui/material/styles';
import {styled, useTheme} from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import {useSnackbar} from 'notistack';
import QueryString from 'qs';
Expand Down Expand Up @@ -179,6 +179,7 @@ type Props = {
fullScreenModals?: boolean;
onHeaderClick?: () => void;
onSettingsClick?: () => void;
onMessagesClick?: () => void;
onLogout?: () => void;
onDisconnect?: () => void;
};
Expand All @@ -198,6 +199,7 @@ export const Header: React.FC<Props> = ({
onLogout,
onDisconnect,
onSettingsClick,
onMessagesClick,
}) => {
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
Expand Down Expand Up @@ -256,7 +258,11 @@ export const Header: React.FC<Props> = ({
};

const handleMessagingClicked = () => {
setOpenChat(t('push.messages'));
if (onMessagesClick) {
onMessagesClick();
} else {
setOpenChat(t('push.messages'));
}
setIsMenuOpen(false);
};

Expand Down
3 changes: 3 additions & 0 deletions packages/ui-components/src/components/Wallet/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const Wallet: React.FC<
onLogout?: () => void;
onDisconnect?: () => void;
onSettingsClick?: () => void;
onMessagesClick?: () => void;
isNewUser?: boolean;
}
> = ({
Expand All @@ -59,6 +60,7 @@ export const Wallet: React.FC<
onLogout,
onDisconnect,
onSettingsClick,
onMessagesClick,
setAuthAddress,
setButtonComponent,
}) => {
Expand Down Expand Up @@ -108,6 +110,7 @@ export const Wallet: React.FC<
onLogout={onLogout}
onDisconnect={onDisconnect}
onSettingsClick={onSettingsClick}
onMessagesClick={onMessagesClick}
fullScreenModals={fullScreenModals}
domain={isDomainValidForManagement(domain) ? domain : undefined}
/>
Expand Down

0 comments on commit 89f1b3f

Please sign in to comment.