From b6985f836ab838eaa00d4a5598e54ca182eb842e Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 21 Mar 2022 16:29:33 -0400 Subject: [PATCH] Use MenuItem if action --- app/soapbox/features/account/components/header.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/soapbox/features/account/components/header.js b/app/soapbox/features/account/components/header.js index 5b147d8fe..744689830 100644 --- a/app/soapbox/features/account/components/header.js +++ b/app/soapbox/features/account/components/header.js @@ -14,7 +14,7 @@ import { openModal } from 'soapbox/actions/modals'; import Avatar from 'soapbox/components/avatar'; import Badge from 'soapbox/components/badge'; import StillImage from 'soapbox/components/still_image'; -import { HStack, IconButton, Menu, MenuButton, MenuList, MenuLink, MenuDivider } from 'soapbox/components/ui'; +import { HStack, IconButton, Menu, MenuButton, MenuItem, MenuList, MenuLink, MenuDivider } from 'soapbox/components/ui'; import ActionButton from 'soapbox/features/ui/components/action_button'; import { isStaff, @@ -346,7 +346,8 @@ class Header extends ImmutablePureComponent { if (isAdmin(meAccount)) { menu.push({ text: intl.formatMessage(messages.admin_account, { name: account.get('username') }), - href: `/pleroma/admin/#/users/${account.get('id')}/`, newTab: true, + to: `/pleroma/admin/#/users/${account.id}/`, + newTab: true, icon: require('@tabler/icons/icons/gavel.svg'), }); } @@ -610,20 +611,23 @@ class Header extends ImmutablePureComponent { if (typeof menuItem?.text === 'undefined') { return ; } else { + const Comp = menuItem.action ? MenuItem : MenuLink; + // TODO: Add `as: Link` once React Router is upgraded. + const itemProps = menuItem.action ? { onSelect: menuItem.action } : { to: menuItem.to, target: menuItem.newTab ? '_blank' : '_self' }; + return ( - +
{menuItem.text}
-
+ ); } })} - )} {this.renderShareButton()}