Skip to content

Commit

Permalink
Merge pull request #618 from commons-stack/my_praise_root_page
Browse files Browse the repository at this point in the history
Merge "my praise" into root page #615
  • Loading branch information
kristoferlund authored Oct 7, 2022
2 parents bfdfc35 + 660e081 commit 04932aa
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 38 deletions.
2 changes: 1 addition & 1 deletion packages/frontend/src/components/ui/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const Button = ({
'disabled:cursor-default disabled:bg-themecolor-3/50 disabled:text-white/50';

const defaultClass = `px-4 py-2 font-bold text-white rounded-md bg-themecolor-3 hover:bg-themecolor-4 ${disabledModifier}`;
const outlineClass = `px-4 py-2 font-bold text-white rounded-md bg-themecolor-3 hover:bg-themecolor-4 ${disabledModifier}`;
const outlineClass = `border-2 border-themecolor-3 px-4 py-2 font-bold text-white rounded-md bg-themecolor-3 hover:bg-themecolor-4 ${disabledModifier}`;
const roundClass = `flex items-center justify-center rounded-full hover:bg-warm-gray-300 w-7 h-7 dark:text-white dark:hover:bg-slate-800 ${disabledModifier}`;

let variantClass = defaultClass;
Expand Down
5 changes: 0 additions & 5 deletions packages/frontend/src/navigation/AuthenticatedRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ROLE_ADMIN, ROLE_QUANTIFIER } from '@/model/auth';

const StartPage = React.lazy(() => import('@/pages/Start/StartPage'));
const SettingsPage = React.lazy(() => import('@/pages/Settings/SettingsPage'));
const MyPraisePage = React.lazy(() => import('@/pages/MyPraise/MyPraisePage'));
const UserDetailsPage = React.lazy(
() => import('@/pages/UserDetails/UserDetailsPage')
);
Expand Down Expand Up @@ -90,10 +89,6 @@ export const AuthenticatedRoutes = ({
}: Props): JSX.Element | null => {
return (
<Switch>
<Route path="/mypraise">
<MyPraisePage />
</Route>

<AuthRoute
userRoles={userRoles}
roles={[ROLE_ADMIN]}
Expand Down
5 changes: 0 additions & 5 deletions packages/frontend/src/navigation/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ export const Nav = (): JSX.Element => {
<NavLogo />
</li>

<NavItem
icon={faPrayingHands}
description="My praise"
to="/mypraise"
/>
<NavItem icon={faCalendarAlt} description="Periods" to="/periods" />
<AdminOnly>
<NavItem
Expand Down
23 changes: 0 additions & 23 deletions packages/frontend/src/pages/MyPraise/MyPraisePage.tsx

This file was deleted.

48 changes: 44 additions & 4 deletions packages/frontend/src/pages/Start/StartPage.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,60 @@
import { faPrayingHands } from '@fortawesome/free-solid-svg-icons';
import React from 'react';
import {
faPrayingHands,
faUser,
faUsers,
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useState } from 'react';
import { BreadCrumb } from '@/components/ui/BreadCrumb';
import { ActiveNoticesBoard } from '@/components/periods/ActiveNoticesBoard';
import { Box } from '@/components/ui/Box';
import { Page } from '@/components/ui/Page';
import { Button } from '@/components/ui/Button';
import { PraiseTable } from './components/PraiseTable';
import { MyPraiseTable } from './components/MyPraiseTable';

const StartPage = (): JSX.Element => {
const pageViews = {
praiseView: 1,
myPraiseView: 2,
};

const [view, setView] = useState<number>(pageViews.praiseView);

return (
<Page>
<BreadCrumb name="Praise" icon={faPrayingHands} />

<ActiveNoticesBoard />

<div className="mb-5">
<Button
variant={'outline'}
className={`rounded-r-none ${
view === pageViews.myPraiseView
? 'bg-opacity-50 text-opacity-50 hover:border-themecolor-4'
: 'hover:bg-themecolor-3 hover:border-themecolor-3'
}`}
onClick={(): void => setView(pageViews.praiseView)}
>
<FontAwesomeIcon icon={faUsers} size="1x" className="mr-2" />
All Praise
</Button>
<Button
variant={'outline'}
className={`rounded-l-none ${
view === pageViews.praiseView
? 'bg-opacity-50 text-opacity-50 hover:border-themecolor-4 '
: 'hover:bg-themecolor-3 hover:border-themecolor-3'
}`}
onClick={(): void => setView(pageViews.myPraiseView)}
>
<FontAwesomeIcon icon={faUser} size="1x" className="mr-2" />
My Praise
</Button>
</div>

<Box className="p-0">
<PraiseTable />
{view === pageViews.praiseView ? <PraiseTable /> : <MyPraiseTable />}
</Box>
</Page>
);
Expand Down

0 comments on commit 04932aa

Please sign in to comment.