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

feat: added users page layout #605

Merged
merged 1 commit into from
Nov 21, 2022
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
12 changes: 6 additions & 6 deletions frontend/src/components/Sidebar/partials/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ const SideBarContent: React.FC<SidebarContentProps> = ({ strategy }) => {
<StyledText>Boards</StyledText>
</StyledMenuItem>
</Link>
<Tooltip color="primary100" content="Coming Soon">
<StyledMenuItem disabled align="center" data-active={active === USERS_ROUTE}>
<Link href={USERS_ROUTE}>
<StyledMenuItem align="center" data-active={active === USERS_ROUTE}>
<Icon name="user" />
<StyledText>Users</StyledText>
</StyledMenuItem>
</Tooltip>
<Tooltip color="primary100" content="Coming Soon">
<StyledMenuItem disabled align="center" data-active={active === TEAMS_ROUTE}>
</Link>
<Link href={TEAMS_ROUTE}>
<StyledMenuItem align="center" data-active={active === TEAMS_ROUTE}>
<Icon name="team" />
<StyledText>Teams</StyledText>
</StyledMenuItem>
</Tooltip>
</Link>
<StyledSeparator />
<Tooltip color="primary100" content="Coming Soon">
<StyledMenuItem disabled align="center" data-active={active === ACCOUNT_ROUTE}>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/layouts/DashboardLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ type DashboardLayoutProps = {
isBoards: boolean;
isTeams: boolean;
canAddBoard: boolean;
isUsers: boolean;
};

const DashboardLayout = (props: DashboardLayoutProps) => {
const { children, firstName, isDashboard, isBoards, isTeams, canAddBoard } = props;
const { children, firstName, isDashboard, isBoards, isTeams, canAddBoard, isUsers } = props;

return (
<ContentSection gap="36" justify="between">
Expand All @@ -25,6 +26,7 @@ const DashboardLayout = (props: DashboardLayoutProps) => {
{isDashboard && <Text heading="1">Welcome, {firstName}</Text>}
{isBoards && <Text heading="1">Boards</Text>}
{isTeams && <Text heading="1">Teams</Text>}
{isUsers && <Text heading="1">Users</Text>}
{(isDashboard || isBoards) && (
<Link href="/boards/new">
<AddNewBoardButton size={isDashboard ? 'sm' : 'md'}>
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/layouts/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { signOut, useSession } from 'next-auth/react';
import LoadingPage from 'components/loadings/LoadingPage';
import { Sidebar } from 'components/Sidebar';
import { REFRESH_TOKEN_ERROR } from 'utils/constants';
import { BOARDS_ROUTE, DASHBOARD_ROUTE, TEAMS_ROUTE } from 'utils/routes';
import { BOARDS_ROUTE, DASHBOARD_ROUTE, TEAMS_ROUTE, USERS_ROUTE } from 'utils/routes';
import DashboardLayout from '../DashboardLayout';
import { Container } from './styles';

Expand All @@ -20,6 +20,7 @@ const Layout: React.FC<{ children: ReactNode; canAddBoard?: boolean }> = ({
const isDashboard = router.pathname === DASHBOARD_ROUTE;
const isBoards = router.pathname === BOARDS_ROUTE;
const isTeams = router.pathname === TEAMS_ROUTE;
const isUsers = router.pathname === USERS_ROUTE;

if (session?.error === REFRESH_TOKEN_ERROR) {
signOut({ callbackUrl: '/' });
Expand All @@ -34,11 +35,12 @@ const Layout: React.FC<{ children: ReactNode; canAddBoard?: boolean }> = ({
isBoards={isBoards}
isDashboard={isDashboard}
isTeams={isTeams}
isUsers={isUsers}
>
{children}
</DashboardLayout>
);
}, [children, isBoards, isDashboard, session, isTeams, canAddBoard]);
}, [children, isBoards, isDashboard, session, isTeams, canAddBoard, isUsers]);

if (!session) return <LoadingPage />;

Expand Down
16 changes: 16 additions & 0 deletions frontend/src/pages/users/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ReactElement } from 'react';
import { useSession } from 'next-auth/react';

import Layout from 'components/layouts/Layout';
import Flex from 'components/Primitives/Flex';

const Users = () => {
const { data: session } = useSession({ required: true });

if (!session) return null; // after getUsers issue, need to add || !data to the if
return <Flex direction="column" />;
};

Users.getLayout = (page: ReactElement) => <Layout>{page}</Layout>;

export default Users;
3 changes: 2 additions & 1 deletion frontend/src/utils/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const ROUTES = {
BoardPage: (boardId: string): string => `/boards/${boardId}`,
Token: RESET_PASSWORD_ROUTE,
TokenPage: (tokenId: string): string => `/reset-password/${tokenId}`,
Teams: TEAMS_ROUTE
Teams: TEAMS_ROUTE,
Users: USERS_ROUTE
};

export const GetPageTitleByUrl = (url: string): string | undefined => {
Expand Down