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

New/teams #21269

Merged
merged 108 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
78fa840
add folder structure
Mar 1, 2021
124e884
Rewrite Infopanels, create teaminfo
gabriellsh Mar 2, 2021
e7bcd48
Convert buttons to actions
gabriellsh Mar 2, 2021
8cd3581
Merge branch 'develop' into new/teams
gabriellsh Mar 2, 2021
777ad30
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into te…
gabriellsh Mar 2, 2021
c9c26a8
Create ChannelAutoCompleteMultiple component
tiagoevanp Mar 3, 2021
b2afd51
Create GenericModal with Variants
gabriellsh Mar 4, 2021
ae857d6
wip
Mar 4, 2021
5a4cfb2
Create GenericModal with Variants
gabriellsh Mar 4, 2021
adbd7ba
Create GenericModal with Variants
gabriellsh Mar 4, 2021
21fab65
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into ne…
gabriellsh Mar 4, 2021
9dfb367
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into te…
gabriellsh Mar 4, 2021
1c63563
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into cr…
tiagoevanp Mar 4, 2021
1c730a6
Merge branch 'new/teams' of https://github.com/RocketChat/Rocket.Chat…
Mar 4, 2021
ba554ba
WIP DeleteTeamModal
gabriellsh Mar 5, 2021
5a6d9d3
Merge branch 'teams/info' of github.com:RocketChat/Rocket.Chat into t…
gabriellsh Mar 5, 2021
3d140c3
add visual components
Mar 5, 2021
1a03837
remove enum
gabriellsh Mar 8, 2021
cef7199
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into cr…
tiagoevanp Mar 8, 2021
be7d2a2
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into new/…
tiagoevanp Mar 8, 2021
e24fa94
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into cr…
tiagoevanp Mar 8, 2021
43ed4d9
[WIP] Create Team Modal
tiagoevanp Mar 8, 2021
da053d2
add pagination prop to GenericTable
Mar 9, 2021
dc477a7
revert GenericTable
Mar 8, 2021
93cae5e
add variants
Mar 9, 2021
cb35726
Separate files, table logic
gabriellsh Mar 9, 2021
7be849d
lint
gabriellsh Mar 9, 2021
e27d29d
Merge branch 'new/teams' into teams/info
Mar 9, 2021
77ff283
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into new/…
gabriellsh Mar 15, 2021
0e5ec9f
Merge branch 'new/teams-back' of github.com:RocketChat/Rocket.Chat in…
gabriellsh Mar 15, 2021
99458c0
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into te…
gabriellsh Mar 15, 2021
2fcb653
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into cr…
tiagoevanp Mar 15, 2021
7c294d6
create teams modal
tiagoevanp Mar 15, 2021
5b6d603
remove ChannelAutoCompleteMultiple component
tiagoevanp Mar 15, 2021
74e4eaf
set description in team
tiagoevanp Mar 15, 2021
aaff009
fix redirect to room
tiagoevanp Mar 16, 2021
c3cd52f
Merge pull request #21143 from RocketChat/new/teams-back
tassoevan Mar 16, 2021
762556c
remove braces from simple string
tiagoevanp Mar 16, 2021
525da3b
single coat instead bool
tiagoevanp Mar 16, 2021
bca5227
Merge branch 'create-teams-modal' of github.com:RocketChat/Rocket.Cha…
tiagoevanp Mar 16, 2021
738b795
refactor useReactModal
tiagoevanp Mar 16, 2021
88075ec
Merge branch 'develop' into new/teams
tassoevan Mar 16, 2021
8b44d0e
Merge branch 'new/teams' into create-teams-modal
tiagoevanp Mar 16, 2021
cabceda
Merge pull request #21130 from RocketChat/create-teams-modal
tassoevan Mar 16, 2021
9c9380f
Move CreateTeam module
tassoevan Mar 16, 2021
90b33a7
Split TeamNameInput
tassoevan Mar 16, 2021
37df3df
Convert BaseAvatar and UserAvatar to TypeScript
tassoevan Mar 17, 2021
b25add2
Add UsersInput
tassoevan Mar 17, 2021
4a2365c
Convert CreateTeamModal to TypeScript
tassoevan Mar 17, 2021
2a69803
Upgrade Fuselage
tassoevan Mar 17, 2021
fa74ef5
WIP
gabriellsh Mar 17, 2021
b5b779d
Merge branch 'new/teams-back' of github.com:RocketChat/Rocket.Chat in…
gabriellsh Mar 17, 2021
0e0f8ef
update generic modal
Mar 17, 2021
41ebaa5
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into te…
gabriellsh Mar 17, 2021
d6b795c
Fix team name validation
tassoevan Mar 17, 2021
4fb26c2
Update i18n strings
tassoevan Mar 17, 2021
51231c1
Add autofocus
tassoevan Mar 17, 2021
4482740
Pass translation-check
tassoevan Mar 17, 2021
eb670eb
Fix goToRoomById call
tassoevan Mar 17, 2021
b5bdc93
Merge pull request #21161 from RocketChat/new/teams-create-modal-and-…
tiagoevanp Mar 17, 2021
04eae13
Fix JSX expression
tassoevan Mar 17, 2021
9611e2b
[FIX] Unexpected open or close visitor info (#21094)
tiagoevanp Mar 18, 2021
456d052
Type check useMethod hook
tassoevan Mar 18, 2021
0c46942
Merge branch 'develop' into new/teams
tassoevan Mar 18, 2021
cdcc364
Type check useEndpoint hook
tassoevan Mar 19, 2021
bd9436f
Type check useTranslation hook
tassoevan Mar 19, 2021
eba1e9b
[NEW] use _rocketchatLogger in Apps debugLog (#21000)
cuonghuunguyen Mar 19, 2021
86b801e
Merge branch 'develop' into new/teams
tassoevan Mar 19, 2021
6f5c9fa
Remove redundant polyfill
tassoevan Mar 19, 2021
73bd00f
Merge branch 'new/teams-back' of github.com:RocketChat/Rocket.Chat in…
gabriellsh Mar 19, 2021
49b5f89
[IMPROVE] Improve Apps permission modal (#21193)
lucassartor Mar 19, 2021
c163bf9
[NEW][APPS] Map description as a room value in Apps (#20811)
lucassartor Mar 19, 2021
4eaf679
Merge branch 'new/teams' into new/teams-members
Mar 19, 2021
9f6d75e
Merge branch 'develop' into new/teams
tassoevan Mar 20, 2021
bedcec2
WIP
gabriellsh Mar 20, 2021
7828fb5
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into te…
gabriellsh Mar 20, 2021
9bbf11a
[FIX] Wrong license seats number administration info panel (#21222)
rodrigok Mar 20, 2021
c657bfc
Merge branch 'develop' into new/teams
tassoevan Mar 21, 2021
4f31339
Merge branch 'new/teams-back' of github.com:RocketChat/Rocket.Chat in…
tiagoevanp Mar 22, 2021
48fcac4
Delete & Leave Modals
gabriellsh Mar 22, 2021
231c128
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into te…
gabriellsh Mar 22, 2021
779bc40
wip
Mar 22, 2021
f05330f
Merge branch 'new/teams-members' into new/remove-users-modal
Mar 22, 2021
6c6ea5b
Merge branch 'new/teams-back' of github.com:RocketChat/Rocket.Chat in…
tiagoevanp Mar 22, 2021
8718e7f
Fix bugs and remove logs
gabriellsh Mar 22, 2021
4f283ca
expose teams fields to local collection
tiagoevanp Mar 22, 2021
49339f6
Add teams section and team icon logic
gabriellsh Mar 22, 2021
03a9a41
Add prototype of teams.listRoomsOfUser
tassoevan Mar 22, 2021
dce14da
Merge pull request #21260 from RocketChat/teams/icon-sidebar
tassoevan Mar 22, 2021
1099ea6
Merge branch 'new/teams-back' into new/teams
tassoevan Mar 22, 2021
054f515
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into ne…
tassoevan Mar 22, 2021
f32ca47
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into te…
gabriellsh Mar 22, 2021
494b8f1
Merge branch 'new/teams-back' of github.com:RocketChat/Rocket.Chat in…
gabriellsh Mar 22, 2021
b28f183
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into te…
gabriellsh Mar 22, 2021
02f37ea
fix leave room array
gabriellsh Mar 22, 2021
5c11446
Add tabbar actions to team room
gabriellsh Mar 22, 2021
747ffec
Review
gabriellsh Mar 22, 2021
816882d
Merge branch 'new/teams' of https://github.com/RocketChat/Rocket.Chat…
Mar 23, 2021
b04b511
backend integration
Mar 23, 2021
6a7606d
Review
tassoevan Mar 23, 2021
01bfc76
Merge pull request #21258 from RocketChat/teams/info
tassoevan Mar 23, 2021
ba74e28
Merge branch 'new/teams' of github.com:RocketChat/Rocket.Chat into ne…
tassoevan Mar 23, 2021
b4d5e6d
Review
tassoevan Mar 23, 2021
97fe46c
Review
tassoevan Mar 23, 2021
a063b8e
Review
tassoevan Mar 23, 2021
7048ba1
Review
tassoevan Mar 23, 2021
8d718a0
hide renderTrackHorizontal on rc-scrollbars
Mar 23, 2021
3fdd1d4
Merge pull request #21021 from RocketChat/new/remove-users-modal
tassoevan Mar 23, 2021
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
28 changes: 27 additions & 1 deletion app/api/server/v1/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,28 @@ API.v1.addRoute('teams.listRooms', { authRequired: true }, {
},
});

API.v1.addRoute('teams.listRoomsOfUser', { authRequired: true }, {
get() {
const { offset, count } = this.getPaginationItems();
const { teamId, userId } = this.queryParams;

const allowPrivateTeam = hasPermission(this.userId, 'view-all-teams');

if (!hasPermission(this.userId, 'view-all-team-channels')) {
return API.v1.unauthorized();
}

const { records, total } = Promise.await(Team.listRoomsOfUser(this.userId, teamId, userId, allowPrivateTeam, { offset, count }));

return API.v1.success({
rooms: records,
total,
count: records.length,
offset: 0,
});
},
});

API.v1.addRoute('teams.members', { authRequired: true }, {
get() {
const { offset, count } = this.getPaginationItems();
Expand Down Expand Up @@ -196,10 +218,14 @@ API.v1.addRoute('teams.removeMembers', { authRequired: true }, {
return API.v1.unauthorized();
}

const { teamId, teamName, members } = this.bodyParams;
const { teamId, teamName, members, rooms } = this.bodyParams;

Promise.await(Team.removeMembers(teamId, teamName, members));

if (rooms?.length) {
Subscriptions.removeByRoomIdsAndUserId(rooms, this.userId);
}

return API.v1.success();
},
});
Expand Down
2 changes: 1 addition & 1 deletion app/apps/client/gameCenter/tabBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ addAction('game-center', () => {
&& !hasError
&& hasExternalComponents
? {
groups: ['channel', 'group', 'direct'],
groups: ['channel', 'group', 'direct', 'team'],
id: 'game-center',
title: 'Apps_Game_Center',
icon: 'game',
Expand Down
2 changes: 1 addition & 1 deletion app/autotranslate/client/lib/tabBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ addAction('autotranslate', () => {
const hasPermission = usePermission('auto-translate');
const autoTranslateEnabled = useSetting('AutoTranslate_Enabled');
return useMemo(() => (hasPermission && autoTranslateEnabled ? {
groups: ['channel', 'group', 'direct'],
groups: ['channel', 'group', 'direct', 'team'],
id: 'autotranslate',
title: 'Auto_Translate',
icon: 'language',
Expand Down
2 changes: 1 addition & 1 deletion app/discussion/client/tabBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ addAction('discussions', () => {
const discussionEnabled = useSetting('Discussion_enabled');

return useMemo(() => (discussionEnabled ? {
groups: ['channel', 'group', 'direct'],
groups: ['channel', 'group', 'direct', 'team'],
id: 'discussions',
title: 'Discussions',
icon: 'discussion',
Expand Down
2 changes: 1 addition & 1 deletion app/e2e/client/tabbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ addAction('e2e', ({ room }) => {
const enabledOnRoom = !!room.encrypted;

return useMemo(() => (e2eEnabled && hasPermission ? {
groups: ['direct', 'group'],
groups: ['direct', 'group', 'team'],
id: 'e2e',
title: enabledOnRoom ? 'E2E_disable' : 'E2E_enable',
icon: 'key',
Expand Down
2 changes: 1 addition & 1 deletion app/livestream/client/tabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ addAction('livestream', ({ room }) => {
const isLive = room && room.streamingOptions && room.streamingOptions.id && room.streamingOptions.type === 'livestream';

return useMemo(() => (enabled ? {
groups: ['channel', 'group'],
groups: ['channel', 'group', 'team'],
id: 'livestream',
title: 'Livestream',
icon: 'podcast',
Expand Down
2 changes: 1 addition & 1 deletion app/mentions-flextab/client/tabBar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { addAction } from '../../../client/views/room/lib/Toolbox';

addAction('mentions', {
groups: ['channel', 'group'],
groups: ['channel', 'group', 'team'],
id: 'mentions',
title: 'Mentions',
icon: 'at',
Expand Down
2 changes: 1 addition & 1 deletion app/message-pin/client/tabBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useSetting } from '../../../client/contexts/SettingsContext';
addAction('pinned-messages', () => {
const pinningAllowed = useSetting('Message_AllowPinning');
return useMemo(() => (pinningAllowed ? {
groups: ['channel', 'group', 'direct'],
groups: ['channel', 'group', 'direct', 'team'],
id: 'pinned-messages',
title: 'Pinned_Messages',
icon: 'pin',
Expand Down
2 changes: 1 addition & 1 deletion app/message-snippet/client/tabBar/tabBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useSetting } from '../../../../client/contexts/SettingsContext';
addAction('snippeted-messages', () => {
const snippetingEnabled = useSetting('Message_AllowSnippeting');
return useMemo(() => (snippetingEnabled ? {
groups: ['channel', 'group', 'direct'],
groups: ['channel', 'group', 'direct', 'team'],
id: 'snippeted-messages',
title: 'snippet-message',
icon: 'code',
Expand Down
2 changes: 1 addition & 1 deletion app/message-star/client/tabBar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { addAction } from '../../../client/views/room/lib/Toolbox';

addAction('starred-messages', {
groups: ['channel', 'group', 'direct', 'live'],
groups: ['channel', 'group', 'direct', 'live', 'team'],
id: 'starred-messages',
title: 'Starred_Messages',
icon: 'star',
Expand Down
2 changes: 1 addition & 1 deletion app/push-notifications/client/tabBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { lazy } from 'react';
import { addAction } from '../../../client/views/room/lib/Toolbox';

addAction('push-notifications', {
groups: ['channel', 'group', 'direct', 'live'],
groups: ['channel', 'group', 'direct', 'live', 'team'],
id: 'push-notifications',
title: 'Notifications_Preferences',
icon: 'bell',
Expand Down
2 changes: 1 addition & 1 deletion app/ui-cached-collection/client/models/CachedCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class CachedCollection extends Emitter {
userRelated = true,
listenChangesForLoggedUsersOnly = false,
useSync = true,
version = 15,
version = 16,
maxCacheTime = 60 * 60 * 24 * 30,
onSyncData = (/* action, record */) => {},
}) {
Expand Down
9 changes: 6 additions & 3 deletions client/components/ScrollableContentWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type CustomScrollbarsProps = {
renderTrackHorizontal?: typeof Scrollbars.defaultProps.renderTrackHorizontal;
}

const ScrollableContentWrapper = forwardRef<HTMLElement, CustomScrollbarsProps>(({ children, style, onScroll, renderView, renderTrackHorizontal }, ref) => {
const ScrollableContentWrapper = forwardRef<HTMLElement, CustomScrollbarsProps>(({ children, style, onScroll, renderView }, ref) => {
const scrollbarsStyle = useMemo(() => ({ ...style, ...styleDefault }), [style]) as CSSProperties;

return <Scrollbars
Expand All @@ -27,12 +27,15 @@ const ScrollableContentWrapper = forwardRef<HTMLElement, CustomScrollbarsProps>(
style={scrollbarsStyle}
onScrollFrame={onScroll}
renderView={renderView}
renderTrackHorizontal={renderTrackHorizontal}
renderTrackHorizontal={(props): React.ReactElement => <div {...props} className='track-horizontal' style={{ display: 'none' }}/>}
renderThumbVertical={
({ style, ...props }): JSX.Element => (
<div
{...props}
style={{ ...style, backgroundColor: 'rgba(0, 0, 0, 0.5)', borderRadius: '7px' }}
style={{ ...style,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
borderRadius: '7px',
}}
/>
)
}
Expand Down
4 changes: 4 additions & 0 deletions client/hooks/useRoomIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const useRoomIcon = (room: IRoom, small = true): JSX.Element | { name: st
return { name: 'baloons' };
}

if (room.teamMain) {
return { name: room.t === 'p' ? 'team-lock' : 'team' };
}

switch (room.t) {
case 'p':
return { name: 'hashtag-lock' };
Expand Down
1 change: 1 addition & 0 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ import './views/admin';
import './views/login';
import './views/room/adapters';
import './adapters';
import './views/teams';
6 changes: 6 additions & 0 deletions client/sidebar/hooks/useRoomList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const useRoomList = (): Array<ISubscription> => {
useEffect(() => {
setRoomList(() => {
const favorite = new Set();
const team = new Set();
const omnichannel = new Set();
const unread = new Set();
const _private = new Set();
Expand All @@ -43,6 +44,10 @@ export const useRoomList = (): Array<ISubscription> => {
return favorite.add(room);
}

if (room.teamMain) {
return team.add(room);
}

if (showDiscussion && room.prid) {
return discussion.add(room);
}
Expand Down Expand Up @@ -73,6 +78,7 @@ export const useRoomList = (): Array<ISubscription> => {
showOmnichannel && inquiries.enabled && omnichannel.size && groups.set('Open_Livechats', omnichannel);
sidebarShowUnread && unread.size && groups.set('Unread', unread);
favoritesEnabled && favorite.size && groups.set('Favorites', favorite);
team.size && groups.set('Teams', team);
showDiscussion && discussion.size && groups.set('Discussions', discussion);
sidebarGroupByType && _private.size && groups.set('Private', _private);
sidebarGroupByType && _public.size && groups.set('Public', _public);
Expand Down
67 changes: 67 additions & 0 deletions client/views/InfoPanel/InfoPanel.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from 'react';

import InfoPanel, { RetentionPolicyCallout } from '.';

export default {
title: 'components/InfoPanel',
component: InfoPanel,
};

const room = {
fname: 'rocketchat-frontend-team',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam mollis nisi vel arcu bibendum vehicula. Integer vitae suscipit libero',
announcement: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam mollis nisi vel arcu bibendum vehicula. Integer vitae suscipit libero',
topic: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam mollis nisi vel arcu bibendum vehicula. Integer vitae suscipit libero',
};

export const Default = () => <InfoPanel>
<InfoPanel.Avatar />
<InfoPanel.Section>
<InfoPanel.Title title={room.fname} icon={'hashtag'}/>
</InfoPanel.Section>

<InfoPanel.Section>
<InfoPanel.Field>
<InfoPanel.Label>Description</InfoPanel.Label>
<InfoPanel.Text>{room.description}</InfoPanel.Text>
</InfoPanel.Field>
<InfoPanel.Field>
<InfoPanel.Label>Announcement</InfoPanel.Label>
<InfoPanel.Text>{room.announcement}</InfoPanel.Text>
</InfoPanel.Field>
<InfoPanel.Field>
<InfoPanel.Label>Topic</InfoPanel.Label>
<InfoPanel.Text>{room.topic}</InfoPanel.Text>
</InfoPanel.Field>
</InfoPanel.Section>

<InfoPanel.Section>
<RetentionPolicyCallout maxAgeDefault={30} filesOnlyDefault={false} excludePinnedDefault={true} />
</InfoPanel.Section>
</InfoPanel>;


// export const Archived = () => <VerticalBar height={800}>
// <RoomInfo
// {...room}
// icon='lock'
// onClickHide={alert}
// onClickLeave={alert}
// onClickEdit={alert}
// onClickDelete={alert}
// archived
// />
// </VerticalBar>;


// export const Broadcast = () => <VerticalBar height={800}>
// <RoomInfo
// {...room}
// icon='lock'
// onClickHide={alert}
// onClickLeave={alert}
// onClickEdit={alert}
// onClickDelete={alert}
// broadcast
// />
// </VerticalBar>;
62 changes: 62 additions & 0 deletions client/views/InfoPanel/InfoPanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React, { FC, ReactNode } from 'react';
import { Box, Icon, BoxProps, Button, ButtonProps, ButtonGroup, ButtonGroupProps } from '@rocket.chat/fuselage';
import { css } from '@rocket.chat/css-in-js';

type TitleProps = {
title: string;
icon: string | ReactNode;
}

const wordBreak = css`
word-break: break-word;
`;

const InfoPanel: FC = ({ children }) => <Box flexGrow={1} mb='neg-x24'>{children}</Box>;

const Section: FC<BoxProps> = (props) => <Box mb='x24' {...props} />;

const Title: FC<TitleProps> = ({ title, icon }) => <Box display='flex' title={title} flexShrink={0} alignItems='center' fontScale='s2' color='default' withTruncatedText>
{
typeof icon === 'string'
? <Icon name={icon} size='x22' />
: icon
}
<Box mis='x16' flexGrow={1} withTruncatedText>{title}</Box>
</Box>;

const Label: FC<BoxProps> = (props) => <Box mb='x8' fontScale='p2' color='default' {...props} />;

const Text: FC<BoxProps> = (props) => <Box
mb='x8'
fontScale='p1'
color='hint'
withTruncatedText
className={wordBreak}
{...props}
/>;

const Action: FC<ButtonProps & { icon: string; label: string }> = ({ label, icon, ...props }) => <Button title={label} aria-label={label} {...props} mi='x4'>
<Icon name={icon} size='x20' mie='x4' />
{label}
</Button>;

const ActionGroup: FC<ButtonGroupProps> = (props) => <Section><ButtonGroup flexShrink={0} flexWrap='nowrap' withTruncatedText justifyContent='center' {...props}/></Section>;

const Field: FC = ({ children }) => <Box mb='x12'>{children}</Box>;

const Avatar: FC = ({ children }) => <Section display='flex' justifyContent='center'>
{children}
</Section>;

Object.assign(InfoPanel, {
Title,
Label,
Text,
Avatar,
Field,
Action,
Section,
ActionGroup,
});

export default InfoPanel;
22 changes: 22 additions & 0 deletions client/views/InfoPanel/RetentionPolicyCallout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { FC } from 'react';
import { Callout } from '@rocket.chat/fuselage';

import { useTranslation } from '../../contexts/TranslationContext';

type RetentionPolicyCalloutProps = {
filesOnlyDefault: boolean;
excludePinnedDefault: boolean;
maxAgeDefault: number;
}

const RetentionPolicyCallout: FC<RetentionPolicyCalloutProps> = ({ filesOnlyDefault, excludePinnedDefault, maxAgeDefault }) => {
const t = useTranslation();
return <Callout type='warning'>
{filesOnlyDefault && excludePinnedDefault && <p>{t('RetentionPolicy_RoomWarning_FilesOnly', { time: maxAgeDefault })}</p>}
{filesOnlyDefault && !excludePinnedDefault && <p>{t('RetentionPolicy_RoomWarning_UnpinnedFilesOnly', { time: maxAgeDefault })}</p>}
{!filesOnlyDefault && excludePinnedDefault && <p>{t('RetentionPolicy_RoomWarning', { time: maxAgeDefault })}</p>}
{!filesOnlyDefault && !excludePinnedDefault && <p>{t('RetentionPolicy_RoomWarning_Unpinned', { time: maxAgeDefault })}</p>}
</Callout>;
};

export default RetentionPolicyCallout;
6 changes: 6 additions & 0 deletions client/views/InfoPanel/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import InfoPanel from './InfoPanel';
import RetentionPolicyCallout from './RetentionPolicyCallout';

export { RetentionPolicyCallout };

export default InfoPanel;
4 changes: 2 additions & 2 deletions client/views/admin/users/UserInfoActions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ButtonGroup, Menu, Option } from '@rocket.chat/fuselage';
import React, { useCallback, useMemo } from 'react';

import { useUserInfoActionsSpread } from '../../room/hooks/useUserInfoActions';
import { useActionSpread } from '../../hooks/useActionSpread';
import ConfirmOwnerChangeWarningModal from '../../../components/ConfirmOwnerChangeWarningModal';
import { UserInfo } from '../../room/contextualBar/UserInfo';
import { usePermission } from '../../../contexts/AuthorizationContext';
Expand Down Expand Up @@ -234,7 +234,7 @@ export const UserInfoActions = ({ username, _id, isActive, isAdmin, onChange })
username,
]);

const { actions: actionsDefinition, menu: menuOptions } = useUserInfoActionsSpread(options);
const { actions: actionsDefinition, menu: menuOptions } = useActionSpread(options);

const menu = useMemo(() => {
if (!menuOptions) {
Expand Down
Loading