diff --git a/frontend/src/components/BarChartGrouped/index.tsx b/frontend/src/components/BarChartGrouped/index.tsx index d3828147..95e63d5d 100644 --- a/frontend/src/components/BarChartGrouped/index.tsx +++ b/frontend/src/components/BarChartGrouped/index.tsx @@ -14,8 +14,8 @@ const BarChartGrouped = () => { const [windowWidth, setWindowWidth] = useState(window.innerWidth); const [chartData, setChartData] = useState([]); const [isLoading, setIsLoading] = useState(true); - const [orgUnitCode, setOrgUnitCode] = useState(''); - const [statusCode, setStatusCode] = useState(''); + const [orgUnitCode, setOrgUnitCode] = useState(null); + const [statusCode, setStatusCode] = useState(null); const [startDate, setStartDate] = useState(null); const [endDate, setEndDate] = useState(null); diff --git a/frontend/src/components/OpeningMetricsTab/index.tsx b/frontend/src/components/OpeningMetricsTab/index.tsx index f2dadc0c..1cd3c815 100644 --- a/frontend/src/components/OpeningMetricsTab/index.tsx +++ b/frontend/src/components/OpeningMetricsTab/index.tsx @@ -1,58 +1,45 @@ -import React, {useState} from "react"; -import { useSelector } from "react-redux"; -import FavouriteCard from "../FavouriteCard"; -import PageTitle from "../PageTitle"; +import React from "react"; import './styles.scss' import BarChartGrouped from "../BarChartGrouped"; import ChartContainer from "../ChartContainer"; import DonutChartView from "../DonutChartView"; import OpeningHistory from "../OpeningHistory"; import OpeningHistoryItems from "../../mock-data/OpeningHistoryItems"; -import ActionsTable from "../ActionsTable"; import MyRecentActions from "../MyRecentActions"; - -const OpeningMetricsTab: React.FC = () => { - const [showSpatial, setShowSpatial] = useState(false); - - const toggleSpatial = () => { - setShowSpatial(!showSpatial) - } - - return ( - <> -
-
-
- - - -
-
- - - -
-
- - - -
-
- - - -
- +const OpeningMetricsTab: React.FC = () => ( + <> +
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
+
- - ); -}; +
+ +); export default OpeningMetricsTab; diff --git a/frontend/src/components/OpeningScreenDataTable/index.tsx b/frontend/src/components/OpeningScreenDataTable/index.tsx index 7db4555f..283117f0 100644 --- a/frontend/src/components/OpeningScreenDataTable/index.tsx +++ b/frontend/src/components/OpeningScreenDataTable/index.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useContext, useState } from 'react'; +import React, { useCallback, useContext, useEffect, useState } from 'react'; import { DataTable, TableBatchAction, @@ -46,9 +46,6 @@ const OpeningScreenDataTable: React.FC = ({ rows, heade setInitialItemsPerPage } = useContext(PaginationContext); - setPageData(filteredRows); - setInitialItemsPerPage(5); - const handleSearchChange = (searchTerm: string) => { const filtered = rows.filter((item) => Object.values(item) @@ -65,7 +62,6 @@ const OpeningScreenDataTable: React.FC = ({ rows, heade const selectRowEvent = useCallback((openingId: string, selected: boolean) => { if (!selected) { - console.log(`Selected row id=${openingId} selected=${JSON.stringify(!selected)}`); setOpeningId(openingId); } }, []); @@ -75,8 +71,13 @@ const OpeningScreenDataTable: React.FC = ({ rows, heade // Add your logic to handle batch actions here }; + useEffect(() => { + setPageData(filteredRows); + setInitialItemsPerPage(5); + }, [filteredRows]); + return ( -
+ <> {({ rows, @@ -167,15 +168,15 @@ const OpeningScreenDataTable: React.FC = ({ rows, heade {headers.map((header, i) => ( - - {header.header} + + { header.header } ))} {rows.map((row, i) => ( - + = ({ rows, heade {/* Check if there are no elements in the table, if not then print the Empty */} {filteredRows.length <= 0 ? ( - - ) : null} + + ) : null} - {/* Check if there are no elements in the table, if not then print the Empty */} - {filteredRows.length > 0 ? ( - { - handlePageChange( page ); - handleItemsPerPageChange(page, pageSize); - }} - /> - ) : null} -
+ {/* Check if there are no elements in the table, if not then print the Empty */} + {filteredRows.length > 0 ? ( + { + handlePageChange( page ); + handleItemsPerPageChange(page, pageSize); + }} + /> + ) : null} + ); } diff --git a/frontend/src/components/OpeningsTab/index.tsx b/frontend/src/components/OpeningsTab/index.tsx index 1928940e..613f7500 100644 --- a/frontend/src/components/OpeningsTab/index.tsx +++ b/frontend/src/components/OpeningsTab/index.tsx @@ -44,59 +44,54 @@ const OpeningsTab: React.FC = ({showSpatial, setShowSpatial}) => { }, [loadId, openingPolygonNotFound]); const toggleSpatial = () => { - setShowSpatial((prevShowSpatial :boolean) => { - console.log(`prevShowSpatial=${prevShowSpatial}`); - return !prevShowSpatial - }); + setShowSpatial((prevShowSpatial :boolean) => !prevShowSpatial); } return ( <> -
-
-
- - -
- {showSpatial ? ( -
-
- -
-
- ) : null} +
+
+ +
+ {showSpatial ? ( +
+
+ +
+
+ ) : null} +
-
- {openingPolygonNotFound? ( - - ) : null } - {loading ? ( - - ) : ( - - )} -
+
+ {openingPolygonNotFound? ( + + ) : null } + {loading ? ( + + ) : ( + + )}
); diff --git a/frontend/src/services/OpeningService.ts b/frontend/src/services/OpeningService.ts index 4e1a3352..51d44f1e 100644 --- a/frontend/src/services/OpeningService.ts +++ b/frontend/src/services/OpeningService.ts @@ -58,8 +58,8 @@ export async function fetchRecentOpenings() { } interface IOpeningPerYear { - orgUnitCode: string; - statusCode: string; + orgUnitCode: string | null; + statusCode: string | null; entryDateStart: string | null; entryDateEnd: string | null; }