Skip to content
Snippets Groups Projects
Unverified Commit 86567ca0 authored by Douglas Fabris's avatar Douglas Fabris Committed by GitHub
Browse files

refactor: Replace `Menu` in favor of `GenericMenu` in DeviceManagement (#34836)

parent fc897451
No related branches found
No related tags found
No related merge requests found
import { Box, Menu, Option } from '@rocket.chat/fuselage';
import { Box } from '@rocket.chat/fuselage';
import { useMediaQuery, useMutableCallback } from '@rocket.chat/fuselage-hooks';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useRoute } from '@rocket.chat/ui-contexts';
import type { KeyboardEvent, ReactElement } from 'react';
import { useCallback } from 'react';
......@@ -57,12 +59,14 @@ const DeviceManagementAdminRow = ({
[handleClick],
);
const menuOptions = {
logout: {
label: { label: t('Logout_Device'), icon: 'sign-out' },
action: (): void => handleDeviceLogout(onReload),
const menuItems: GenericMenuItemProps[] = [
{
id: 'logoutDevice',
icon: 'sign-out',
content: t('Logout_Device'),
onClick: (): void => handleDeviceLogout(onReload),
},
};
];
return (
<GenericTableRow key={_id} onKeyDown={handleKeyDown} onClick={handleClick} tabIndex={0} action>
......@@ -79,11 +83,7 @@ const DeviceManagementAdminRow = ({
{mediaQuery && <GenericTableCell withTruncatedText>{_id}</GenericTableCell>}
{mediaQuery && <GenericTableCell withTruncatedText>{ip}</GenericTableCell>}
<GenericTableCell onClick={(e): void => e.stopPropagation()}>
<Menu
title={t('Options')}
options={menuOptions}
renderItem={({ label: { label, icon }, ...props }): ReactElement => <Option label={label} icon={icon} {...props} />}
/>
<GenericMenu detached placement='bottom-end' title={t('Options')} items={menuItems} />
</GenericTableCell>
</GenericTableRow>
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment