Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move GenericMenu to ui-client package #33247

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NavBarItem } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useCurrentRoutePath, useTranslation } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../components/GenericMenu/GenericMenu';
import { useAuditMenu } from './hooks/useAuditMenu';

type NavBarItemAuditMenuProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NavBarItem } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useCurrentRoutePath, useTranslation } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../components/GenericMenu/GenericMenu';
import { useMarketPlaceMenu } from './hooks/useMarketPlaceMenu';

type NavBarItemMarketPlaceMenuProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { usePermission, useRouter, useTranslation } from '@rocket.chat/ui-contexts';

import type { GenericMenuItemProps } from '../../../components/GenericMenu/GenericMenuItem';
import { useHasLicenseModule } from '../../../hooks/useHasLicenseModule';

export const useAuditMenu = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Badge, Skeleton } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation, usePermission, useRouter } from '@rocket.chat/ui-contexts';
import React from 'react';

import type { GenericMenuItemProps } from '../../../components/GenericMenu/GenericMenuItem';
import { useUserDropdownAppsActionButtons } from '../../../hooks/useAppActionButtons';
import { useAppRequestStats } from '../../../views/marketplace/hooks/useAppRequestStats';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NavBarItem } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useCurrentRoutePath, useTranslation } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../components/GenericMenu/GenericMenu';
import { useAdministrationMenu } from './hooks/useAdministrationMenu';

type NavBarItemAdministrationMenuProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { IUser } from '@rocket.chat/core-typings';
import { GenericMenu, useHandleMenuAction } from '@rocket.chat/ui-client';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { ComponentProps } from 'react';
import React, { memo, useState } from 'react';

import GenericMenu from '../../../components/GenericMenu/GenericMenu';
import type { GenericMenuItemProps } from '../../../components/GenericMenu/GenericMenuItem';
import { useHandleMenuAction } from '../../../components/GenericMenu/hooks/useHandleMenuAction';
import UserMenuButton from './UserMenuButton';
import { useUserMenu } from './hooks/useUserMenu';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Badge } from '@rocket.chat/fuselage';
import { useEffectEvent } from '@rocket.chat/fuselage-hooks';
import { defaultFeaturesPreview, useFeaturePreviewList } from '@rocket.chat/ui-client';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useRouter, useTranslation } from '@rocket.chat/ui-contexts';
import React from 'react';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';

export const useAccountItems = (): GenericMenuItemProps[] => {
const t = useTranslation();
const router = useRouter();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Box } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useEndpoint, useSetting } from '@rocket.chat/ui-contexts';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import React, { useEffect } from 'react';
import { useTranslation } from 'react-i18next';

import { callbacks } from '../../../../../lib/callbacks';
import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import MarkdownText from '../../../../components/MarkdownText';
import { UserStatus } from '../../../../components/UserStatus';
import { userStatuses } from '../../../../lib/userStatuses';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { IUser } from '@rocket.chat/core-typings';
import { useEffectEvent } from '@rocket.chat/fuselage-hooks';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useLogout, useTranslation } from '@rocket.chat/ui-contexts';
import React from 'react';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import UserMenuHeader from '../UserMenuHeader';
import { useAccountItems } from './useAccountItems';
import { useStatusItems } from './useStatusItems';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useAtLeastOnePermission, usePermission, useRouter, useTranslation } from '@rocket.chat/ui-contexts';

import type { GenericMenuItemProps } from '../../../components/GenericMenu/GenericMenuItem';

