Skip to content

Commit

Permalink
Merge pull request #29 from jadmsaadaot/SUBMIT-task#236
Browse files Browse the repository at this point in the history
Add project details page
  • Loading branch information
djnunez-aot authored Aug 14, 2024
2 parents e17aadf + e138684 commit fb913c2
Show file tree
Hide file tree
Showing 17 changed files with 406 additions and 101 deletions.
23 changes: 19 additions & 4 deletions submit-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion submit-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
"@tanstack/router-devtools": "^1.45.7",
"@tanstack/router-plugin": "^1.45.7",
"axios": "^1.7.2",
"epic.theme": "^1.0.4",
"epic.theme": "^1.0.6",
"keycloak-js": "^25.0.1",
"oidc-client-ts": "^3.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.52.1",
"react-if": "^4.1.5",
"react-oidc-context": "^3.1.0",
"yup": "^1.4.0",
"zustand": "^4.5.4"
Expand Down
7 changes: 7 additions & 0 deletions submit-web/src/components/Shared/Typographies.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { styled, Typography } from "@mui/material";

export const Caption2 = styled(Typography)<{ bold?: boolean }>(({ bold }) => ({
fontSize: 14,
lineHeight: "16px",
fontWeight: bold ? 700 : 400,
}));
24 changes: 24 additions & 0 deletions submit-web/src/components/registration/Banner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { theme } from "@/styles/theme";
import { Box, Typography } from "@mui/material";
import React from "react";

type BannerProps = {
children?: React.ReactNode;
};
export const Banner = ({ children }: BannerProps) => {
return (
<Box
position="relative"
bgcolor="#F0F8FF"
zIndex={theme.zIndex.appBar - 10}
height={76}
display={"flex"}
alignItems={"center"}
px={9.5}
>
<Typography variant="h3" color="initial" fontWeight={600}>
{children}
</Typography>
</Box>
);
};
22 changes: 22 additions & 0 deletions submit-web/src/components/registration/GridContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Grid, GridProps } from "@mui/material";
import { YellowBar } from "../Shared/YellowBar";

