From ded0b85bdcb12fad4db965699fe31d0a240bd2a7 Mon Sep 17 00:00:00 2001 From: JORGE Date: Tue, 17 Dec 2024 15:48:24 -0400 Subject: [PATCH] [TM-1531] add entityname and display data in notification --- .../Notification/FloatNotification.tsx | 27 +++++++++++-------- .../v3/entityService/entityServiceSchemas.ts | 15 +++++++++-- .../v3/jobService/jobServiceSchemas.ts | 8 ++++++ 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/components/elements/Notification/FloatNotification.tsx b/src/components/elements/Notification/FloatNotification.tsx index c79c64189..abe95792e 100644 --- a/src/components/elements/Notification/FloatNotification.tsx +++ b/src/components/elements/Notification/FloatNotification.tsx @@ -6,6 +6,7 @@ import Icon, { IconNames } from "@/components/extensive/Icon/Icon"; import { triggerBulkUpdate, useDelayedJobs } from "@/connections/DelayedJob"; import { DelayedJobData, DelayedJobDto } from "@/generated/v3/jobService/jobServiceSchemas"; +import LinearProgressBar from "../ProgressBar/LinearProgressBar/LinearProgressBar"; import Text from "../Text/Text"; export interface FloatNotificationDataProps { @@ -65,18 +66,22 @@ const FloatNotification = () => {
- {item.processedContent} + {item.name}
- {/* - Site: {item.site} - */} - {/*
- - - {item.value} + + Site: {item.entityName} -
*/} +
+ + + {(item.processedContent ?? 0) / (item.totalContent ?? 1)}% + +
))} @@ -94,8 +99,8 @@ const FloatNotification = () => { className={classNames( "z-10 flex h-15 w-15 items-center justify-center rounded-full border border-grey-950 bg-primary duration-300 hover:scale-105", { - // hidden: (delayedJobs?.length ?? 0) < 1 && isLoaded, - // visible: (delayedJobs?.length ?? 0) > 0 && isLoaded + hidden: (delayedJobs?.length ?? 0) < 1 && isLoaded, + visible: (delayedJobs?.length ?? 0) > 0 && isLoaded } )} > diff --git a/src/generated/v3/entityService/entityServiceSchemas.ts b/src/generated/v3/entityService/entityServiceSchemas.ts index bb11f5e3f..9734a4f86 100644 --- a/src/generated/v3/entityService/entityServiceSchemas.ts +++ b/src/generated/v3/entityService/entityServiceSchemas.ts @@ -3,6 +3,17 @@ * * @version 1.0 */ +export type PreviousPlantingCountDto = { + /** + * Taxonomic ID for this tree species row + */ + taxonId: string | null; + /** + * Number of trees of this type that have been planted in all previous reports on this entity. + */ + amount: number; +}; + export type ScientificNameDto = { /** * The scientific name for this tree species @@ -20,9 +31,9 @@ export type EstablishmentsTreesDto = { /** * If the entity in this request is a report, the sum totals of previous planting by species. * - * @example {"Aster persaliens":256,"Cirsium carniolicum":1024} + * @example {"Aster persaliens":{"amount":256},"Cirsium carniolicum":{"taxonId":"wfo-0000130112","amount":1024}} */ previousPlantingCounts: { - [key: string]: number; + [key: string]: PreviousPlantingCountDto; } | null; }; diff --git a/src/generated/v3/jobService/jobServiceSchemas.ts b/src/generated/v3/jobService/jobServiceSchemas.ts index 2c8cd9a25..71c2b7e6b 100644 --- a/src/generated/v3/jobService/jobServiceSchemas.ts +++ b/src/generated/v3/jobService/jobServiceSchemas.ts @@ -36,6 +36,14 @@ export type DelayedJobDto = { * Indicates whether the jobs have been acknowledged (cleared) */ isAcknowledged: boolean | null; + /** + * The name of the delayedJob + */ + name: string | null; + /** + * The name of the related entity (e.g., site, project). + */ + entityName?: string | null; }; export type DelayedJobAttributes = {