const ADMIN_PERMISSIONS = [
'view-statistics',
'run-import',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { useUniqueId } from '@rocket.chat/fuselage-hooks';
import { GenericMenu, type GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { MouseEvent, ReactElement } from 'react';
import React from 'react';

import type { MessageActionConditionProps, MessageActionConfig } from '../../../../app/ui-utils/client/lib/MessageAction';
import GenericMenu from '../../GenericMenu/GenericMenu';
import type { GenericMenuItemProps } from '../../GenericMenu/GenericMenuItem';

type MessageActionConfigOption = Omit<MessageActionConfig, 'condition' | 'context' | 'order' | 'action'> & {
action: (e?: MouseEvent<HTMLElement>) => void;
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/hooks/useAppActionButtons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { IUIActionButton, UIActionButtonContext } from '@rocket.chat/apps-engine/definition/ui';
import { useDebouncedCallback } from '@rocket.chat/fuselage-hooks';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useEndpoint, useStream, useToastMessageDispatch, useUserId } from '@rocket.chat/ui-contexts';
import type { UseQueryResult } from '@tanstack/react-query';
import { useQuery, useQueryClient } from '@tanstack/react-query';
Expand All @@ -10,7 +11,6 @@ import { UiKitTriggerTimeoutError } from '../../app/ui-message/client/UiKitTrigg
import type { MessageActionConfig, MessageActionContext } from '../../app/ui-utils/client/lib/MessageAction';
import type { MessageBoxAction } from '../../app/ui-utils/client/lib/messageBox';
import { Utilities } from '../../ee/lib/misc/Utilities';
import type { GenericMenuItemProps } from '../components/GenericMenu/GenericMenuItem';
import { useUiKitActionManager } from '../uikit/hooks/useUiKitActionManager';
import { useApplyButtonFilters, useApplyButtonAuthFilter } from './useApplyButtonFilters';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { GenericMenu, useHandleMenuAction } from '@rocket.chat/ui-client';
import { useTranslation, useRouter } from '@rocket.chat/ui-contexts';
import type { AllHTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../components/GenericMenu/GenericMenu';
import { useHandleMenuAction } from '../../components/GenericMenu/hooks/useHandleMenuAction';
import { NavbarAction } from '../../components/Navbar';
import { useAdministrationItems } from '../../sidebar/header/actions/hooks/useAdministrationItems';

Expand Down
3 changes: 1 addition & 2 deletions apps/meteor/client/navbar/actions/NavbarAuditAction.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { GenericMenu, useHandleMenuAction } from '@rocket.chat/ui-client';
import { useTranslation, useRouter } from '@rocket.chat/ui-contexts';
import type { AllHTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../components/GenericMenu/GenericMenu';
import { useHandleMenuAction } from '../../components/GenericMenu/hooks/useHandleMenuAction';
import { NavbarAction } from '../../components/Navbar';
import { useAuditItems } from '../../sidebar/header/actions/hooks/useAuditItems';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { IconButton } from '@rocket.chat/fuselage';
import { GenericMenu, useHandleMenuAction } from '@rocket.chat/ui-client';
import { useTranslation, useRouter } from '@rocket.chat/ui-contexts';
import type { AllHTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../components/GenericMenu/GenericMenu';
import { useHandleMenuAction } from '../../components/GenericMenu/hooks/useHandleMenuAction';
import { NavbarAction } from '../../components/Navbar';
import { useAppsItems } from '../../sidebar/header/actions/hooks/useAppsItems';

Expand Down
12 changes: 8 additions & 4 deletions apps/meteor/client/sidebar/header/UserMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import type { IUser } from '@rocket.chat/core-typings';
import { FeaturePreview, FeaturePreviewOn, FeaturePreviewOff } from '@rocket.chat/ui-client';
import {
FeaturePreview,
FeaturePreviewOn,
FeaturePreviewOff,
GenericMenu,
useHandleMenuAction,
type GenericMenuItemProps,
} from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';
import React, { useState, memo } from 'react';

import GenericMenu from '../../components/GenericMenu/GenericMenu';
import type { GenericMenuItemProps } from '../../components/GenericMenu/GenericMenuItem';
import { useHandleMenuAction } from '../../components/GenericMenu/hooks/useHandleMenuAction';
import UserAvatarWithStatus from './UserAvatarWithStatus';
import UserAvatarWithStatusUnstable from './UserAvatarWithStatusUnstable';
import { useUserMenu } from './hooks/useUserMenu';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Sidebar } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../../components/GenericMenu/GenericMenu';
import { useAdministrationMenu } from './hooks/useAdministrationMenu';

type AdministrationProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/sidebar/header/actions/CreateRoom.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Sidebar } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../../components/GenericMenu/GenericMenu';
import { useCreateRoom } from './hooks/useCreateRoomMenu';

type CreateRoomProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/sidebar/header/actions/Sort.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Sidebar } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../../components/GenericMenu/GenericMenu';
import { useSortMenu } from './hooks/useSortMenu';

type SortProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation, useRoute, useRouter, useAtLeastOnePermission, usePermission } from '@rocket.chat/ui-contexts';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';

const ADMIN_PERMISSIONS = [
'view-statistics',
'run-import',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import { useAdministrationItems } from './useAdministrationItems';
import { useAppsItems } from './useAppsItems';
import { useAuditItems } from './useAuditItems';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Badge, Skeleton } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation, useRoute, usePermission } from '@rocket.chat/ui-contexts';
import React from 'react';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import { useUserDropdownAppsActionButtons } from '../../../../hooks/useAppActionButtons';
import { useAppRequestStats } from '../../../../views/marketplace/hooks/useAppRequestStats';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation, useRoute, usePermission } from '@rocket.chat/ui-contexts';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import { useHasLicenseModule } from '../../../../hooks/useHasLicenseModule';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation, useSetting, useAtLeastOnePermission } from '@rocket.chat/ui-contexts';