export const GridContainer = ({ children, ...rest }: GridProps) => {
return (
<Grid
container
direction="row"
justifyContent="flex-start"
alignItems="flex-start"
px={9.5}
py={7}
spacing={0}
{...rest}
>
<Grid item xs={12}>
<YellowBar />
</Grid>
{children}
</Grid>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { Box, Paper, Typography } from "@mui/material";
import { styled } from "@mui/system";
import { BCDesignTokens } from "epic.theme";
import { ProjectStatus } from "../ProjectStatus";
import { PROJECT_STATUS } from "./constants";

const CARD_HEIGHT = 301;
const CARD_WIDTH = 380;
const HEADER_HEIGHT = 54;
const BODY_HEIGHT = 247;

const CardInnerBox = styled(Box)({
display: "flex",
alignItems: "flex-start",
justifyContent: "center",
flexDirection: "column",
height: "100%",
padding: "0 12px",
});

export const ManagementPlan = () => {
return (
<Paper
sx={{
width: CARD_WIDTH,
height: CARD_HEIGHT,
border: `4px solid ${BCDesignTokens.themeGold100}`,
borderRadius: "6px",
}}
>
<Box
bgcolor={BCDesignTokens.surfaceColorPrimaryButtonDefault}
sx={{
display: "flex",
alignItems: "center",
justifyContent: "flex-start",
borderRadius: "3px 3px 0 0",
}}
height={HEADER_HEIGHT}
>
<Typography
variant="h5"
fontWeight={600}
px={2}
color={BCDesignTokens.typographyColorPrimaryInvert}
>
Project Name
</Typography>
</Box>
<Box height={BODY_HEIGHT}>
<Box
sx={{
padding: "36px 12px 12px 12px",
}}
>
<Box
sx={{
borderRadius: "3px",
border: `1px solid #F2F2F2`,
boxShadow: "0px 1px 2px rgba(0, 0, 0, 0.1)",
}}
height={187}
>
<Box height={"50%"}>
<CardInnerBox>
<Typography variant="h4" fontWeight={400}>
Management Plans
</Typography>
<ProjectStatus status={PROJECT_STATUS.POST_DECISION} />
</CardInnerBox>
</Box>
<Box height={"50%"}>
<CardInnerBox
sx={{
borderTop: `1px solid #F2F2F2`,
}}
>
<Typography variant="body1">
You will be able to submit Managements Plans for this Project.
</Typography>
</CardInnerBox>
</Box>
</Box>
</Box>
</Box>
</Paper>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const PROJECT_STATUS = {
POST_DECISION: "Post Decision",
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Case, Switch } from "react-if";
import { ManagementPlan } from "./ManagementPlan";
import { PROJECT_STATUS } from "./constants";

type ProjectCardProps = {
status: string;
};
export const ProjectCard = ({ status }: ProjectCardProps) => {
return (
<Switch>
<Case condition={status === PROJECT_STATUS.POST_DECISION}>
<ManagementPlan />
</Case>
</Switch>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Caption2 } from "@/components/Shared/Typographies";
import { Case, Default, Switch } from "react-if";
import ModeStandbyIcon from "@mui/icons-material/ModeStandby";
import { Stack } from "@mui/material";
import { PROJECT_STATUS } from "./ProjectCard/constants";

type ProjectStatusProps = {
status: string;
};
export const ProjectStatus = ({ status }: ProjectStatusProps) => {
return (
<Switch>
<Case condition={status === PROJECT_STATUS.POST_DECISION}>
<Stack
spacing={1}
direction="row"
alignItems={"center"}
color={"#947BB6"}
>
<ModeStandbyIcon />
<Caption2 color={"#947BB6"}>Post-Decision</Caption2>
</Stack>
</Case>
<Default>
<Caption2>{status}</Caption2>
</Default>
</Switch>
);
};
62 changes: 41 additions & 21 deletions submit-web/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ import { Route as IndexImport } from './routes/index'
import { Route as AuthenticatedAdminLoginImport } from './routes/_authenticated/admin-login'
import { Route as AuthenticatedDashboardImport } from './routes/_authenticated/_dashboard'
import { Route as AuthenticatedRegistrationCreateAccountImport } from './routes/_authenticated/registration/create-account'
import { Route as AuthenticatedRegistrationCompleteImport } from './routes/_authenticated/registration/complete'
import { Route as AuthenticatedRegistrationAddProjectsImport } from './routes/_authenticated/registration/add-projects'
import { Route as AuthenticatedDashboardProfileImport } from './routes/_authenticated/_dashboard/profile'
import { Route as AuthenticatedDashboardUsersIndexImport } from './routes/_authenticated/_dashboard/users/index'
import { Route as AuthenticatedDashboardProjectsIndexImport } from './routes/_authenticated/_dashboard/projects/index'
import { Route as AuthenticatedDashboardEaoPlansIndexImport } from './routes/_authenticated/_dashboard/eao-plans/index'
import { Route as AuthenticatedDashboardEaoPlansPlanIdImport } from './routes/_authenticated/_dashboard/eao-plans/$planId'
import { Route as AuthenticatedRegistrationAccountAccountIdProjectsImport } from './routes/_authenticated/registration/account/$accountId/projects'

// Create Virtual Routes

Expand Down Expand Up @@ -94,6 +95,18 @@ const AuthenticatedRegistrationCreateAccountRoute =
getParentRoute: () => AuthenticatedRoute,
} as any)

const AuthenticatedRegistrationCompleteRoute =
AuthenticatedRegistrationCompleteImport.update({
path: '/registration/complete',
getParentRoute: () => AuthenticatedRoute,
} as any)

const AuthenticatedRegistrationAddProjectsRoute =
AuthenticatedRegistrationAddProjectsImport.update({
path: '/registration/add-projects',
getParentRoute: () => AuthenticatedRoute,
} as any)

const AuthenticatedDashboardProfileRoute =
AuthenticatedDashboardProfileImport.update({
path: '/profile',
Expand Down Expand Up @@ -124,12 +137,6 @@ const AuthenticatedDashboardEaoPlansPlanIdRoute =
getParentRoute: () => AuthenticatedDashboardRoute,
} as any)

const AuthenticatedRegistrationAccountAccountIdProjectsRoute =
AuthenticatedRegistrationAccountAccountIdProjectsImport.update({
path: '/registration/account/$accountId/projects',
getParentRoute: () => AuthenticatedRoute,
} as any)

// Populate the FileRoutesByPath interface

declare module '@tanstack/react-router' {
Expand Down Expand Up @@ -183,6 +190,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedDashboardProfileImport
parentRoute: typeof AuthenticatedDashboardImport
}
'/_authenticated/registration/add-projects': {
id: '/_authenticated/registration/add-projects'
path: '/registration/add-projects'
fullPath: '/registration/add-projects'
preLoaderRoute: typeof AuthenticatedRegistrationAddProjectsImport
parentRoute: typeof AuthenticatedImport
}
'/_authenticated/registration/complete': {
id: '/_authenticated/registration/complete'
path: '/registration/complete'
fullPath: '/registration/complete'
preLoaderRoute: typeof AuthenticatedRegistrationCompleteImport
parentRoute: typeof AuthenticatedImport
}
'/_authenticated/registration/create-account': {
id: '/_authenticated/registration/create-account'
path: '/registration/create-account'
Expand Down Expand Up @@ -232,13 +253,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedDashboardUsersIndexImport
parentRoute: typeof AuthenticatedDashboardImport
}
'/_authenticated/registration/account/$accountId/projects': {
id: '/_authenticated/registration/account/$accountId/projects'
path: '/registration/account/$accountId/projects'
fullPath: '/registration/account/$accountId/projects'
preLoaderRoute: typeof AuthenticatedRegistrationAccountAccountIdProjectsImport
parentRoute: typeof AuthenticatedImport
}
}
}

Expand All @@ -257,8 +271,9 @@ export const routeTree = rootRoute.addChildren({
AuthenticatedDashboardUsersIndexRoute,
}),
AuthenticatedAdminLoginRoute,
AuthenticatedRegistrationAddProjectsRoute,
AuthenticatedRegistrationCompleteRoute,
AuthenticatedRegistrationCreateAccountRoute,
AuthenticatedRegistrationAccountAccountIdProjectsRoute,
}),
ErrorRoute,
OidcCallbackRoute,
Expand Down Expand Up @@ -286,8 +301,9 @@ export const routeTree = rootRoute.addChildren({
"children": [
"/_authenticated/_dashboard",
"/_authenticated/admin-login",
"/_authenticated/registration/create-account",
"/_authenticated/registration/account/$accountId/projects"
"/_authenticated/registration/add-projects",
"/_authenticated/registration/complete",
"/_authenticated/registration/create-account"
]
},
"/error": {
Expand Down Expand Up @@ -317,6 +333,14 @@ export const routeTree = rootRoute.addChildren({
"filePath": "_authenticated/_dashboard/profile.tsx",
"parent": "/_authenticated/_dashboard"
},
"/_authenticated/registration/add-projects": {
"filePath": "_authenticated/registration/add-projects.tsx",
"parent": "/_authenticated"
},
"/_authenticated/registration/complete": {
"filePath": "_authenticated/registration/complete.tsx",
"parent": "/_authenticated"
},
"/_authenticated/registration/create-account": {
"filePath": "_authenticated/registration/create-account.tsx",
"parent": "/_authenticated"
Expand Down Expand Up @@ -344,10 +368,6 @@ export const routeTree = rootRoute.addChildren({
"/_authenticated/_dashboard/users/": {
"filePath": "_authenticated/_dashboard/users/index.tsx",
"parent": "/_authenticated/_dashboard"
},
"/_authenticated/registration/account/$accountId/projects": {
"filePath": "_authenticated/registration/account/$accountId/projects.tsx",
"parent": "/_authenticated"
}
}
}
Expand Down
Loading

0 comments on commit fb913c2

Please sign in to comment.