From e9603e8d2a2309a9b3d6e7603efe85f18df5432a Mon Sep 17 00:00:00 2001 From: Janith Rathnayaka Date: Thu, 11 Apr 2024 13:31:53 +0530 Subject: [PATCH 1/2] update dightal-right variables --- ui/components/digital-right-indicator-list.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ui/components/digital-right-indicator-list.tsx b/ui/components/digital-right-indicator-list.tsx index 2dd447db8..8c7b87fd0 100644 --- a/ui/components/digital-right-indicator-list.tsx +++ b/ui/components/digital-right-indicator-list.tsx @@ -1,7 +1,6 @@ import { DigitalRightsPillar} from "database/ancillary"; -import { Score } from "database/processed/db"; +import { DigitalRightScore, Score } from "database/processed/db"; import { roundNumber } from "lib"; -import { ReactChild, ReactFragment, ReactPortal } from "react"; import { FaLink, FaSourcetree } from "react-icons/fa"; import useSWR from "swr"; @@ -151,18 +150,18 @@ const Indicator = ({ showSources, isShowingRawScores, }: { - indicator: any & { sources: any[] }; + indicator: DigitalRightScore & { sources: DigitalRightScore[] }; showSources: boolean; isShowingRawScores: boolean; }) => { const hasNoData = indicator.data_col === null; // we want to get the source name from the list of sources, // but if empty, we need to fall back to the indicator's "Data Source" - const sources = (indicator.sources || [indicator]).map((ind: { [x: string]: any; }) => ({ - link: ind["Source URL"], - source: ind["Source Name"], - year: ind["Year"] - })).filter((ind: { source: any; link: any; }) => ind.source && ind.link); + const sources = (indicator.sources || [indicator]).map(indicator => ({ + link: indicator["Source URL"], + source: indicator["Source Name"], + year: indicator["Year"] + })).filter(indicator => indicator.source && indicator.link) const value = +indicator.new_rank_score; const disp_val = value == 0 ? 0 : roundNumber(value, 2); return ( @@ -197,7 +196,7 @@ const Indicator = ({ )} {showSources && sources.length > 0 && (