-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/sidepanelNavigation-feature-preview
- Loading branch information
Showing
43 changed files
with
460 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rocket.chat/meteor": patch | ||
--- | ||
|
||
Restored tooltips to the unit edit department field selected options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': patch | ||
--- | ||
|
||
Fixes an issue where multi-step modals were closing unexpectedly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 5 additions & 17 deletions
22
apps/meteor/client/components/GenericModal/GenericModalSkeleton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,13 @@ | ||
import { Skeleton } from '@rocket.chat/fuselage'; | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
import GenericModal from './GenericModal'; | ||
|
||
const GenericModalSkeleton = ({ onClose, ...props }: ComponentProps<typeof GenericModal>) => { | ||
const t = useTranslation(); | ||
|
||
return ( | ||
<GenericModal | ||
{...props} | ||
variant='warning' | ||
onClose={onClose} | ||
title={<Skeleton width='50%' />} | ||
confirmText={t('Cancel')} | ||
onConfirm={onClose} | ||
> | ||
<Skeleton width='full' /> | ||
</GenericModal> | ||
); | ||
}; | ||
const GenericModalSkeleton = (props: ComponentProps<typeof GenericModal>) => ( | ||
<GenericModal {...props} icon={null} title={<Skeleton width='50%' />}> | ||
<Skeleton width='full' /> | ||
</GenericModal> | ||
); | ||
|
||
export default GenericModalSkeleton; |
50 changes: 13 additions & 37 deletions
50
apps/meteor/client/components/RoomIcon/OmnichannelRoomIcon/OmnichannelAppSourceRoomIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 25 additions & 14 deletions
39
apps/meteor/client/components/RoomIcon/OmnichannelRoomIcon/OmnichannelRoomIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; | ||
import { isOmnichannelRoomFromAppSource } from '@rocket.chat/core-typings'; | ||
import type { IOmnichannelSource } from '@rocket.chat/core-typings'; | ||
import { UserStatus, isOmnichannelSourceFromApp } from '@rocket.chat/core-typings'; | ||
import type { Icon } from '@rocket.chat/fuselage'; | ||
import type { ComponentProps, ReactElement } from 'react'; | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
import { OmnichannelAppSourceRoomIcon } from './OmnichannelAppSourceRoomIcon'; | ||
import { OmnichannelCoreSourceRoomIcon } from './OmnichannelCoreSourceRoomIcon'; | ||
|
||
export const OmnichannelRoomIcon = ({ | ||
room, | ||
size, | ||
placement = 'default', | ||
}: { | ||
room: IOmnichannelRoom; | ||
const colors = { | ||
busy: 'status-font-on-danger', | ||
away: 'status-font-on-warning', | ||
online: 'status-font-on-success', | ||
offline: 'annotation', | ||
disabled: 'annotation', | ||
} as const; | ||
|
||
type OmnichannelRoomIconProps = { | ||
source: IOmnichannelSource; | ||
color?: ComponentProps<typeof Icon>['color']; | ||
status?: UserStatus; | ||
size: ComponentProps<typeof Icon>['size']; | ||
placement: 'sidebar' | 'default'; | ||
}): ReactElement => { | ||
if (isOmnichannelRoomFromAppSource(room)) { | ||
return <OmnichannelAppSourceRoomIcon placement={placement} room={room} size={size} />; | ||
placement?: 'sidebar' | 'default'; | ||
}; | ||
|
||
export const OmnichannelRoomIcon = ({ source, color, status, size = 'x16', placement = 'default' }: OmnichannelRoomIconProps) => { | ||
const iconColor = color ?? colors[status || UserStatus.OFFLINE]; | ||
|
||
if (isOmnichannelSourceFromApp(source)) { | ||
return <OmnichannelAppSourceRoomIcon source={source} placement={placement} color={iconColor} size={size} />; | ||
} | ||
return <OmnichannelCoreSourceRoomIcon room={room} size={size} />; | ||
|
||
return <OmnichannelCoreSourceRoomIcon source={source} color={iconColor} size={size} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import type { RoomType } from '@rocket.chat/core-typings'; | ||
import { mockAppRoot } from '@rocket.chat/mock-providers'; | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import userEvent from '@testing-library/user-event'; | ||
import React from 'react'; | ||
|
||
import RoomMenu from './RoomMenu'; | ||
|
||
jest.mock('../../client/lib/rooms/roomCoordinator', () => ({ | ||
roomCoordinator: { | ||
getRoomDirectives: () => ({ | ||
getUiText: () => 'leaveWarning', | ||
}), | ||
}, | ||
})); | ||
|
||
jest.mock('../../app/ui-utils/client', () => ({ | ||
LegacyRoomManager: { | ||
close: jest.fn(), | ||
}, | ||
})); | ||
|
||
const defaultProps = { | ||
rid: 'roomId', | ||
type: 'c' as RoomType, | ||
hideDefaultOptions: false, | ||
placement: 'right-start', | ||
}; | ||
|
||
const renderOptions = { | ||
wrapper: mockAppRoot() | ||
.withTranslations('en', 'core', { | ||
Hide: 'Hide', | ||
Mark_unread: 'Mark Unread', | ||
Favorite: 'Favorite', | ||
Leave_room: 'Leave', | ||
}) | ||
.withSetting('Favorite_Rooms', true) | ||
.withPermission('leave-c') | ||
.withPermission('leave-p') | ||
.build(), | ||
legacyRoot: true, | ||
}; | ||
|
||
it('should display all the menu options for regular rooms', async () => { | ||
render(<RoomMenu {...defaultProps} />, renderOptions); | ||
|
||
const menu = screen.queryByRole('button'); | ||
await userEvent.click(menu as HTMLElement); | ||
|
||
expect(await screen.findByRole('option', { name: 'Hide' })).toBeInTheDocument(); | ||
expect(await screen.findByRole('option', { name: 'Favorite' })).toBeInTheDocument(); | ||
expect(await screen.findByRole('option', { name: 'Mark Unread' })).toBeInTheDocument(); | ||
expect(await screen.findByRole('option', { name: 'Leave' })).toBeInTheDocument(); | ||
}); | ||
|
||
it('should display only mark unread and favorite for omnichannel rooms', async () => { | ||
render(<RoomMenu {...defaultProps} type='l' />, renderOptions); | ||
|
||
const menu = screen.queryByRole('button'); | ||
await userEvent.click(menu as HTMLElement); | ||
|
||
expect(await screen.findAllByRole('option')).toHaveLength(2); | ||
expect(screen.queryByRole('option', { name: 'Hide' })).not.toBeInTheDocument(); | ||
expect(screen.queryByRole('option', { name: 'Leave' })).not.toBeInTheDocument(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.