From db04720c6f2a13e16349ce93d857977a54a0520c Mon Sep 17 00:00:00 2001 From: jazzgrewal Date: Thu, 23 May 2024 15:07:51 -0700 Subject: [PATCH 01/19] fixed padding and color around the cards, and tabs --- frontend/src/screens/Opening/Opening.scss | 7 +++++-- frontend/src/screens/Opening/index.tsx | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/screens/Opening/Opening.scss b/frontend/src/screens/Opening/Opening.scss index af635221..04d0bf55 100644 --- a/frontend/src/screens/Opening/Opening.scss +++ b/frontend/src/screens/Opening/Opening.scss @@ -11,8 +11,8 @@ } .favourite-activities { - background-color: var(--#{vars.$bcgov-prefix}-layer-01); - padding: 2rem; + background-color: var(--#{vars.$bcgov-prefix}-background) !important; + padding-top: 0px !important; } .tab-content { @@ -23,6 +23,9 @@ min-width: 251px; margin-left: 40px; } + .tab-list{ + margin-left: 40px; + } @media only screen and (max-width: 671px) { .favourite-activities { diff --git a/frontend/src/screens/Opening/index.tsx b/frontend/src/screens/Opening/index.tsx index 6a3ad70b..3c075854 100644 --- a/frontend/src/screens/Opening/index.tsx +++ b/frontend/src/screens/Opening/index.tsx @@ -30,7 +30,7 @@ const Opening: React.FC = () => { {!showSpatial && (
-
+
@@ -48,7 +48,7 @@ const Opening: React.FC = () => { )} - +
Recent Openings
Dashboard
From c14317a4135cde2862d76a42ddb80c2427c1e224 Mon Sep 17 00:00:00 2001 From: jazzgrewal Date: Thu, 23 May 2024 15:14:07 -0700 Subject: [PATCH 02/19] changed the icon to location --- frontend/src/components/OpeningsTab/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/OpeningsTab/index.tsx b/frontend/src/components/OpeningsTab/index.tsx index 2f8e0728..76e439bb 100644 --- a/frontend/src/components/OpeningsTab/index.tsx +++ b/frontend/src/components/OpeningsTab/index.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from "react"; import { Button } from "@carbon/react"; import './styles.scss' -import { ViewFilled } from '@carbon/icons-react'; +import { Location } from '@carbon/icons-react'; import OpeningsMap from "../OpeningsMap"; import OpeningScreenDataTable from "../OpeningScreenDataTable/index"; import { headers } from "../OpeningScreenDataTable/testData"; @@ -58,7 +58,7 @@ const OpeningsTab: React.FC = ({showSpatial, setShowSpatial}) => {
@@ -205,20 +207,24 @@ export default function OpeningScreenDataTable({ rows, headers, error, setOpenin tooltipPosition="bottom" kind="ghost" onClick={() => clickViewAction(row.id)} - renderIcon={Icons.DataViewAlt} + renderIcon={Icons.View} size="md" />
diff --git a/frontend/src/screens/Opening/Opening.scss b/frontend/src/screens/Opening/Opening.scss index 04d0bf55..66f27b08 100644 --- a/frontend/src/screens/Opening/Opening.scss +++ b/frontend/src/screens/Opening/Opening.scss @@ -20,8 +20,8 @@ } .tab-header{ @include type.type-style('heading-01'); - min-width: 251px; - margin-left: 40px; + width: 251px; + padding-left: 40px; } .tab-list{ margin-left: 40px; From eda11f396af6002a7fd95a34c96a73d23dcd1b5f Mon Sep 17 00:00:00 2001 From: jazzgrewal Date: Thu, 20 Jun 2024 14:49:47 -0700 Subject: [PATCH 16/19] added the subitle in the metrics tab --- frontend/src/components/OpeningMetricsTab/index.tsx | 8 ++++++-- frontend/src/components/OpeningMetricsTab/styles.scss | 8 ++++++++ frontend/src/components/SectionTitle/index.tsx | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/OpeningMetricsTab/index.tsx b/frontend/src/components/OpeningMetricsTab/index.tsx index 5a428c5d..5fd8e1d3 100644 --- a/frontend/src/components/OpeningMetricsTab/index.tsx +++ b/frontend/src/components/OpeningMetricsTab/index.tsx @@ -1,5 +1,6 @@ import React from "react"; -import './styles.scss' +import './styles.scss'; +import SectionTitle from "../SectionTitle"; import BarChartGrouped from "../BarChartGrouped"; import ChartContainer from "../ChartContainer"; import DonutChartView from "../DonutChartView"; @@ -9,7 +10,10 @@ import MyRecentActions from "../MyRecentActions"; const OpeningMetricsTab: React.FC = () => ( <> -
+
+
+ +
+

{title}

From eeed3a0afe288bfa7da75c3998a2377ca761aa62 Mon Sep 17 00:00:00 2001 From: jazzgrewal Date: Wed, 26 Jun 2024 15:31:18 -0700 Subject: [PATCH 17/19] fixed the action table --- .../src/components/ActionsTable/index.tsx | 68 ++++++++++--------- .../components/MyRecentActions/filesData.ts | 4 +- .../src/components/MyRecentActions/index.tsx | 4 +- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/frontend/src/components/ActionsTable/index.tsx b/frontend/src/components/ActionsTable/index.tsx index d63e2393..8387b105 100644 --- a/frontend/src/components/ActionsTable/index.tsx +++ b/frontend/src/components/ActionsTable/index.tsx @@ -13,63 +13,67 @@ interface IActionsTable { const ActionsTable: React.FC = ({ rows, headers }) => { const getTypeEnum = (typeStr: string): ActivityTagTypeEnum => { - if (typeStr === ActivityTagTypeEnum.OPENING_DETAILS) { - return ActivityTagTypeEnum.OPENING_DETAILS; - } else if (typeStr === ActivityTagTypeEnum.OPENING_REPORT) { - return ActivityTagTypeEnum.OPENING_REPORT; - } else if (typeStr === ActivityTagTypeEnum.OPENING_SPATIAL) { - return ActivityTagTypeEnum.OPENING_SPATIAL; - } else if (typeStr === ActivityTagTypeEnum.UPDATE) { - return ActivityTagTypeEnum.UPDATE; - } else { - return ActivityTagTypeEnum.UNKNOWN; + switch (typeStr) { + case ActivityTagTypeEnum.OPENING_DETAILS: + return ActivityTagTypeEnum.OPENING_DETAILS; + case ActivityTagTypeEnum.OPENING_REPORT: + return ActivityTagTypeEnum.OPENING_REPORT; + case ActivityTagTypeEnum.OPENING_SPATIAL: + return ActivityTagTypeEnum.OPENING_SPATIAL; + case ActivityTagTypeEnum.UPDATE: + return ActivityTagTypeEnum.UPDATE; + default: + return ActivityTagTypeEnum.UNKNOWN; } }; const getFileFormatEnum = (formatStr: string): ActivityTagFileFormatEnum => { - if (formatStr === ActivityTagFileFormatEnum.PDF_FILE) { - return ActivityTagFileFormatEnum.PDF_FILE; - } else if (formatStr === ActivityTagFileFormatEnum.CSV_FILE) { - return ActivityTagFileFormatEnum.CSV_FILE; - } else if (formatStr === ActivityTagFileFormatEnum.EXCEL_FILE) { - return ActivityTagFileFormatEnum.EXCEL_FILE; - } else { - return ActivityTagFileFormatEnum.UNKNOWN; + switch (formatStr) { + case ActivityTagFileFormatEnum.PDF_FILE: + return ActivityTagFileFormatEnum.PDF_FILE; + case ActivityTagFileFormatEnum.CSV_FILE: + return ActivityTagFileFormatEnum.CSV_FILE; + case ActivityTagFileFormatEnum.EXCEL_FILE: + return ActivityTagFileFormatEnum.EXCEL_FILE; + default: + return ActivityTagFileFormatEnum.UNKNOWN; } }; + const headerKeys = headers.map(header => header.key); + return ( - {headers.map(header => + {headers.map(header => ( + {header.header} - )} + + ))} - {rows.map((row: RecentAction, idx: number) => + {rows.map((row: RecentAction, idx: number) => ( - { Object.keys(row).filter((rowKey: string) => rowKey !== 'id').map((key: string) => { - return ( + {headerKeys.map((key: string) => ( {key === "statusCode" ? ( - ): - key === "activityType" && !row["fileFormat"] ? ( + ) : key === "activityType" && !row["fileFormat"] ? ( - ): - key === "activityType" && row["fileFormat"] ? ( + ) : key === "activityType" && row["fileFormat"] ? ( - ): - row[key]} + ) : ( + row[key] + )} - ); - })} - )} + ))} + + ))}
); diff --git a/frontend/src/components/MyRecentActions/filesData.ts b/frontend/src/components/MyRecentActions/filesData.ts index 05fcb33e..88101ea2 100644 --- a/frontend/src/components/MyRecentActions/filesData.ts +++ b/frontend/src/components/MyRecentActions/filesData.ts @@ -59,11 +59,11 @@ export const headers: ITableHeader[] = [ header: 'File Format' }, { - key: 'status', + key: 'statusCode', header: 'Status' }, { - key: 'lastUpdated', + key: 'lastUpdatedLabel', header: 'Last Updated' } ]; diff --git a/frontend/src/components/MyRecentActions/index.tsx b/frontend/src/components/MyRecentActions/index.tsx index f411a37f..f37511c2 100644 --- a/frontend/src/components/MyRecentActions/index.tsx +++ b/frontend/src/components/MyRecentActions/index.tsx @@ -20,11 +20,11 @@ const MyRecentActions: React.FC = () => { header: 'Opening ID', }, { - key: 'status', + key: 'statusCode', header: 'Status', }, { - key: 'lastUpdated', + key: 'lastUpdatedLabel', header: 'Last Updated', } ]; From 13fccd4b1b5df3e449599611f8ecc4e11a7ec9bb Mon Sep 17 00:00:00 2001 From: jazzgrewal Date: Wed, 26 Jun 2024 15:53:57 -0700 Subject: [PATCH 18/19] fixed build error --- frontend/src/services/OpeningService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/services/OpeningService.ts b/frontend/src/services/OpeningService.ts index 00e2cbc6..02b19d34 100644 --- a/frontend/src/services/OpeningService.ts +++ b/frontend/src/services/OpeningService.ts @@ -34,8 +34,8 @@ export async function fetchRecentOpenings(): Promise { timberMark: opening.timberMark ? opening.timberMark : '-', cutBlock: opening.cutBlock ? opening.cutBlock : '-', grossAreaHa: opening.grossAreaHa ? opening.grossAreaHa.toString() : '-', - status: opening.status ? opening.status.description : '-', - category: opening.category ? opening.category.code : '-', + status: opening.statusDesc ? opening.statusDesc : '-', + category: opening.categoryDesc ? opening.categoryDesc : '-', disturbanceStart: opening.disturbanceStart ? opening.disturbanceStart : '-', entryTimestamp: opening.entryTimestamp ? opening.entryTimestamp.split('T')[0] : '-', updateTimestamp: opening.updateTimestamp ? opening.updateTimestamp.split('T')[0] : '-' From 4ceab66400c0da26484a751fe7b3bc07e75285a6 Mon Sep 17 00:00:00 2001 From: Ricardo Campos Date: Thu, 4 Jul 2024 14:49:07 -0300 Subject: [PATCH 19/19] test: fix test cases --- .../OpeningScreenDataTable.test.tsx | 2 +- frontend/src/components/BCHeader/index.tsx | 4 +-- .../src/components/MyRecentActions/index.tsx | 18 +++++++++++-- .../OpeningScreenDataTable/index.tsx | 6 +---- frontend/src/services/OpeningService.ts | 25 ++++++++++++++++--- 5 files changed, 42 insertions(+), 13 deletions(-) diff --git a/frontend/src/__test__/components/OpeningScreenDataTable.test.tsx b/frontend/src/__test__/components/OpeningScreenDataTable.test.tsx index 8df8e766..92a12b46 100644 --- a/frontend/src/__test__/components/OpeningScreenDataTable.test.tsx +++ b/frontend/src/__test__/components/OpeningScreenDataTable.test.tsx @@ -13,7 +13,7 @@ const rows: RecentOpening[] = [{ cutBlock: '1', grossAreaHa: 1, statusDesc: 'Approved', - categoryDesc: 'Another', + categoryDesc: 'Another:Another', disturbanceStart: '1', entryTimestamp: '1', updateTimestamp: '1', diff --git a/frontend/src/components/BCHeader/index.tsx b/frontend/src/components/BCHeader/index.tsx index 9afea40b..d63a596b 100644 --- a/frontend/src/components/BCHeader/index.tsx +++ b/frontend/src/components/BCHeader/index.tsx @@ -30,8 +30,8 @@ const BCHeader: React.FC = () => { (
+ className="spar-header" + data-testid="bc-header__header"> {
-
Recent
-
Files and Docs
+ +
+ Recent +
+
+ +
+ Files and Docs +
+
diff --git a/frontend/src/components/OpeningScreenDataTable/index.tsx b/frontend/src/components/OpeningScreenDataTable/index.tsx index 294d7c94..6b2a5139 100644 --- a/frontend/src/components/OpeningScreenDataTable/index.tsx +++ b/frontend/src/components/OpeningScreenDataTable/index.tsx @@ -221,11 +221,7 @@ const OpeningScreenDataTable: React.FC = ({ size="md" /> - ) - : cell.info.header === "category" ?( - cell.value.split(':')[0] - ) - : ( + ) : ( cell.value )} diff --git a/frontend/src/services/OpeningService.ts b/frontend/src/services/OpeningService.ts index 02b19d34..a69a0675 100644 --- a/frontend/src/services/OpeningService.ts +++ b/frontend/src/services/OpeningService.ts @@ -7,6 +7,25 @@ import { RecentOpening } from '../types/RecentOpening'; const backendUrl = env.VITE_BACKEND_URL; +interface statusCategory { + code: string; + description: string; +} + +interface RecentOpeningApi { + openingId: number; + fileId: string; + cuttingPermit: string | null; + timberMark: string | null; + cutBlock: string | null; + grossAreaHa: number | null; + status: statusCategory | null; + category: statusCategory | null; + disturbanceStart: string | null; + entryTimestamp: string | null; + updateTimestamp: string | null; +} + /** * Fetch recent openings data from backend. * @@ -26,7 +45,7 @@ export async function fetchRecentOpenings(): Promise { if (data.data) { // Extracting row information from the fetched data - const rows: RecentOpening[] = data.data.map((opening: RecentOpening) => ({ + const rows: RecentOpening[] = data.data.map((opening: RecentOpeningApi) => ({ id: opening.openingId.toString(), openingId: opening.openingId.toString(), fileId: opening.fileId ? opening.fileId : '-', @@ -34,8 +53,8 @@ export async function fetchRecentOpenings(): Promise { timberMark: opening.timberMark ? opening.timberMark : '-', cutBlock: opening.cutBlock ? opening.cutBlock : '-', grossAreaHa: opening.grossAreaHa ? opening.grossAreaHa.toString() : '-', - status: opening.statusDesc ? opening.statusDesc : '-', - category: opening.categoryDesc ? opening.categoryDesc : '-', + status: opening.status && opening.status.description? opening.status.description : '-', + category: opening.category && opening.category.description? opening.category.description : '-', disturbanceStart: opening.disturbanceStart ? opening.disturbanceStart : '-', entryTimestamp: opening.entryTimestamp ? opening.entryTimestamp.split('T')[0] : '-', updateTimestamp: opening.updateTimestamp ? opening.updateTimestamp.split('T')[0] : '-'