-
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/chat-transcript
- Loading branch information
Showing
43 changed files
with
1,082 additions
and
1,155 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
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 |
---|---|---|
@@ -1,6 +1 @@ | ||
import './popup/customMessagePopups'; | ||
import './popup/messagePopup'; | ||
import './popup/messagePopupChannel'; | ||
import './popup/messagePopupConfig'; | ||
import './popup/messagePopupEmoji'; | ||
import './popup/messagePopupSlashCommandPreview'; |
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
68 changes: 68 additions & 0 deletions
68
apps/meteor/app/ui-message/client/popup/ComposerBoxPopup.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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Box, Option, OptionSkeleton, Tile } from '@rocket.chat/fuselage'; | ||
import { useUniqueId } from '@rocket.chat/fuselage-hooks'; | ||
import type { UseQueryResult } from '@tanstack/react-query'; | ||
import type { ReactElement } from 'react'; | ||
import React from 'react'; | ||
|
||
type ComposerBoxPopupProps< | ||
T extends { | ||
_id: string; | ||
sort?: number; | ||
}, | ||
> = { | ||
title?: string; | ||
focused?: T; | ||
items: UseQueryResult<T[]>[]; | ||
select: (item: T) => void; | ||
renderItem?: ({ item }: { item: T }) => ReactElement; | ||
}; | ||
|
||
export const ComposerBoxPopup = < | ||
T extends { | ||
_id: string; | ||
sort?: number; | ||
}, | ||
>({ | ||
title, | ||
items, | ||
focused, | ||
select, | ||
renderItem = ({ item }: { item: T }) => <>{JSON.stringify(item)}</>, | ||
}: ComposerBoxPopupProps<T>): ReactElement | null => { | ||
const id = useUniqueId(); | ||
return ( | ||
<Box className='message-popup-position' position='relative'> | ||
<Tile className='message-popup' padding={0} role='menu' mbe='x2' maxHeight='20rem' aria-labelledby={id}> | ||
{title && ( | ||
<Box bg='tint' pi='x16' pb='x8' id={id}> | ||
{title} | ||
</Box> | ||
)} | ||
<Box pb='x8'> | ||
{items | ||
.flatMap((item) => { | ||
if (item.isSuccess) { | ||
return item.data; | ||
} | ||
return []; | ||
}) | ||
.sort((a, b) => (('sort' in a && a.sort) || 0) - (('sort' in b && b.sort) || 0)) | ||
.map((item, index) => { | ||
return ( | ||
<Option | ||
onClick={() => select(item)} | ||
selected={item === focused} | ||
key={index} | ||
id={`popup-item-${item._id}`} | ||
tabIndex={item === focused ? 0 : -1} | ||
> | ||
{renderItem({ item })} | ||
</Option> | ||
); | ||
})} | ||
{items.some((item) => item.isLoading && item.fetchStatus !== 'idle') && <OptionSkeleton />} | ||
</Box> | ||
</Tile> | ||
</Box> | ||
); | ||
}; |
21 changes: 21 additions & 0 deletions
21
apps/meteor/app/ui-message/client/popup/components/ComposerBoxPopupCannedResponse.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { OptionColumn, OptionContent } from '@rocket.chat/fuselage'; | ||
|
||
export type ComposerBoxPopupCannedResponseProps = { | ||
_id: string; | ||
text: string; | ||
shortcut: string; | ||
}; | ||
|
||
const ComposerPopupCannedResponse = ({ shortcut, text }: ComposerBoxPopupCannedResponseProps) => { | ||
return ( | ||
<> | ||
<OptionColumn> | ||
<strong>{shortcut}</strong> | ||
</OptionColumn> | ||
<OptionContent>{text}</OptionContent> | ||
</> | ||
); | ||
}; | ||
|
||
export default ComposerPopupCannedResponse; |
21 changes: 21 additions & 0 deletions
21
apps/meteor/app/ui-message/client/popup/components/ComposerBoxPopupEmoji.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { OptionColumn, OptionContent } from '@rocket.chat/fuselage'; | ||
|
||
import Emoji from '../../../../../client/components/Emoji'; | ||
|
||
export type ComposerBoxPopupEmojiProps = { | ||
_id: string; | ||
}; | ||
|
||
const ComposerPopupEmoji = ({ _id }: ComposerBoxPopupEmojiProps) => { | ||
return ( | ||
<> | ||
<OptionColumn> | ||
<Emoji emojiHandle={_id} /> | ||
</OptionColumn> | ||
<OptionContent>{_id}</OptionContent> | ||
</> | ||
); | ||
}; | ||
|
||
export default ComposerPopupEmoji; |
22 changes: 22 additions & 0 deletions
22
apps/meteor/app/ui-message/client/popup/components/ComposerBoxPopupRoom.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import { OptionColumn, OptionContent } from '@rocket.chat/fuselage'; | ||
import type { IRoom } from '@rocket.chat/core-typings'; | ||
|
||
import { RoomIcon } from '../../../../../client/components/RoomIcon'; | ||
|
||
export type ComposerBoxPopupRoomProps = Pick<IRoom, 't' | 'name' | 'fname' | '_id' | 'prid' | 'teamMain' | 'u'>; | ||
|
||
const ComposerBoxPopupRoom = ({ fname, name, ...props }: ComposerBoxPopupRoomProps) => { | ||
return ( | ||
<> | ||
<OptionColumn> | ||
<RoomIcon room={props} /> | ||
</OptionColumn> | ||
<OptionContent> | ||
<strong>{fname ?? name}</strong> | ||
</OptionContent> | ||
</> | ||
); | ||
}; | ||
|
||
export default ComposerBoxPopupRoom; |
21 changes: 21 additions & 0 deletions
21
apps/meteor/app/ui-message/client/popup/components/ComposerBoxPopupSlashCommand.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { OptionColumn, OptionContent } from '@rocket.chat/fuselage'; | ||
|
||
export type ComposerBoxPopupSlashCommandProps = { | ||
_id: string; | ||
description?: string; | ||
params?: string; | ||
}; | ||
|
||
const ComposerPopupSlashCommand = ({ _id, description, params }: ComposerBoxPopupSlashCommandProps) => { | ||
return ( | ||
<> | ||
<OptionColumn> | ||
<strong>{_id}</strong> {params} | ||
</OptionColumn> | ||
<OptionContent>{description}</OptionContent> | ||
</> | ||
); | ||
}; | ||
|
||
export default ComposerPopupSlashCommand; |
50 changes: 50 additions & 0 deletions
50
apps/meteor/app/ui-message/client/popup/components/ComposerBoxPopupUser.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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import { OptionAvatar, OptionColumn, OptionContent } from '@rocket.chat/fuselage'; | ||
|
||
import UserAvatar from '../../../../../client/components/avatar/UserAvatar'; | ||
import ReactiveUserStatus from '../../../../../client/components/UserStatus/ReactiveUserStatus'; | ||
|
||
export type ComposerBoxPopupUserProps = { | ||
_id: string; | ||
system?: boolean; | ||
outside?: boolean; | ||
suggestion?: boolean; | ||
username: string; | ||
name?: string; | ||
nickname?: string; | ||
status?: string; | ||
sort?: number; | ||
}; | ||
|
||
const ComposerBoxPopupUser = ({ _id, system, username, name, nickname, outside, suggestion }: ComposerBoxPopupUserProps) => { | ||
const t = useTranslation(); | ||
return ( | ||
<> | ||
{!system && ( | ||
<> | ||
<OptionAvatar> | ||
<UserAvatar size='x28' username={username} /> | ||
</OptionAvatar> | ||
<OptionColumn> | ||
<ReactiveUserStatus uid={_id} /> | ||
</OptionColumn> | ||
<OptionContent> | ||
<strong>{name ?? username}</strong> {nickname && <span className='popup-user-nickname'>({nickname})</span>} | ||
</OptionContent> | ||
</> | ||
)} | ||
|
||
{system && ( | ||
<OptionContent> | ||
<strong>{username}</strong> {name} | ||
</OptionContent> | ||
)} | ||
|
||
{outside && <OptionColumn>{t('Not_in_channel')}</OptionColumn>} | ||
{suggestion && <OptionColumn>{t('Suggestion_from_recent_messages')}</OptionColumn>} | ||
</> | ||
); | ||
}; | ||
|
||
export default ComposerBoxPopupUser; |
29 changes: 0 additions & 29 deletions
29
apps/meteor/app/ui-message/client/popup/customMessagePopups.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.