From 6401b271278c391637d9619fc3b9a6ace37b0ca8 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Wed, 22 May 2024 10:07:45 +0100 Subject: [PATCH 1/2] improve review page by removing null values --- .../src/components/ReviewPage/ReviewCard.tsx | 22 ++++++++++--------- website/src/utils/displayMetadataField.ts | 18 ++++++++++++++- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/website/src/components/ReviewPage/ReviewCard.tsx b/website/src/components/ReviewPage/ReviewCard.tsx index 1d4c5215c6..149dab3d1b 100644 --- a/website/src/components/ReviewPage/ReviewCard.tsx +++ b/website/src/components/ReviewPage/ReviewCard.tsx @@ -197,16 +197,18 @@ const isAnnotationPresent = (metadataField: string) => (item: ProcessingAnnotati const MetadataList: FC = ({ data, isLoading }) => !isLoading && - Object.entries(data.processedData.metadata).map(([metadataName, value], index) => ( - - )); + Object.entries(data.processedData.metadata).map(([metadataName, value], index) => + value === null ? null : ( + + ), + ); type ErrorsProps = { errors: ProcessingAnnotation[]; diff --git a/website/src/utils/displayMetadataField.ts b/website/src/utils/displayMetadataField.ts index 74b84460d8..a72d447d01 100644 --- a/website/src/utils/displayMetadataField.ts +++ b/website/src/utils/displayMetadataField.ts @@ -1,3 +1,19 @@ import type { MetadataField } from '../types/backend.ts'; -export const displayMetadataField = (value: MetadataField) => (value === null ? 'null' : value.toString()); +export const displayMetadataField = (value: MetadataField) => { + if (value === null) { + return 'null'; + } + + if (typeof value === 'number' && Number.isInteger(value)) { + return value.toString(); + } + + if (typeof value === 'number') { + return value.toFixed(2); + } + + + return value.toString(); + +}; From d8f6fc34625b2591b35f0f218339f01dbafe175f Mon Sep 17 00:00:00 2001 From: Loculus bot Date: Wed, 22 May 2024 09:15:44 +0000 Subject: [PATCH 2/2] Automated code formatting --- website/src/utils/displayMetadataField.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/website/src/utils/displayMetadataField.ts b/website/src/utils/displayMetadataField.ts index a72d447d01..3a72fa16bc 100644 --- a/website/src/utils/displayMetadataField.ts +++ b/website/src/utils/displayMetadataField.ts @@ -13,7 +13,5 @@ export const displayMetadataField = (value: MetadataField) => { return value.toFixed(2); } - - return value.toString(); - + return value.toString(); };