From 885db5b2416ef70d5972a2af81e78dba1f29e589 Mon Sep 17 00:00:00 2001 From: fdelemarre Date: Wed, 3 Jul 2024 10:40:41 +0200 Subject: [PATCH] rename component to `StatisticTable` --- .../table/performance-overview-table/MedianRow.tsx | 4 ++-- .../performance-overview-table/PercentTargetMetRow.tsx | 4 ++-- .../{PerformanceOverviewTable.tsx => StatisticTable.tsx} | 7 +++---- src/webapp/pages/dashboard/DashboardPage.tsx | 6 +++--- 4 files changed, 10 insertions(+), 11 deletions(-) rename src/webapp/components/table/performance-overview-table/{PerformanceOverviewTable.tsx => StatisticTable.tsx} (96%) diff --git a/src/webapp/components/table/performance-overview-table/MedianRow.tsx b/src/webapp/components/table/performance-overview-table/MedianRow.tsx index cf6e2f5b..98d45439 100644 --- a/src/webapp/components/table/performance-overview-table/MedianRow.tsx +++ b/src/webapp/components/table/performance-overview-table/MedianRow.tsx @@ -2,7 +2,7 @@ import React from "react"; import _ from "../../../../domain/entities/generic/Collection"; import { TableCell, TableRow } from "@material-ui/core"; import styled from "styled-components"; -import { PerformanceOverviewTableProps } from "./PerformanceOverviewTable"; +import { StatisticTableProps } from "./StatisticTable"; export type TableColumn = { value: string; @@ -21,7 +21,7 @@ type MedianRowProps = { export const MedianRow: React.FC = React.memo( ({ rows, columns, calculateColumns }) => { const calculateMedian = ( - rows: PerformanceOverviewTableProps["rows"], + rows: StatisticTableProps["rows"], column: TableColumn["value"] ) => { const values = rows.map(row => Number(row[column])).filter(value => !isNaN(value)); diff --git a/src/webapp/components/table/performance-overview-table/PercentTargetMetRow.tsx b/src/webapp/components/table/performance-overview-table/PercentTargetMetRow.tsx index 062631e6..a93b7ed3 100644 --- a/src/webapp/components/table/performance-overview-table/PercentTargetMetRow.tsx +++ b/src/webapp/components/table/performance-overview-table/PercentTargetMetRow.tsx @@ -2,7 +2,7 @@ import React from "react"; import _ from "../../../../domain/entities/generic/Collection"; import { TableCell, TableRow } from "@material-ui/core"; import styled from "styled-components"; -import { PerformanceOverviewTableProps } from "./PerformanceOverviewTable"; +import { StatisticTableProps } from "./StatisticTable"; export type TableColumn = { value: string; @@ -24,7 +24,7 @@ type PercentTargetMetRowProps = { export const PercentTargetMetRow: React.FC = React.memo( ({ rows, columns, columnRules, calculateColumns }) => { const calculatePercentTargetMet = ( - rows: PerformanceOverviewTableProps["rows"], + rows: StatisticTableProps["rows"], column: TableColumn["value"], target: number ) => { diff --git a/src/webapp/components/table/performance-overview-table/PerformanceOverviewTable.tsx b/src/webapp/components/table/performance-overview-table/StatisticTable.tsx similarity index 96% rename from src/webapp/components/table/performance-overview-table/PerformanceOverviewTable.tsx rename to src/webapp/components/table/performance-overview-table/StatisticTable.tsx index 574e5f60..a4146cc2 100644 --- a/src/webapp/components/table/performance-overview-table/PerformanceOverviewTable.tsx +++ b/src/webapp/components/table/performance-overview-table/StatisticTable.tsx @@ -22,7 +22,7 @@ export type TableColumn = { dark?: boolean; }; -export type PerformanceOverviewTableProps = { +export type StatisticTableProps = { columns: TableColumn[]; columnRules: { [key: TableColumn["value"]]: number; @@ -33,11 +33,10 @@ export type PerformanceOverviewTableProps = { }[]; }; -export const PerformanceOverviewTable: React.FC = React.memo( +export const StatisticTable: React.FC = React.memo( ({ rows, columns, columnRules, editRiskAssessmentColumns }) => { const [searchTerm, setSearchTerm] = useState(""); const [filterValue, setFilterValue] = useState(""); - // const [filteredRows, setFilteredRows] = useState(rows); const calculateColumns = [...editRiskAssessmentColumns, ...Object.keys(columnRules)]; @@ -131,7 +130,7 @@ export const PerformanceOverviewTable: React.FC = } ); -const useTableSearch = (rows: PerformanceOverviewTableProps["rows"], searchTerm: string) => { +const useTableSearch = (rows: StatisticTableProps["rows"], searchTerm: string) => { return useMemo(() => { if (searchTerm === "") { return rows; diff --git a/src/webapp/pages/dashboard/DashboardPage.tsx b/src/webapp/pages/dashboard/DashboardPage.tsx index 79855f36..e5046236 100644 --- a/src/webapp/pages/dashboard/DashboardPage.tsx +++ b/src/webapp/pages/dashboard/DashboardPage.tsx @@ -4,9 +4,9 @@ import i18n from "../../../utils/i18n"; import { Layout } from "../../components/layout/Layout"; import { Section } from "../../components/section/Section"; import { - PerformanceOverviewTable, + StatisticTable, TableColumn, -} from "../../components/table/performance-overview-table/PerformanceOverviewTable"; +} from "../../components/table/performance-overview-table/StatisticTable"; export const DashboardPage: React.FC = React.memo(() => { // TODO remove harcoded data @@ -188,7 +188,7 @@ export const DashboardPage: React.FC = React.memo(() => {
7-1-7 performance content
-