From 47803181048f944aa941ad8905f2375574c30461 Mon Sep 17 00:00:00 2001 From: guijun13 Date: Wed, 5 Jul 2023 19:00:24 -0300 Subject: [PATCH 01/43] add sections to sidebar header menuV2 items --- .../app/autotranslate/client/lib/tabBar.ts | 1 + apps/meteor/app/otr/client/tabBar.ts | 1 + .../app/push-notifications/client/tabBar.ts | 1 + .../app/ui-clean-history/client/lib/tabBar.ts | 1 + .../ui-message/client/actionButtons/tabbar.ts | 1 + .../contextualBar/exportMessagesTab.ts | 1 + .../startup/contextualBar/mentionsTab.ts | 1 + .../contextualBar/pinnedMessagesTab.ts | 1 + .../contextualBar/starredMessagesTab.ts | 1 + .../views/room/Header/ToolBox/ToolBox.tsx | 68 ++++++++----------- .../views/room/lib/Toolbox/defaultActions.ts | 2 + .../client/views/room/lib/Toolbox/index.tsx | 1 + 12 files changed, 40 insertions(+), 40 deletions(-) diff --git a/apps/meteor/app/autotranslate/client/lib/tabBar.ts b/apps/meteor/app/autotranslate/client/lib/tabBar.ts index fe564c7bd6b0..761bed3345be 100644 --- a/apps/meteor/app/autotranslate/client/lib/tabBar.ts +++ b/apps/meteor/app/autotranslate/client/lib/tabBar.ts @@ -17,6 +17,7 @@ addAction('autotranslate', () => { template: lazy(() => import('../../../../client/views/room/contextualBar/AutoTranslate')), order: 20, full: true, + type: 'organization', } : null, [autoTranslateEnabled, hasPermission], diff --git a/apps/meteor/app/otr/client/tabBar.ts b/apps/meteor/app/otr/client/tabBar.ts index dd56bd368a8b..041f9bdfb275 100644 --- a/apps/meteor/app/otr/client/tabBar.ts +++ b/apps/meteor/app/otr/client/tabBar.ts @@ -30,6 +30,7 @@ addAction('otr', (options) => { template, order: 13, full: true, + type: 'communication', ...(federated && { 'data-tooltip': 'OTR_unavailable_for_federation', 'disabled': true, diff --git a/apps/meteor/app/push-notifications/client/tabBar.ts b/apps/meteor/app/push-notifications/client/tabBar.ts index 1312018a1cde..3133f0b7dfde 100644 --- a/apps/meteor/app/push-notifications/client/tabBar.ts +++ b/apps/meteor/app/push-notifications/client/tabBar.ts @@ -16,6 +16,7 @@ addAction('push-notifications', ({ room }) => { icon: 'bell', template: lazy(() => import('../../../client/views/room/contextualBar/NotificationPreferences')), order: 8, + type: 'customization', } : null, [subscription], diff --git a/apps/meteor/app/ui-clean-history/client/lib/tabBar.ts b/apps/meteor/app/ui-clean-history/client/lib/tabBar.ts index 72fcbf22f598..d38c065b61bd 100644 --- a/apps/meteor/app/ui-clean-history/client/lib/tabBar.ts +++ b/apps/meteor/app/ui-clean-history/client/lib/tabBar.ts @@ -25,6 +25,7 @@ addAction('clean-history', ({ room }) => { }), template, order: 250, + type: 'customization', } : null, [hasPermission, federated], diff --git a/apps/meteor/app/ui-message/client/actionButtons/tabbar.ts b/apps/meteor/app/ui-message/client/actionButtons/tabbar.ts index 26352cd9b59a..28fee6eb35d1 100644 --- a/apps/meteor/app/ui-message/client/actionButtons/tabbar.ts +++ b/apps/meteor/app/ui-message/client/actionButtons/tabbar.ts @@ -26,6 +26,7 @@ export const onAdded = (button: IUIActionButton): void => appId: button.appId, payload: { context: button.context }, }), + type: 'apps', } : null, ); diff --git a/apps/meteor/client/startup/contextualBar/exportMessagesTab.ts b/apps/meteor/client/startup/contextualBar/exportMessagesTab.ts index 2d189d5493b0..3157138b9c4f 100644 --- a/apps/meteor/client/startup/contextualBar/exportMessagesTab.ts +++ b/apps/meteor/client/startup/contextualBar/exportMessagesTab.ts @@ -18,6 +18,7 @@ addAction('export-messages', ({ room }) => { template: lazy(() => import('../../views/room/contextualBar/ExportMessages')) as LazyExoticComponent, full: true, order: 12, + type: 'communication', } : null, [hasPermission], diff --git a/apps/meteor/client/startup/contextualBar/mentionsTab.ts b/apps/meteor/client/startup/contextualBar/mentionsTab.ts index 510a22ecbf99..af2cbf68408c 100644 --- a/apps/meteor/client/startup/contextualBar/mentionsTab.ts +++ b/apps/meteor/client/startup/contextualBar/mentionsTab.ts @@ -9,4 +9,5 @@ addAction('mentions', { icon: 'at', template: lazy(() => import('../../views/room/contextualBar/MentionsTab')), order: 9, + type: 'organization', }); diff --git a/apps/meteor/client/startup/contextualBar/pinnedMessagesTab.ts b/apps/meteor/client/startup/contextualBar/pinnedMessagesTab.ts index 1488e7d3a9e6..c4edc062dbbf 100644 --- a/apps/meteor/client/startup/contextualBar/pinnedMessagesTab.ts +++ b/apps/meteor/client/startup/contextualBar/pinnedMessagesTab.ts @@ -21,6 +21,7 @@ addAction('pinned-messages', ({ room }) => { 'disabled': true, }), order: 11, + type: 'organization', } : null, [pinningAllowed, federated], diff --git a/apps/meteor/client/startup/contextualBar/starredMessagesTab.ts b/apps/meteor/client/startup/contextualBar/starredMessagesTab.ts index 4b3677db7600..8175faa6f2fe 100644 --- a/apps/meteor/client/startup/contextualBar/starredMessagesTab.ts +++ b/apps/meteor/client/startup/contextualBar/starredMessagesTab.ts @@ -9,4 +9,5 @@ addAction('starred-messages', { icon: 'star', template: lazy(() => import('../../views/room/contextualBar/StarredMessagesTab')), order: 10, + type: 'organization', }); diff --git a/apps/meteor/client/views/room/Header/ToolBox/ToolBox.tsx b/apps/meteor/client/views/room/Header/ToolBox/ToolBox.tsx index 3805ea3dc54b..a040e8a1c50a 100644 --- a/apps/meteor/client/views/room/Header/ToolBox/ToolBox.tsx +++ b/apps/meteor/client/views/room/Header/ToolBox/ToolBox.tsx @@ -1,20 +1,16 @@ import type { IRoom } from '@rocket.chat/core-typings'; import type { Box } from '@rocket.chat/fuselage'; -import { Menu, Option } from '@rocket.chat/fuselage'; import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; import { HeaderToolboxAction, HeaderToolboxDivider } from '@rocket.chat/ui-client'; import type { TranslationKey } from '@rocket.chat/ui-contexts'; import { useLayout, useTranslation } from '@rocket.chat/ui-contexts'; -import type { ReactNode, ComponentProps, ReactElement } from 'react'; -import React, { memo, useRef } from 'react'; +import type { ComponentProps, ReactElement } from 'react'; +import React, { memo } from 'react'; // used to open the menu option by keyboard +import GenericMenu from '../../../../components/GenericMenu/GenericMenu'; import { useToolboxContext, useTab, useTabBarOpen } from '../../contexts/ToolboxContext'; -import type { ToolboxActionConfig, OptionRenderer } from '../../lib/Toolbox'; - -const renderMenuOption: OptionRenderer = ({ label: { title, icon }, ...props }: any): ReactNode => ( -