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] Create header for new homepage #25795

Merged
merged 6 commits into from
Jun 9, 2022
Merged
Changes from 3 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
36 changes: 34 additions & 2 deletions apps/meteor/client/views/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,48 @@
import { Box, Button, Icon } from '@rocket.chat/fuselage';
import { useSetting, useLayout, useTranslation, useAllPermissions } from '@rocket.chat/ui-contexts';
import React, { ReactElement } from 'react';

import BurgerMenu from '../../components/BurgerMenu';
import TemplateHeader from '../../components/Header';
import Page from '../../components/Page/Page';
import CustomHomePage from './CustomHomePage';

// TODO: use a setting to determine if the user has a custom home page
const custom = true;
const custom = false;

const editLayoutPermissions = ['view-privileged-setting', 'edit-privileged-setting', 'manage-selected-settings'];

const HomePage = (): ReactElement => {
const t = useTranslation();
const title = useSetting('Layout_Home_Title') as string;
const { isMobile } = useLayout();
const canEditLayout = useAllPermissions(editLayoutPermissions);

if (custom) {
return <CustomHomePage />;
}

return <></>; // TODO: render a default home page
return (
<Page data-qa='page-home'>
<Box marginBlock='x16' marginInline='x24' display='flex' flexDirection='row' justifyContent='space-between'>
{isMobile && (
<TemplateHeader.ToolBox>
<BurgerMenu />
</TemplateHeader.ToolBox>
)}
<Box as='h2' fontScale='h2' flexGrow={1}>
{title}
</Box>
{canEditLayout && (
<Button is='a' href='/admin/settings/Layout'>
<>
<Icon name='pencil' size='x16' /> {t('Customize')}
</>
</Button>
)}
</Box>
</Page>
);
};

export default HomePage;