diff --git a/client/src/components/ui/score-card.tsx b/client/src/components/ui/score-card.tsx index 68525997..e01f7587 100644 --- a/client/src/components/ui/score-card.tsx +++ b/client/src/components/ui/score-card.tsx @@ -3,28 +3,26 @@ import { PROJECT_SCORE } from "@shared/entities/project-score.enum"; import { cn } from "@/lib/utils"; interface ScoreIndicatorProps { + value: PROJECT_SCORE; className?: string; - children?: React.ReactNode; } -export const DEFAULT_BG_CLASSES: Record = { +const DEFAULT_BG_CLASSES: Record = { [PROJECT_SCORE.HIGH]: "bg-ramps-green", [PROJECT_SCORE.MEDIUM]: "bg-ramps-yellow", [PROJECT_SCORE.LOW]: "bg-ramps-red", }; -export const ScoreIndicator = ({ - children, - className = "", -}: ScoreIndicatorProps) => { +export const ScoreIndicator = ({ value, className }: ScoreIndicatorProps) => { return (
- {children} + {value}
); }; diff --git a/client/src/containers/overview/project-details/score-card-ratings/index.tsx b/client/src/containers/overview/project-details/score-card-ratings/index.tsx index f602c794..0956882a 100644 --- a/client/src/containers/overview/project-details/score-card-ratings/index.tsx +++ b/client/src/containers/overview/project-details/score-card-ratings/index.tsx @@ -1,12 +1,14 @@ import { FC } from "react"; import { Scorecard } from "@shared/dtos/projects/project-scorecard.dto"; +import { PROJECT_SCORE } from "@shared/entities/project-score.enum"; import { useFeatureFlags } from "@/hooks/use-feature-flags"; import CompareButton from "@/containers/overview/project-details/compare-button"; import { Label } from "@/components/ui/label"; +import { ScoreIndicator } from "@/components/ui/score-card"; import { Table, TableBody, TableCell, TableRow } from "@/components/ui/table"; const scoreCardMap = { @@ -52,7 +54,9 @@ const ScoreCardRatings: FC<{ data?: Scorecard }> = ({ data }) => { {scoreCardMap[key as keyof Scorecard]} - {value} + + + ))} diff --git a/client/src/containers/overview/table/view/overview/columns.tsx b/client/src/containers/overview/table/view/overview/columns.tsx index 4b4670d1..a99608a8 100644 --- a/client/src/containers/overview/table/view/overview/columns.tsx +++ b/client/src/containers/overview/table/view/overview/columns.tsx @@ -11,7 +11,7 @@ import { filtersSchema } from "@/app/(overview)/url-store"; import { TableStateWithMaximums } from "@/containers/overview/table/view/overview"; import SingleStackedBarChart from "@/components/ui/bar-chart/single-stacked-bar-chart"; -import { DEFAULT_BG_CLASSES, ScoreIndicator } from "@/components/ui/score-card"; +import { ScoreIndicator } from "@/components/ui/score-card"; const columnHelper = createColumnHelper< Partial & { @@ -78,11 +78,7 @@ export const columns = (filters: z.infer) => [ if (value === undefined) { return "-"; } - return ( - - {value} - - ); + return ; }, }), columnHelper.accessor( diff --git a/client/src/containers/overview/table/view/scorecard-prioritization/columns.tsx b/client/src/containers/overview/table/view/scorecard-prioritization/columns.tsx index ddf0e834..a0657496 100644 --- a/client/src/containers/overview/table/view/scorecard-prioritization/columns.tsx +++ b/client/src/containers/overview/table/view/scorecard-prioritization/columns.tsx @@ -2,9 +2,7 @@ import { PROJECT_SCORE } from "@shared/entities/project-score.enum"; import { ProjectScorecardView } from "@shared/entities/project-scorecard.view"; import { createColumnHelper } from "@tanstack/react-table"; -import { cn } from "@/lib/utils"; - -import { ScoreIndicator, DEFAULT_BG_CLASSES } from "@/components/ui/score-card"; +import { ScoreIndicator } from "@/components/ui/score-card"; const columnHelper = createColumnHelper(); @@ -18,15 +16,9 @@ export const TABLE_COLUMNS = [ header: () => Financial feasibility, cell: (props) => ( - {props.row.original.financialFeasibility} - + value={props.row.original.financialFeasibility as PROJECT_SCORE} + className="min-h-[56px]" + /> ), }), columnHelper.accessor("legalFeasibility", { @@ -34,15 +26,9 @@ export const TABLE_COLUMNS = [ header: () => Legal Feasibility, cell: (props) => ( - {props.row.original.legalFeasibility} - + value={props.row.original.legalFeasibility as PROJECT_SCORE} + className="min-h-[56px]" + /> ), }), columnHelper.accessor("implementationFeasibility", { @@ -50,15 +36,9 @@ export const TABLE_COLUMNS = [ header: () => Implementation feasibility, cell: (props) => ( - {props.row.original.implementationFeasibility} - + value={props.row.original.implementationFeasibility as PROJECT_SCORE} + className="min-h-[56px]" + /> ), }), columnHelper.accessor("socialFeasibility", { @@ -66,15 +46,9 @@ export const TABLE_COLUMNS = [ header: () => Social Feasibility, cell: (props) => ( - {props.row.original.socialFeasibility} - + value={props.row.original.socialFeasibility as PROJECT_SCORE} + className="min-h-[56px]" + /> ), }), columnHelper.accessor("securityRating", { @@ -82,15 +56,9 @@ export const TABLE_COLUMNS = [ header: () => Security Rating, cell: (props) => ( - {props.row.original.securityRating} - + value={props.row.original.securityRating as PROJECT_SCORE} + className="min-h-[56px]" + /> ), }), columnHelper.accessor("availabilityOfExperiencedLabor", { @@ -98,15 +66,11 @@ export const TABLE_COLUMNS = [ header: () => Availability of experienced labor, cell: (props) => ( - {props.row.original.availabilityOfExperiencedLabor} - + value={ + props.row.original.availabilityOfExperiencedLabor as PROJECT_SCORE + } + className="min-h-[56px]" + /> ), }), columnHelper.accessor("availabilityOfAlternatingFunding", { @@ -114,15 +78,11 @@ export const TABLE_COLUMNS = [ header: () => Availability of alternating funding, cell: (props) => ( - {props.row.original.availabilityOfAlternatingFunding} - + value={ + props.row.original.availabilityOfAlternatingFunding as PROJECT_SCORE + } + className="min-h-[56px]" + /> ), }), columnHelper.accessor("coastalProtectionBenefits", { @@ -130,15 +90,9 @@ export const TABLE_COLUMNS = [ header: () => Coastal Protection benefit, cell: (props) => ( - {props.row.original.coastalProtectionBenefits} - + value={props.row.original.coastalProtectionBenefits as PROJECT_SCORE} + className="min-h-[56px]" + /> ), }), columnHelper.accessor("biodiversityBenefit", { @@ -146,15 +100,9 @@ export const TABLE_COLUMNS = [ header: () => Biodiversity benefit, cell: (props) => ( - {props.row.original.biodiversityBenefit} - + value={props.row.original.biodiversityBenefit as PROJECT_SCORE} + className="min-h-[56px]" + /> ), }), ];