import CreateDiscussion from '../../../../components/CreateDiscussion';
import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import CreateChannelWithData from '../../CreateChannel';
import CreateDirectMessage from '../../CreateDirectMessage';
import CreateTeam from '../../CreateTeam';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { CheckBox } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useEndpoint, useUserPreference, useTranslation } from '@rocket.chat/ui-contexts';
import React, { useCallback } from 'react';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';

export const useGroupingListItems = (): GenericMenuItemProps[] => {
const t = useTranslation();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import MatrixFederationSearch from '../../MatrixFederationSearch';
import { useCreateRoomModal } from '../../hooks/useCreateRoomModal';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { RadioButton } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useEndpoint, useUserPreference, useTranslation } from '@rocket.chat/ui-contexts';
import React, { useCallback } from 'react';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import {
OmnichannelSortingDisclaimer,
useOmnichannelSortingDisclaimer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { RadioButton, ToggleSwitch } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useEndpoint, useUserPreference, useTranslation } from '@rocket.chat/ui-contexts';
import React, { useCallback } from 'react';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';

export const useViewModeItems = (): GenericMenuItemProps[] => {
const t = useTranslation();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Badge } from '@rocket.chat/fuselage';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import { defaultFeaturesPreview, useFeaturePreviewList } from '@rocket.chat/ui-client';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useRouter, useTranslation } from '@rocket.chat/ui-contexts';
import React from 'react';

import type { GenericMenuItemProps } from '../../../components/GenericMenu/GenericMenuItem';

export const useAccountItems = (): GenericMenuItemProps[] => {
const t = useTranslation();
const router = useRouter();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Box } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useEndpoint, useSetting } from '@rocket.chat/ui-contexts';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import React, { useEffect } from 'react';
import { useTranslation } from 'react-i18next';

import { callbacks } from '../../../../lib/callbacks';
import type { GenericMenuItemProps } from '../../../components/GenericMenu/GenericMenuItem';
import MarkdownText from '../../../components/MarkdownText';
import { UserStatus } from '../../../components/UserStatus';
import { userStatuses } from '../../../lib/userStatuses';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/sidebar/header/hooks/useUserMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { IUser } from '@rocket.chat/core-typings';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useLogout, useTranslation } from '@rocket.chat/ui-contexts';
import React from 'react';

import type { GenericMenuItemProps } from '../../../components/GenericMenu/GenericMenuItem';
import UserMenuHeader from '../UserMenuHeader';
import { useAccountItems } from './useAccountItems';
import { useStatusItems } from './useStatusItems';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { SidebarV2Action } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../../components/GenericMenu/GenericMenu';
import { useCreateRoom } from './hooks/useCreateRoomMenu';

type CreateRoomProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/sidebarv2/header/actions/Sort.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { SidebarV2Action } from '@rocket.chat/fuselage';
import { GenericMenu } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { HTMLAttributes } from 'react';
import React from 'react';

import GenericMenu from '../../../components/GenericMenu/GenericMenu';
import { useSortMenu } from './hooks/useSortMenu';

type SortProps = Omit<HTMLAttributes<HTMLElement>, 'is'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation, useSetting, useAtLeastOnePermission } from '@rocket.chat/ui-contexts';

import CreateDiscussion from '../../../../components/CreateDiscussion';
import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import CreateChannelModal from '../../CreateChannelModal';
import CreateDirectMessage from '../../CreateDirectMessage';
import CreateTeamModal from '../../CreateTeamModal';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { CheckBox } from '@rocket.chat/fuselage';
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useEndpoint, useUserPreference, useTranslation } from '@rocket.chat/ui-contexts';
import React, { useCallback } from 'react';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';

export const useGroupingListItems = (): GenericMenuItemProps[] => {
const t = useTranslation();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GenericMenuItemProps } from '@rocket.chat/ui-client';
import { useTranslation } from '@rocket.chat/ui-contexts';

import type { GenericMenuItemProps } from '../../../../components/GenericMenu/GenericMenuItem';
import MatrixFederationSearch from '../../MatrixFederationSearch';
import { useCreateRoomModal } from '../../hooks/useCreateRoomModal';

Expand Down
Loading
Loading