Skip to content

Commit

Permalink
Merge pull request #1508 from TomChapmanGov/about_page
Browse files Browse the repository at this point in the history
about page v1
  • Loading branch information
jadmsaadaot authored Dec 29, 2023
2 parents cade487 + c5ecab3 commit 4cef036
Show file tree
Hide file tree
Showing 11 changed files with 522 additions and 6 deletions.
1 change: 1 addition & 0 deletions epictrack-api/src/api/schemas/response/project_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Meta(AutoSchemaBase.Meta):
model = Project
include_fk = True
unknown = EXCLUDE
exclude = ("created_by", "updated_at", "updated_by", "is_deleted")

sub_type = fields.Nested(SubTypeSchema, dump_only=True, exclude=("type", "type_id"))
type = fields.Nested(TypeSchema, dump_only=True)
Expand Down
5 changes: 2 additions & 3 deletions epictrack-api/src/api/schemas/response/work_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ class Meta(AutoSchemaBase.Meta):
model = Work
include_fk = True
unknown = EXCLUDE
exclude = ("created_by", "updated_at", "updated_by", "is_deleted")

project = fields.Nested(
ProjectResponseSchema(exclude=("region_env", "region_flnro", "sub_type")),
dump_only=True,
)
ProjectResponseSchema(exclude=("created_by", "updated_at", "updated_by", "is_deleted")), dump_only=True)
ministry = fields.Nested(MinistrySchema, dump_only=True)
eao_team = fields.Nested(EAOTeamSchema, dump_only=True)
ea_act = fields.Nested(EAActSchema, dump_only=True)
Expand Down
4 changes: 3 additions & 1 deletion epictrack-web/src/components/workPlan/WorkPlanContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Issues from "./issues";
import WorkState from "./WorkState";
import ComingSoon from "../../routes/ComingSoon";
import { isStatusOutOfDate } from "./status/shared";
import About from "./about";

const IndicatorIcon: React.FC<IconProps> = Icons["IndicatorIcon"];

Expand Down Expand Up @@ -123,7 +124,8 @@ const WorkPlanContainer = () => {
...tabPanel,
}}
>
<ComingSoon />
{/* <ComingSoon /> */}
<About />
</TabPanel>
<TabPanel
index={4}
Expand Down
183 changes: 183 additions & 0 deletions epictrack-web/src/components/workPlan/about/AboutContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
import { Box, Grid } from "@mui/material";
import React, { useContext } from "react";
import { ETHeading3, ETLink, ETParagraph } from "../../shared";
import { tabPanelStyle, tabStyle, titleStyle } from "../common/styles";
import { Palette } from "../../../styles/theme";
import { ETTabs, ETTab } from "../../shared/tab/Tab";
import TabPanel from "../../shared/tab/TabPanel";
import ComingSoon from "../../../routes/ComingSoon";
import AboutDetails from "./aboutDetails";
import { ABOUT_RESOURCES } from "../../../constants/application-constant";
import Icons from "../../icons";
import { IconProps } from "../../icons/type";
import { WorkplanContext } from "../WorkPlanContext";

const LinkIcon: React.FC<IconProps> = Icons["LinkIcon"];

const AboutContainer = () => {
const { work } = useContext(WorkplanContext);
const [selectedTabIndex, setSelectedTabIndex] = React.useState(0);

const handleTabSelected = (event: React.SyntheticEvent, index: number) => {
setSelectedTabIndex(index);
};

return (
<Grid container columnSpacing={1.5}>
<Grid item xs={8}>
<ETTabs
sx={{
gap: "2rem",
minHeight: "0px",
height: "100%",
}}
onChange={handleTabSelected}
value={selectedTabIndex}
>
<ETTab
sx={{
paddingLeft: 0,
...tabStyle,
}}
label="Details"
/>
<ETTab
label="Calender"
sx={{
...tabStyle,
}}
/>
</ETTabs>
</Grid>
<Grid item xs={4}>
<ETHeading3
sx={{
...titleStyle,
}}
color={Palette.primary.main}
>
Resources
</ETHeading3>
</Grid>
<Grid
item
xs={8}
sx={{
pt: "2rem",
}}
>
<TabPanel
index={0}
value={selectedTabIndex}
sx={{
...tabPanelStyle,
}}
>
<AboutDetails />
</TabPanel>
<TabPanel
index={1}
value={selectedTabIndex}
sx={{
...tabPanelStyle,
}}
>
<ComingSoon />
</TabPanel>
</Grid>
<Grid
item
xs={4}
sx={{
pt: "2rem",
}}
>
<Box
sx={{
...tabPanelStyle,
display: "flex",
flexDirection: "column",
gap: "1rem",
}}
>
<Box
sx={{
display: "flex",
padding: "1rem 1.5rem",
flexDirection: "column",
alignItems: "flex-start",
gap: ".5rem",
alignSelf: "stretch",
borderRadius: "4px",
backgroundColor: Palette.neutral.bg.light,
}}
>
<Box
sx={{
display: "flex",
gap: ".5rem",
alignItems: "center",
}}
>
<LinkIcon fill={`${Palette.primary.accent.main}`} />
<ETLink
to={`https://projects.eao.gov.bc.ca/projects-list?keywords=${work?.project?.name}`}
target="_blank"
rel="noopener"
style={{
fontSize: "1rem",
fontWeight: 700,
lineHeight: "1.5rem",
}}
>
Link to EPIC.Public
</ETLink>
</Box>
</Box>
{ABOUT_RESOURCES.map((resource) => {
return (
<>
<Box
sx={{
display: "flex",
padding: "1rem 1.5rem",
flexDirection: "column",
alignItems: "flex-start",
gap: ".5rem",
alignSelf: "stretch",
borderRadius: "4px",
backgroundColor: Palette.neutral.bg.light,
}}
>
<Box
sx={{
display: "flex",
gap: ".5rem",
alignItems: "center",
}}
>
<LinkIcon fill={`${Palette.primary.accent.main}`} />
<ETLink
to={`${resource.url}`}
target="_blank"
rel="noopener"
style={{
fontSize: "1rem",
fontWeight: 700,
lineHeight: "1.5rem",
}}
>
{resource.title}
</ETLink>
</Box>
</Box>
</>
);
})}
</Box>
</Grid>
</Grid>
);
};

