Skip to content
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
39 changes: 24 additions & 15 deletions apps/meteor/client/views/home/DefaultHomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Grid } from '@rocket.chat/fuselage';
import { usePermission, useAtLeastOnePermission } from '@rocket.chat/ui-contexts';
import { Box, Grid } from '@rocket.chat/fuselage';
import { usePermission, useAtLeastOnePermission, useSetting, useTranslation } from '@rocket.chat/ui-contexts';
import React, { ReactElement } from 'react';

import Page from '../../components/Page/Page';
import PageScrollableContent from '../../components/Page/PageScrollableContent';
import HomePageHeader from './HomePageHeader';
import HomepageGridItem from './HomepageGridItem';
import AddUsersCard from './cards/AddUsersCard';
import CreateChannelsCard from './cards/CreateChannelsCard';
import DesktopAppsCard from './cards/DesktopAppsCard';
Expand All @@ -15,37 +16,45 @@ import MobileAppsCard from './cards/MobileAppsCard';
const CREATE_CHANNEL_PERMISSIONS = ['create-c', 'create-p'];

const DefaultHomePage = (): ReactElement => {
const t = useTranslation();
const canAddUsers = usePermission('view-user-administration');
const canCreateChannel = useAtLeastOnePermission(CREATE_CHANNEL_PERMISSIONS);
const workspaceName = useSetting('Site_Name');

return (
<Page data-qa='page-home' data-qa-type='default' backgroundColor='neutral-100'>
<HomePageHeader />
<PageScrollableContent>
{/* Fix grid styling */}
<Box is='h1' fontScale='h1' marginBlock='x42' minHeight='x40'>
{/* eslint-disable-next-line @typescript-eslint/camelcase */}
{t('Welcome_to', { Site_Name: workspaceName || 'Rocket.Chat' })}
</Box>
<Box is='h3' fontScale='h3' marginBlock='x16'>
{t('Some_ideas_to_get_you_started')}
</Box>
<Grid>
{canAddUsers && (
<Grid.Item>
<HomepageGridItem>
<AddUsersCard />
</Grid.Item>
</HomepageGridItem>
)}
{canCreateChannel && (
<Grid.Item>
<HomepageGridItem>
<CreateChannelsCard />
</Grid.Item>
</HomepageGridItem>
)}
<Grid.Item>
<HomepageGridItem>
<JoinRoomsCard />
</Grid.Item>
<Grid.Item>
</HomepageGridItem>
<HomepageGridItem>
<MobileAppsCard />
</Grid.Item>
<Grid.Item>
</HomepageGridItem>
<HomepageGridItem>
<DesktopAppsCard />
</Grid.Item>
<Grid.Item>
</HomepageGridItem>
<HomepageGridItem>
<DocumentationCard />
</Grid.Item>
</HomepageGridItem>
</Grid>
</PageScrollableContent>
</Page>
Expand Down
17 changes: 17 additions & 0 deletions apps/meteor/client/views/home/HomepageGridItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Grid } from '@rocket.chat/fuselage';
import { useBreakpoints } from '@rocket.chat/fuselage-hooks';
import React, { ReactNode, ReactElement } from 'react';

const HomepageGridItem = ({ children }: { children: ReactNode }): ReactElement => {
const breakpoints = useBreakpoints();

const isMedium = !breakpoints.includes('lg');

return (
<Grid.Item xs={4} sm={4} md={4} lg={6} xl={4} maxWidth={isMedium ? '100%' : '50%'} flexGrow={1}>
{children}
</Grid.Item>
);
};

export default HomepageGridItem;
1 change: 1 addition & 0 deletions apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4157,6 +4157,7 @@
"snippet-message_description": "Permission to create snippet message",
"Snippeted_a_message": "Created a snippet __snippetLink__",
"Social_Network": "Social Network",
"Some_ideas_to_get_you_started": "Some ideas to get you started",
"Sorry_page_you_requested_does_not_exist_or_was_deleted": "Sorry, page you requested does not exist or was deleted!",
"Sort": "Sort",
"Sort_By": "Sort by",
Expand Down