Skip to content

Commit

Permalink
[TM-1531] add entityname and display data in notification
Browse files Browse the repository at this point in the history
  • Loading branch information
egrojMonroy committed Dec 17, 2024
1 parent e8cef37 commit ded0b85
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
27 changes: 16 additions & 11 deletions src/components/elements/Notification/FloatNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -65,18 +66,22 @@ const FloatNotification = () => {
<div className="mb-2 flex items-center gap-1">
<div className="h-2 w-2 rounded-full bg-primary" />
<Text variant="text-14-light" className="leading-[normal] text-darkCustom " as={"span"}>
{item.processedContent}
{item.name}
</Text>
</div>
{/* <Text variant="text-14-light" className="text-darkCustom">
Site: <b>{item.site}</b>
</Text>*/}
{/* <div className="mt-2 flex items-center gap-2">
<LinearProgressBar value={parseInt(item.value)} className="h-2 bg-success-40" color="success-600" />
<Text variant="text-12-semibold" className="text-black">
{item.value}
<Text variant="text-14-light" className="text-darkCustom">
Site: <b>{item.entityName}</b>
</Text>
</div> */}
<div className="mt-2 flex items-center gap-2">
<LinearProgressBar
value={((item.processedContent ?? 0) / (item.totalContent ?? 1)) * 100}
className="h-2 bg-success-40"
color="success-600"
/>
<Text variant="text-12-semibold" className="text-black">
{(item.processedContent ?? 0) / (item.totalContent ?? 1)}%
</Text>
</div>
</div>
))}
</div>
Expand All @@ -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
}
)}
>
Expand Down
15 changes: 13 additions & 2 deletions src/generated/v3/entityService/entityServiceSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
};
8 changes: 8 additions & 0 deletions src/generated/v3/jobService/jobServiceSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit ded0b85

Please sign in to comment.