export default AboutContainer;
23 changes: 23 additions & 0 deletions epictrack-web/src/components/workPlan/about/AboutContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { createContext } from "react";
import React from "react";
import { useSearchParams } from "../../../hooks/SearchParams";

// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface AboutContextProps {}

interface StatusContainerRouteParams extends URLSearchParams {
work_id: string;
}

export const AboutContext = createContext<AboutContextProps>({});

export const AboutProvider = ({
children,
}: {
children: JSX.Element | JSX.Element[];
}) => {
const query = useSearchParams<StatusContainerRouteParams>();
const workId = React.useMemo(() => query.get("work_id"), [query]);

return <AboutContext.Provider value={{}}>{children}</AboutContext.Provider>;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import { Box, Divider, Grid } from "@mui/material";
import { useContext } from "react";
import { WorkplanContext } from "../../WorkPlanContext";
import { ETCaption1, ETCaption2, GrayBox } from "../../../shared";
import { Palette } from "../../../../styles/theme";
import { MONTH_DAY_YEAR } from "../../../../constants/application-constant";
import dayjs from "dayjs";

const ProjectDetails = () => {
const { work } = useContext(WorkplanContext);
return (
<GrayBox>
<Grid
container
sx={{
padding: "16px 24px",
}}
>
<Grid item xs={12}>
<ETCaption1 color={Palette.neutral.main}>
PROJECT CREATION DATE
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETCaption2 color={Palette.neutral.dark}>
{dayjs(work?.project?.created_at).format(MONTH_DAY_YEAR)}
</ETCaption2>
</Grid>
</Grid>
<Divider style={{ width: "100%" }} />
<Grid
container
spacing={1}
sx={{
padding: "16px 24px",
}}
>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
PROPONENT
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETCaption2 color={Palette.neutral.dark}>
{work?.project?.proponent?.name}
</ETCaption2>
</Grid>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
PROJECT DESCRIPTION
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETCaption2 color={Palette.neutral.dark}>
{work?.project?.description}
</ETCaption2>
</Grid>
<Grid item xs={6}>
<ETCaption1 bold color={Palette.primary.main}>
TYPE
</ETCaption1>
</Grid>
<Grid item xs={6}>
<ETCaption1 bold color={Palette.primary.main}>
SUBTYPE
</ETCaption1>
</Grid>
<Grid item xs={6}>
<ETCaption1 color={Palette.neutral.dark}>
{work?.project?.type?.name}
</ETCaption1>
</Grid>
<Grid item xs={6}>
<ETCaption1 color={Palette.neutral.dark}>
{work?.project?.sub_type?.name}
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
LOCATION DESCRIPTION
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETCaption2 color={Palette.neutral.dark}>
{work?.project?.address}
</ETCaption2>
</Grid>
<Grid item xs={6}>
<ETCaption1 bold color={Palette.primary.main}>
ENV REGION
</ETCaption1>
</Grid>
<Grid item xs={6}>
<ETCaption1 bold color={Palette.primary.main}>
NRS REGION
</ETCaption1>
</Grid>
<Grid item xs={6}>
<ETCaption1 color={Palette.neutral.dark}>
{work?.project?.region_env?.name}
</ETCaption1>
</Grid>
<Grid item xs={6}>
<ETCaption1 color={Palette.neutral.dark}>
{work?.project?.region_flnro?.name}
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETCaption1 bold color={Palette.primary.main}>
ABBREVIATION
</ETCaption1>
</Grid>
<Grid item xs={12}>
<ETCaption1 color={Palette.neutral.dark}>
{work?.project?.abbreviation}
</ETCaption1>
</Grid>
</Grid>
</GrayBox>
);
};

export default ProjectDetails;
Loading

0 comments on commit 4cef036

Please sign in to comment.