Skip to content

Commit

Permalink
feat: added seedlot dashboard page and initial grid display for it (#32)
Browse files Browse the repository at this point in the history
* feat: added seedlot dashboard page and initial grid display for it

* fix: seedlot dashboard url
  • Loading branch information
mgaseta authored and DerekRoberts committed May 14, 2024
1 parent e152e6b commit b38e772
Show file tree
Hide file tree
Showing 18 changed files with 179 additions and 59 deletions.
12 changes: 11 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import { useAuth } from './contexts/AuthContext';
import SilentCheckSso from './components/SilentCheckSso';
import Logout from './components/Logout';
import Layout from './layout/PublicLayout';
import Dashboard from './views/Dashboard/dashboard';
import NewLanding from './views/NewLanding';
import Dashboard from './views/Dashboard/dashboard';
import SeedlotDashboard from './views/SeedlotDashboard';

/**
* Create an app structure conaining all the routes.
Expand All @@ -41,6 +42,15 @@ const App: React.FC = () => {
)}
/>

<Route
path="/seedlot"
element={(
<ProtectedRoute signed={signed}>
<SeedlotDashboard />
</ProtectedRoute>
)}
/>

<Route
path="/form"
element={(
Expand Down
8 changes: 4 additions & 4 deletions src/components/ActivityTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';

import './styles.css';
import { hashObject } from 'react-hash-string';

import {
Table,
Expand All @@ -12,10 +11,11 @@ import {
} from '@carbon/react';
import { DataViewAlt } from '@carbon/icons-react';

import { hashObject } from 'react-hash-string';
import StatusItem from '../StatusItem';

import Activity from '../../types/Activity';
import StatusItem from '../StatusItem';

import './styles.css';

interface TableProps {
elements: Activity[];
Expand Down
2 changes: 1 addition & 1 deletion src/components/AvatarImage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import './style.css';
import emptyUser from '../../mock-data/img/EmptyUser.jpg';
import './style.css';

type Size = 'small' | 'large';

Expand Down
4 changes: 2 additions & 2 deletions src/components/BCHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ const BCHeader = () => {
<Icons.UserAvatar size={20} />
</HeaderGlobalAction>
</HeaderGlobalBar>
<HeaderPanel expanded={notifications} className="notifications-panel">
<HeaderPanel aria-label="Notifications Tab" expanded={notifications} className="notifications-panel">
<RightPanelTitle
title="Notifications"
closeFn={closeNotificationsPanel}
/>
<NotificationsCentral />
</HeaderPanel>
<HeaderPanel expanded={myProfile} className="profile-panel">
<HeaderPanel aria-label="My Profile Tab" expanded={myProfile} className="profile-panel">
<RightPanelTitle
title="My Profile"
closeFn={closeMyProfilePanel}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';

import './styles.scss';

import { Tile, OverflowMenu, OverflowMenuItem } from '@carbon/react';
import * as Icons from '@carbon/icons-react';

import './styles.scss';

interface CardProps {
icon: string;
header: string;
Expand Down
3 changes: 2 additions & 1 deletion src/components/EmptySection/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import './styles.scss';

import * as Icons from '@carbon/icons-react';

import './styles.scss';

interface EmptySectionProps {
icon: string;
title: string;
Expand Down
6 changes: 4 additions & 2 deletions src/components/FavoriteActivities/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import React from 'react';

import { Tooltip, Row, Column } from '@carbon/react';
import { Information } from '@carbon/icons-react';

import Card from '../Card';
import EmptySection from '../EmptySection';

import CardType from '../../types/Card';
import './styles.scss';
import FavoriteActivitiesCardItems from '../../mock-data/FavoriteActivitiesCardItems';
import EmptySection from '../EmptySection';

import './styles.scss';

const FavoriteActivities = () => {
const [cards, setCards] = React.useState<CardType[]>(FavoriteActivitiesCardItems);
Expand Down
34 changes: 34 additions & 0 deletions src/components/PageTitle/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';

import {
Column,
IconButton
} from '@carbon/react';
import { Favorite } from '@carbon/icons-react';

import './styles.css';

interface PageTitleProps {
title: string;
subtitle: string;
favorite?: boolean;
}

// TODO: Toggle Favorite logic
const PageTitle = ({ title, subtitle, favorite }: PageTitleProps) => (
<Column sm={4} md={4} className="title-section">
<div className={favorite ? 'title-favorite' : ''}>
<h1>{title}</h1>
{favorite && (
<IconButton kind="ghost" label="Favorite" align="right">
<Favorite size={28} />
</IconButton>
)}
</div>
<h4>
{subtitle}
</h4>
</Column>
);

export default PageTitle;
33 changes: 33 additions & 0 deletions src/components/PageTitle/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.title-section {
padding-left: 3.5rem;
}

.title-favorite {
display: flex;
align-items: center;
}

.title-favorite button{
margin-left: 0.5rem;
padding-bottom: 0.5rem;
}

.title-favorite button svg{
margin-bottom: 0.1875rem;
}

@media only screen and (max-width: 1584px) {
.title-section {
padding-left: 3rem;
}
}

@media only screen and (max-width: 672px) {
.title-section {
padding-left: 2rem;
}

.title-section h4 {
width: 90vw;
}
}
4 changes: 2 additions & 2 deletions src/components/RecentActivities/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import {
TabPanels,
TabPanel
} from '@carbon/react';

import ActivityTable from '../ActivityTable';
import EmptySection from '../EmptySection';

import RecentActivityItems from '../../mock-data/RecentActivityItems';

import './styles.scss';
import EmptySection from '../EmptySection';

const RecentActivities = () => {
const listItems = RecentActivityItems;
Expand Down Expand Up @@ -62,7 +63,6 @@ const RecentActivities = () => {
description="Your recent requests will appear here once you generate one"
/>
</div>

)}
</TabPanel>
<TabPanel>Placeholder</TabPanel>
Expand Down
4 changes: 2 additions & 2 deletions src/components/RightPanelTitle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ interface RightPanelTitleProps {
}

const RightPanelTitle = ({ title, closeFn }: RightPanelTitleProps) => (
<div className="title-section">
<div className="right-title-section">
<h4>
{title}
</h4>
<div className="title-buttons">
<div className="right-title-buttons">
<IconButton kind="ghost" label="Settings" align="bottom">
<Settings />
</IconButton>
Expand Down
2 changes: 1 addition & 1 deletion src/components/RightPanelTitle/styles.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.title-section {
.right-title-section {
display: flex;
justify-content: space-between;
align-items: center;
Expand Down
6 changes: 6 additions & 0 deletions src/layout/PublicLayout/styles.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@use '../../theme/variables.scss' as vars;

.mainContainer {
overflow-x: hidden;
padding-top: 5.625rem;
padding-left: 16rem;
}
Expand All @@ -9,6 +10,11 @@
max-width: none;
}

.page-content h1,
.page-content h3 {
padding-bottom: 0.5rem;
}

@media only screen and (max-width: 1056px) {
.mainContainer {
padding-top: 5rem;
Expand Down
2 changes: 1 addition & 1 deletion src/mock-data/LeftPanelItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const LeftPanelItems = [
{
name: 'Seedlots',
icon: 'SoilMoistureField',
link: '#',
link: '/seedlot',
disabled: true
},
{
Expand Down
14 changes: 5 additions & 9 deletions src/views/Dashboard/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,22 @@ import React from 'react';

import {
FlexGrid,
Column,
Row,
Stack
} from '@carbon/react';

import PageTitle from '../../components/PageTitle';
import FavoriteActivities from '../../components/FavoriteActivities';
import RecentActivities from '../../components/RecentActivities';

import './styles.scss';

const Dashboard = () => (
<FlexGrid className="dashboard-page">
<Stack gap={7}>
<Row>
<Column sm={4} md={4} className="dashboard-title">
<h1 data-testid="home-title">Dashboard</h1>
<h4>
See your favorite and recent activities inside SPAR system
</h4>
</Column>
<PageTitle
title="Dashboard"
subtitle="See your favorite and recent activities inside SPAR system"
/>
</Row>
<FavoriteActivities />
<RecentActivities />
Expand Down
31 changes: 0 additions & 31 deletions src/views/Dashboard/styles.scss

This file was deleted.

54 changes: 54 additions & 0 deletions src/views/SeedlotDashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from 'react';
import {
FlexGrid,
Row,
Column,
Stack
} from '@carbon/react';

import PageTitle from '../../components/PageTitle';

import './styles.css';

const SeedlotDashboard = () => (
<FlexGrid className="seedlot-page">
<Stack gap={7}>
<Row>
<PageTitle
title="Seedlots"
subtitle="Register and manage your seedlots"
favorite
/>
</Row>
<Row className="seedlot-dashboard-content">
<Column sm={4} md={4} lg={4}>
<span>
Card Placeholder
</span>
</Column>
<Column sm={4} md={4} lg={4}>
<span>
Card Placeholder
</span>
</Column>
<Column sm={4} md={4} lg={4}>
<span>
Card Placeholder
</span>
</Column>
<Column sm={4} md={4} lg={4}>
<span>
Card Placeholder
</span>
</Column>
</Row>
<Row className="seedlot-dashboard-content">
<Column>
Exisisting Seedlot Placeholder
</Column>
</Row>
</Stack>
</FlexGrid>
);

export default SeedlotDashboard;
15 changes: 15 additions & 0 deletions src/views/SeedlotDashboard/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.seedlot-dashboard-content {
padding-left: 2.5rem;
}

@media only screen and (max-width: 1584px) {
.seedlot-dashboard-content {
padding-left: 2rem;
}
}

@media only screen and (max-width: 672px) {
.seedlot-dashboard-content {
padding-left: 1rem;
}
}

0 comments on commit b38e772

Please sign in to comment.