From efcec320da8b97278a9279deca394a850b0f6442 Mon Sep 17 00:00:00 2001 From: Dotnara Condori Date: Tue, 17 Dec 2024 15:44:20 -0400 Subject: [PATCH] [TM-1563] Audit Log [Site, Nursery, Project Admin Views]: Extend the width of the audit log (#757) --- .../ResourceTabs/AuditLogTab/AuditLogTab.tsx | 31 +++++++++++++++ .../components/SiteAuditLogEntityStatus.tsx | 38 ++++++++++--------- .../components/SiteAuditLogProjectStatus.tsx | 11 ++++-- .../MonitoredTab/components/DataCard.tsx | 2 +- .../components/EcoRegionDoughnutChart.tsx | 3 +- .../components/MonitoredCharts.tsx | 8 +++- .../components/TreesLossBarChart.tsx | 4 +- .../components/GraphicIconDashboard.tsx | 15 +++++++- src/pages/project/[uuid]/tabs/AuditLog.tsx | 2 +- 9 files changed, 85 insertions(+), 29 deletions(-) diff --git a/src/admin/components/ResourceTabs/AuditLogTab/AuditLogTab.tsx b/src/admin/components/ResourceTabs/AuditLogTab/AuditLogTab.tsx index 32459384f..0dcc8dc09 100644 --- a/src/admin/components/ResourceTabs/AuditLogTab/AuditLogTab.tsx +++ b/src/admin/components/ResourceTabs/AuditLogTab/AuditLogTab.tsx @@ -9,6 +9,7 @@ import { NURSERY_REPORT, PROJECT_REPORT, SITE_REPORT } from "@/constants/entitie import useAuditLogActions from "@/hooks/AuditStatus/useAuditLogActions"; import AuditLogSiteTabSelection from "./components/AuditLogSiteTabSelection"; +import AuditLogTable from "./components/AuditLogTable"; import SiteAuditLogEntityStatus from "./components/SiteAuditLogEntityStatus"; import SiteAuditLogEntityStatusSide from "./components/SiteAuditLogEntityStatusSide"; import SiteAuditLogProjectStatus from "./components/SiteAuditLogProjectStatus"; @@ -58,6 +59,10 @@ const AuditLogTab: FC = ({ label, entity, ...rest }) => { loadEntityList(); }, [buttonToggle]); + const isSite = buttonToggle === AuditLogButtonStates.SITE; + const redirectTo = `${basename}/${modules.site.ResourceName}/${selected?.uuid}/show/6`; + const title = () => selected?.title ?? selected?.name; + const verifyEntity = ["reports", "nursery"].some(word => ReverseButtonStates2[entity!].includes(word)); const verifyEntityReport = () => { @@ -133,6 +138,32 @@ const AuditLogTab: FC = ({ label, entity, ...rest }) => { /> +
+ + + History and Discussion for {record && record?.name} + + {auditLogData && } + + + <> +
+ {!isSite && !verifyEntity && History and Discussion for {title()}} + {(isSite || verifyEntity) && ( + + History and Discussion for{" "} + + {title()} + + + )} +
+ + + + +
+
); diff --git a/src/admin/components/ResourceTabs/AuditLogTab/components/SiteAuditLogEntityStatus.tsx b/src/admin/components/ResourceTabs/AuditLogTab/components/SiteAuditLogEntityStatus.tsx index d8815bae6..21a51288a 100644 --- a/src/admin/components/ResourceTabs/AuditLogTab/components/SiteAuditLogEntityStatus.tsx +++ b/src/admin/components/ResourceTabs/AuditLogTab/components/SiteAuditLogEntityStatus.tsx @@ -63,24 +63,26 @@ const SiteAuditLogEntityStatus: FC = ({ -
- {!isSite && !verifyEntity && History and Discussion for {title()}} - {(isSite || verifyEntity) && ( - - History and Discussion for{" "} - {viewPD ? ( - - {title()} - - ) : ( - - {title()} - - )} - - )} -
- + +
+ {!isSite && !verifyEntity && History and Discussion for {title()}} + {(isSite || verifyEntity) && ( + + History and Discussion for{" "} + {viewPD ? ( + + {title()} + + ) : ( + + {title()} + + )} + + )} +
+
+ diff --git a/src/admin/components/ResourceTabs/AuditLogTab/components/SiteAuditLogProjectStatus.tsx b/src/admin/components/ResourceTabs/AuditLogTab/components/SiteAuditLogProjectStatus.tsx index a9d23ffc1..57684ba9c 100644 --- a/src/admin/components/ResourceTabs/AuditLogTab/components/SiteAuditLogProjectStatus.tsx +++ b/src/admin/components/ResourceTabs/AuditLogTab/components/SiteAuditLogProjectStatus.tsx @@ -1,4 +1,5 @@ import { FC } from "react"; +import { When } from "react-if"; import Text from "@/components/elements/Text/Text"; import { AuditStatusResponse, ProjectLiteRead } from "@/generated/apiSchemas"; @@ -10,13 +11,15 @@ export interface SiteAuditLogProjectStatusProps { auditLogData?: { data: AuditStatusResponse[] }; auditData?: { entity: string; entity_uuid: string }; refresh?: () => void; + viewPD?: boolean; } const SiteAuditLogProjectStatus: FC = ({ record, auditLogData, auditData, - refresh + refresh, + viewPD = false }) => (
@@ -27,8 +30,10 @@ const SiteAuditLogProjectStatus: FC = ({ Update the project status, view updates, or add comments
- History and Discussion for {record && record?.name} - {auditLogData && } + + History and Discussion for {record && record?.name} + {auditLogData && } +
); diff --git a/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx b/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx index 8533f70e7..ec2e28b5c 100644 --- a/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx +++ b/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx @@ -650,7 +650,7 @@ const DataCard = ({ hidden: selected.includes("6") })} optionsClassName="!w-max right-0" - className="w-max" + className="!h-8 w-max" options={polygonOptions} defaultValue={["0"]} onChange={option => setSelectedPolygonUuid(option[0])} diff --git a/src/admin/components/ResourceTabs/MonitoredTab/components/EcoRegionDoughnutChart.tsx b/src/admin/components/ResourceTabs/MonitoredTab/components/EcoRegionDoughnutChart.tsx index 9ca86a03d..3b00446ab 100644 --- a/src/admin/components/ResourceTabs/MonitoredTab/components/EcoRegionDoughnutChart.tsx +++ b/src/admin/components/ResourceTabs/MonitoredTab/components/EcoRegionDoughnutChart.tsx @@ -102,7 +102,8 @@ const EcoRegionDoughnutChart: React.FC = ({ data }) }; return ( -
+
+

Hectares Under Restoration By WWF EcoRegion

} /> diff --git a/src/admin/components/ResourceTabs/MonitoredTab/components/MonitoredCharts.tsx b/src/admin/components/ResourceTabs/MonitoredTab/components/MonitoredCharts.tsx index 16cbee3ff..95da0709c 100644 --- a/src/admin/components/ResourceTabs/MonitoredTab/components/MonitoredCharts.tsx +++ b/src/admin/components/ResourceTabs/MonitoredTab/components/MonitoredCharts.tsx @@ -138,8 +138,12 @@ const MonitoredCharts = ({ case "5": return ( -
- +
+
); diff --git a/src/admin/components/ResourceTabs/MonitoredTab/components/TreesLossBarChart.tsx b/src/admin/components/ResourceTabs/MonitoredTab/components/TreesLossBarChart.tsx index 772cc6150..66f3b0172 100644 --- a/src/admin/components/ResourceTabs/MonitoredTab/components/TreesLossBarChart.tsx +++ b/src/admin/components/ResourceTabs/MonitoredTab/components/TreesLossBarChart.tsx @@ -36,8 +36,8 @@ const TreeLossBarChart = ({ data, className = "" }: TreeLossBarChartProps) => { }; return ( -
-

Tree Loss Retrospective (ha)

+
+

Tree Loss Retrospective (ha)

2015-2024

{ +const GraphicIconDashboard = ({ + data, + maxValue, + title +}: { + data: DashboardTableDataProps[]; + maxValue: number; + title?: string; +}) => { const t = useT(); const [tooltip, setTooltip] = useState<{ text: string | null; @@ -67,6 +75,11 @@ const GraphicIconDashboard = ({ data, maxValue }: { data: DashboardTableDataProp return (
+ + + {title} + + 0}>
{data.map((item, index) => { diff --git a/src/pages/project/[uuid]/tabs/AuditLog.tsx b/src/pages/project/[uuid]/tabs/AuditLog.tsx index 71b957309..0339eb275 100644 --- a/src/pages/project/[uuid]/tabs/AuditLog.tsx +++ b/src/pages/project/[uuid]/tabs/AuditLog.tsx @@ -62,7 +62,7 @@ const AuditLog = ({ label, project, refresh: refreshProject, enableChangeStatus,
- +