From ac0316f027a3f478823590aabce3022c1228e0f5 Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Thu, 23 May 2024 11:13:01 -0700
Subject: [PATCH 01/19] [TM-786] Clear up some warnings in modal tests.
---
src/context/modal.provider.test.tsx | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/context/modal.provider.test.tsx b/src/context/modal.provider.test.tsx
index 95354fc2f..6ca8538a1 100644
--- a/src/context/modal.provider.test.tsx
+++ b/src/context/modal.provider.test.tsx
@@ -1,4 +1,5 @@
import { renderHook } from "@testing-library/react";
+import { act } from "react-dom/test-utils";
import { wait } from "@/utils/test-utils";
@@ -12,7 +13,7 @@ describe("Modal context provider", () => {
wrapper: props => {props.children}
});
- result.current.openModal(Modal);
+ act(() => result.current.openModal(Modal));
await wait(200);
expect(result.current.modalOpen).toEqual(true);
@@ -24,10 +25,10 @@ describe("Modal context provider", () => {
wrapper: props => {props.children}
});
- result.current.openModal(Modal);
+ act(() => result.current.openModal(Modal));
await wait(200);
- result.current.closeModal();
+ act(() => result.current.closeModal());
await wait(200);
expect(result.current.modalOpen).toEqual(false);
@@ -38,7 +39,7 @@ describe("Modal context provider", () => {
wrapper: props => {props.children}
});
- result.current.setModalContent(Modal);
+ act(() => result.current.setModalContent(Modal));
await wait(200);
expect(result.current.modalContent).toEqual(Modal);
From 4cd861f2d98b353f75ec14f072d2ebca39f78327 Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Thu, 23 May 2024 11:15:49 -0700
Subject: [PATCH 02/19] [TM-786] Test against staging
---
.jest/setEnvVars.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.jest/setEnvVars.js b/.jest/setEnvVars.js
index f148eb1be..8d2b37bde 100644
--- a/.jest/setEnvVars.js
+++ b/.jest/setEnvVars.js
@@ -1,2 +1,2 @@
process.env.NODE_ENV = "test";
-process.env.NEXT_PUBLIC_API_BASE_URL = "https://test.wrirestorationmarketplace.cubeapis.com";
+process.env.NEXT_PUBLIC_API_BASE_URL = "https://new-wri-staging.wri-restoration-marketplace-api.com";
From 50612369ceabbdb94734b8f7c9b619aac3c808cb Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Thu, 23 May 2024 11:20:48 -0700
Subject: [PATCH 03/19] [TM-786] Regenerate out of date snapshots
---
.../__snapshots__/landTenure.test.ts.snap | 12 +++----
.../restorationInterventionTypes.test.ts.snap | 18 +++++-----
.../options/__snapshots__/status.test.ts.snap | 4 ---
.../sustainableDevelopmentGoals.test.ts.snap | 34 +++++++++----------
4 files changed, 32 insertions(+), 36 deletions(-)
diff --git a/src/constants/options/__snapshots__/landTenure.test.ts.snap b/src/constants/options/__snapshots__/landTenure.test.ts.snap
index 9b813c2d1..b55686087 100644
--- a/src/constants/options/__snapshots__/landTenure.test.ts.snap
+++ b/src/constants/options/__snapshots__/landTenure.test.ts.snap
@@ -4,42 +4,42 @@ exports[`snapShot test getLandTenureOptions 1`] = `
[
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/land-tenures/public.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/land-tenures/public.png",
},
"title": "Public",
"value": "public",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/land-tenures/private.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/land-tenures/private.png",
},
"title": "Private",
"value": "private",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/land-tenures/indigenous.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/land-tenures/indigenous.png",
},
"title": "Indigenous",
"value": "indigenous",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/land-tenures/communal.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/land-tenures/communal.png",
},
"title": "Communal",
"value": "communal",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/land-tenures/national-protected-area.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/land-tenures/national-protected-area.png",
},
"title": "National Protected Area",
"value": "national-protected-area",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/land-tenures/other.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/land-tenures/other.png",
},
"title": "Other",
"value": "other",
diff --git a/src/constants/options/__snapshots__/restorationInterventionTypes.test.ts.snap b/src/constants/options/__snapshots__/restorationInterventionTypes.test.ts.snap
index e72ebdcc9..6fce06118 100644
--- a/src/constants/options/__snapshots__/restorationInterventionTypes.test.ts.snap
+++ b/src/constants/options/__snapshots__/restorationInterventionTypes.test.ts.snap
@@ -4,63 +4,63 @@ exports[`snapShot test getRestorationInterventionTypeOptions 1`] = `
[
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/restoration-methods/agroforestry@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/restoration-methods/agroforestry@2x.png",
},
"title": "Agroforestry",
"value": "agroforestry",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/restoration-methods/applied_nucleation_tree_island@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/restoration-methods/applied_nucleation_tree_island@2x.png",
},
"title": "Applied Nucleation",
"value": "applied-nucleation",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/restoration-methods/assisted_natural@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/restoration-methods/assisted_natural@2x.png",
},
"title": "Assisted Natural Regeneration",
"value": "assisted-natural-regeneration",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/restoration-methods/direct_seeding@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/restoration-methods/direct_seeding@2x.png",
},
"title": "Direct Seeding",
"value": "direct-seeding",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/restoration-methods/enrichment_planting@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/restoration-methods/enrichment_planting@2x.png",
},
"title": "Enrichment Planting",
"value": "enrichment-planting",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/restoration-methods/mangrove@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/restoration-methods/mangrove@2x.png",
},
"title": "Mangrove Restoration",
"value": "mangrove-restoration",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/restoration-methods/reforestation@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/restoration-methods/reforestation@2x.png",
},
"title": "Reforestation",
"value": "reforestation",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/restoration-methods/riparian@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/restoration-methods/riparian@2x.png",
},
"title": "Riparian Restoration",
"value": "riparian-restoration",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/restoration-methods/silvopasture@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/restoration-methods/silvopasture@2x.png",
},
"title": "Silvopasture",
"value": "silvopasture",
diff --git a/src/constants/options/__snapshots__/status.test.ts.snap b/src/constants/options/__snapshots__/status.test.ts.snap
index 47df3e24e..af9d78dc5 100644
--- a/src/constants/options/__snapshots__/status.test.ts.snap
+++ b/src/constants/options/__snapshots__/status.test.ts.snap
@@ -6,10 +6,6 @@ exports[`snapShot getStatusOptions 1`] = `
"title": "Draft",
"value": "started",
},
- {
- "title": "Rejected",
- "value": "rejected",
- },
{
"title": "Approved",
"value": "approved",
diff --git a/src/constants/options/__snapshots__/sustainableDevelopmentGoals.test.ts.snap b/src/constants/options/__snapshots__/sustainableDevelopmentGoals.test.ts.snap
index 73d313f82..4b737eee6 100644
--- a/src/constants/options/__snapshots__/sustainableDevelopmentGoals.test.ts.snap
+++ b/src/constants/options/__snapshots__/sustainableDevelopmentGoals.test.ts.snap
@@ -4,119 +4,119 @@ exports[`snapShot test sustainableDevelopmentGoalsOptions 1`] = `
[
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/no_poverty@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/no_poverty@2x.png",
},
"title": "No Poverty",
"value": "no-poverty",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/zero_hunger@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/zero_hunger@2x.png",
},
"title": "Zero Hunger",
"value": "zero-hunger",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/good-health-and-well-being@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/good-health-and-well-being@2x.png",
},
"title": "Good Health and Well-being",
"value": "good-health-and-well-being",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/quality-education@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/quality-education@2x.png",
},
"title": "Quality Education",
"value": "quality-education",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/gender-equality@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/gender-equality@2x.png",
},
"title": "Gender Equality",
"value": "gender-equality",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/clean-water-and-sanitation@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/clean-water-and-sanitation@2x.png",
},
"title": "Clean Water and Sanitation",
"value": "clean-water-and-sanitation",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/affordable-and-clean-energy@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/affordable-and-clean-energy@2x.png",
},
"title": "Affordable and Clean Energy",
"value": "affordable-and-clean-energy",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/decent-work-and-economic-growth@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/decent-work-and-economic-growth@2x.png",
},
"title": "Decent Work and Economic Growth",
"value": "decent-work-and-economic-growth",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/industry-innovation-and-infrastructure@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/industry-innovation-and-infrastructure@2x.png",
},
"title": "Industry, Innovation, and Infrastructure",
"value": "industry-innovation-and-infrastructure",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/reduced-inequalities@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/reduced-inequalities@2x.png",
},
"title": "Reduced Inequalities",
"value": "reduced-inequalities",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/sustainable-cities-and-communities@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/sustainable-cities-and-communities@2x.png",
},
"title": "Sustainable Cities and Communities",
"value": "sustainable-cities-and-communities",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/responsible-consumption-and-production@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/responsible-consumption-and-production@2x.png",
},
"title": "Responsible Consumption and Production",
"value": "responsible-consumption-and-production",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/climate-action@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/climate-action@2x.png",
},
"title": "Climate Action",
"value": "climate-action",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/life-below-water@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/life-below-water@2x.png",
},
"title": "Life Below Water",
"value": "life-below-water",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/life-on-land@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/life-on-land@2x.png",
},
"title": "Life on Land",
"value": "life-on-land",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/peace-justice-and-strong-institutions@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/peace-justice-and-strong-institutions@2x.png",
},
"title": "Peace, Justice, and Strong Institutions",
"value": "peace-justice-and-strong-institutions",
},
{
"meta": {
- "image_url": "https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/partnerships-for-the-goals@2x.png",
+ "image_url": "https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/partnerships-for-the-goals@2x.png",
},
"title": "Partnerships for the Goals",
"value": "partnerships-for-the-goals",
From 4e40da04f04c2315092925b6d0047790e224b9b4 Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Thu, 23 May 2024 11:23:11 -0700
Subject: [PATCH 04/19] [TM-786] Update hook tests to match old code changes.
---
src/hooks/useGetReportingWindow.test.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hooks/useGetReportingWindow.test.ts b/src/hooks/useGetReportingWindow.test.ts
index 14386e83f..fc7bd1ebf 100644
--- a/src/hooks/useGetReportingWindow.test.ts
+++ b/src/hooks/useGetReportingWindow.test.ts
@@ -11,7 +11,7 @@ describe("Test useGetReportingWindow hook", () => {
const { getReportingWindow } = useGetReportingWindow();
return getReportingWindow(due_date, "bi-annually");
});
- expect(result.current).toBe("November - April 2023");
+ expect(result.current).toBe("October - March 2023");
});
test("Test `quarterly` window", () => {
@@ -20,6 +20,6 @@ describe("Test useGetReportingWindow hook", () => {
const { getReportingWindow } = useGetReportingWindow();
return getReportingWindow(due_date, "quarterly");
});
- expect(result.current).toBe("February - April 2023");
+ expect(result.current).toBe("January - March 2023");
});
});
From 5c3c02dca132548b395e98b1a7408dac04d75436 Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Thu, 23 May 2024 11:27:11 -0700
Subject: [PATCH 05/19] [TM-786] Add storyshots for the workday collapse grid
storybook
---
.../WorkdayCollapseGrid.stories.storyshot | 187 ++++++++++++++++++
1 file changed, 187 insertions(+)
create mode 100644 src/components/extensive/WorkdayCollapseGrid/__snapshots__/WorkdayCollapseGrid.stories.storyshot
diff --git a/src/components/extensive/WorkdayCollapseGrid/__snapshots__/WorkdayCollapseGrid.stories.storyshot b/src/components/extensive/WorkdayCollapseGrid/__snapshots__/WorkdayCollapseGrid.stories.storyshot
new file mode 100644
index 000000000..ea26ceea7
--- /dev/null
+++ b/src/components/extensive/WorkdayCollapseGrid/__snapshots__/WorkdayCollapseGrid.stories.storyshot
@@ -0,0 +1,187 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Storyshots Components/Extensive/WorkdayCollapse Complete Green 1`] = `
+
+
+
+
+ A. Site Establishment Paid - 90 Days
+
+
+
+
+
+`;
+
+exports[`Storyshots Components/Extensive/WorkdayCollapse Default 1`] = `
+
+
+
+
+ A. Site Establishment Paid - 210 Days
+
+
+
+
+
+`;
+
+exports[`Storyshots Components/Extensive/WorkdayCollapse In Progress Green 1`] = `
+
+
+
+
+ A. Site Establishment Paid - 75 Days
+
+
+
+
+
+`;
+
+exports[`Storyshots Components/Extensive/WorkdayCollapse Not Started Green 1`] = `
+
+
+
+
+ A. Site Establishment Paid - 0 Days
+
+
+
+
+
+`;
+
+exports[`Storyshots Components/Extensive/WorkdayCollapse Variant Narrow 1`] = `
+
+
+
+
+ A. Nursery Operations Volunteer - 220 Days
+
+
+
+
+
+`;
From 12a3e4a31e7dbc4932274cd9a3da0339bb4f5a04 Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Thu, 23 May 2024 13:01:24 -0700
Subject: [PATCH 06/19] [TM-786] Regenerate storyshots
---
.../FundingCard.stories.storyshot | 8 +-
.../ImageGallery.stories.storyshot | 301 ++++++++++++++++--
.../BooleanInput.stories.storyshot | 2 +
.../ConditionalInput.stories.tsx | 3 +-
.../ConditionalInput.stories.storyshot | 2 +
.../__snapshots__/Dropdown.stories.storyshot | 32 ++
.../LanguagesDropdown.stories.storyshot | 16 +
.../RadioGroup.stories.storyshot | 2 +
.../AlternatingSection.stories.storyshot | 4 +-
.../SelectImageList.stories.storyshot | 20 +-
.../__snapshots__/Table.stories.storyshot | 145 ++++++++-
.../ApplicationsCard.stories.storyshot | 38 +--
.../PerPageSelector.stories.storyshot | 11 +-
.../MainLayout.stories.storyshot | 59 +++-
.../__snapshots__/Navbar.stories.storyshot | 118 ++++++-
.../useGetCustomFormSteps.stories.storyshot | 39 ++-
16 files changed, 731 insertions(+), 69 deletions(-)
diff --git a/src/components/elements/Cards/FundingCard/__snapshots__/FundingCard.stories.storyshot b/src/components/elements/Cards/FundingCard/__snapshots__/FundingCard.stories.storyshot
index d64d5ab9f..5ea8b0618 100644
--- a/src/components/elements/Cards/FundingCard/__snapshots__/FundingCard.stories.storyshot
+++ b/src/components/elements/Cards/FundingCard/__snapshots__/FundingCard.stories.storyshot
@@ -41,7 +41,7 @@ exports[`Storyshots Components/Elements/Cards/FundingCard Default 1`] = `
Location:
London, United Kingdom
@@ -54,10 +54,10 @@ exports[`Storyshots Components/Elements/Cards/FundingCard Default 1`] = `
The funding application is designed for restoration projects in Africa. This application provides an opportunity for project developers to seek financial support for their restoration initiatives across the African continent.
@@ -69,6 +77,14 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
+
@@ -79,11 +95,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -144,11 +178,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -209,11 +261,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -264,6 +334,14 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
+
@@ -274,11 +352,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -339,11 +435,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -394,6 +508,14 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
+
@@ -404,11 +526,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -469,11 +609,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -534,11 +692,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -589,6 +765,14 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
+
@@ -599,11 +783,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -654,6 +856,14 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
+
@@ -664,11 +874,29 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
onMouseEnter={[Function]}
onTouchStart={[Function]}
target="_blank"
- />
+ >
+
+
+ >
+
+
@@ -723,7 +951,16 @@ exports[`Storyshots Components/Elements/ImageGallery Default 1`] = `
+ >
+
+
+ >
+
+
+ >
+
+
diff --git a/src/components/elements/Inputs/BooleanInput/__snapshots__/BooleanInput.stories.storyshot b/src/components/elements/Inputs/BooleanInput/__snapshots__/BooleanInput.stories.storyshot
index 7cfac736f..dfc1cdbb4 100644
--- a/src/components/elements/Inputs/BooleanInput/__snapshots__/BooleanInput.stories.storyshot
+++ b/src/components/elements/Inputs/BooleanInput/__snapshots__/BooleanInput.stories.storyshot
@@ -53,6 +53,7 @@ exports[`Storyshots Components/Elements/Inputs/BooleanInput Default 1`] = `
className="flex flex-row-reverse items-center justify-end gap-3 "
id=":re:"
label="Yes"
+ onChange={[Function]}
type="radio"
/>
@@ -86,6 +87,7 @@ exports[`Storyshots Components/Elements/Inputs/BooleanInput Default 1`] = `
className="flex flex-row-reverse items-center justify-end gap-3 "
id=":rg:"
label="No"
+ onChange={[Function]}
type="radio"
/>
diff --git a/src/components/elements/Inputs/ConditionalInput/ConditionalInput.stories.tsx b/src/components/elements/Inputs/ConditionalInput/ConditionalInput.stories.tsx
index 1e9d57f16..c5e99b25d 100644
--- a/src/components/elements/Inputs/ConditionalInput/ConditionalInput.stories.tsx
+++ b/src/components/elements/Inputs/ConditionalInput/ConditionalInput.stories.tsx
@@ -16,7 +16,8 @@ type Story = StoryObj;
export const Default: Story = {
render: args => {
const formHook = useForm();
- return ;
+ const onChangeCapture = () => {};
+ return ;
},
args: {
name: "conditional-field",
diff --git a/src/components/elements/Inputs/ConditionalInput/__snapshots__/ConditionalInput.stories.storyshot b/src/components/elements/Inputs/ConditionalInput/__snapshots__/ConditionalInput.stories.storyshot
index b8b201302..aa443fce1 100644
--- a/src/components/elements/Inputs/ConditionalInput/__snapshots__/ConditionalInput.stories.storyshot
+++ b/src/components/elements/Inputs/ConditionalInput/__snapshots__/ConditionalInput.stories.storyshot
@@ -54,6 +54,7 @@ Array [
className="flex flex-row-reverse items-center justify-end gap-3 "
id=":rl:"
label="Yes"
+ onChange={[Function]}
type="radio"
/>
@@ -87,6 +88,7 @@ Array [
className="flex flex-row-reverse items-center justify-end gap-3 "
id=":rn:"
label="No"
+ onChange={[Function]}
type="radio"
/>
diff --git a/src/components/elements/Inputs/Dropdown/__snapshots__/Dropdown.stories.storyshot b/src/components/elements/Inputs/Dropdown/__snapshots__/Dropdown.stories.storyshot
index 7afb98a12..48ed83dc6 100644
--- a/src/components/elements/Inputs/Dropdown/__snapshots__/Dropdown.stories.storyshot
+++ b/src/components/elements/Inputs/Dropdown/__snapshots__/Dropdown.stories.storyshot
@@ -42,6 +42,14 @@ exports[`Storyshots Components/Elements/Inputs/Dropdown Multi Select 1`] = `
>
placeholder
+
@@ -89,6 +97,14 @@ exports[`Storyshots Components/Elements/Inputs/Dropdown Multi Select With Other
>
placeholder
+
@@ -136,6 +152,14 @@ exports[`Storyshots Components/Elements/Inputs/Dropdown Single Select 1`] = `
>
placeholder
+
@@ -183,6 +207,14 @@ exports[`Storyshots Components/Elements/Inputs/Dropdown Single Select With Other
>
placeholder
+
diff --git a/src/components/elements/Inputs/LanguageDropdown/__snapshots__/LanguagesDropdown.stories.storyshot b/src/components/elements/Inputs/LanguageDropdown/__snapshots__/LanguagesDropdown.stories.storyshot
index 62b79263b..aaa73a5c6 100644
--- a/src/components/elements/Inputs/LanguageDropdown/__snapshots__/LanguagesDropdown.stories.storyshot
+++ b/src/components/elements/Inputs/LanguageDropdown/__snapshots__/LanguagesDropdown.stories.storyshot
@@ -19,11 +19,27 @@ exports[`Storyshots Components/Elements/Inputs/LanguagesDropdown Default 1`] = `
onMouseDown={[Function]}
type="button"
>
+
English
+
diff --git a/src/components/elements/Inputs/RadioGroup/__snapshots__/RadioGroup.stories.storyshot b/src/components/elements/Inputs/RadioGroup/__snapshots__/RadioGroup.stories.storyshot
index fb42745a4..11a8a76e6 100644
--- a/src/components/elements/Inputs/RadioGroup/__snapshots__/RadioGroup.stories.storyshot
+++ b/src/components/elements/Inputs/RadioGroup/__snapshots__/RadioGroup.stories.storyshot
@@ -44,6 +44,7 @@ exports[`Storyshots Components/Elements/Inputs/RadioGroup Default 1`] = `
className="flex flex-row-reverse items-center justify-end gap-3 "
id=":r1g:"
label="Yes"
+ onChange={[Function]}
type="radio"
/>
@@ -77,6 +78,7 @@ exports[`Storyshots Components/Elements/Inputs/RadioGroup Default 1`] = `
className="flex flex-row-reverse items-center justify-end gap-3 "
id=":r1i:"
label="No"
+ onChange={[Function]}
type="radio"
/>
diff --git a/src/components/elements/LandingPage/__snapshots__/AlternatingSection.stories.storyshot b/src/components/elements/LandingPage/__snapshots__/AlternatingSection.stories.storyshot
index d505d787e..6aabb122e 100644
--- a/src/components/elements/LandingPage/__snapshots__/AlternatingSection.stories.storyshot
+++ b/src/components/elements/LandingPage/__snapshots__/AlternatingSection.stories.storyshot
@@ -44,7 +44,7 @@ exports[`Storyshots Components/Elements/LandingPage/AlternatingSection Left 1`]
className="flex justify-center bg-background md:w-[50%]"
>
@@ -32,7 +32,7 @@ exports[`Storyshots Components/Elements/SelectImageList Condensed 1`] = `
className="aspect-square h-[6.375rem] rounded-lg bg-cover bg-center transition-all duration-200"
style={
Object {
- "backgroundImage": "url('https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/good-health-and-well-being@2x.png')",
+ "backgroundImage": "url('https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/good-health-and-well-being@2x.png')",
}
}
/>
@@ -52,7 +52,7 @@ exports[`Storyshots Components/Elements/SelectImageList Condensed 1`] = `
className="aspect-square h-[6.375rem] rounded-lg bg-cover bg-center transition-all duration-200"
style={
Object {
- "backgroundImage": "url('https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/quality-education@2x.png')",
+ "backgroundImage": "url('https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/quality-education@2x.png')",
}
}
/>
@@ -72,7 +72,7 @@ exports[`Storyshots Components/Elements/SelectImageList Condensed 1`] = `
className="aspect-square h-[6.375rem] rounded-lg bg-cover bg-center transition-all duration-200"
style={
Object {
- "backgroundImage": "url('https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/affordable-and-clean-energy@2x.png')",
+ "backgroundImage": "url('https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/affordable-and-clean-energy@2x.png')",
}
}
/>
@@ -92,7 +92,7 @@ exports[`Storyshots Components/Elements/SelectImageList Condensed 1`] = `
className="aspect-square h-[6.375rem] rounded-lg bg-cover bg-center transition-all duration-200"
style={
Object {
- "backgroundImage": "url('https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/climate-action@2x.png')",
+ "backgroundImage": "url('https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/climate-action@2x.png')",
}
}
/>
@@ -119,7 +119,7 @@ exports[`Storyshots Components/Elements/SelectImageList Default 1`] = `
className="border-4 border-neutral-900 aspect-square h-[6.375rem] rounded-lg bg-cover bg-center transition-all duration-200"
style={
Object {
- "backgroundImage": "url('https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/no_poverty@2x.png')",
+ "backgroundImage": "url('https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/no_poverty@2x.png')",
}
}
/>
@@ -139,7 +139,7 @@ exports[`Storyshots Components/Elements/SelectImageList Default 1`] = `
className="border-4 border-neutral-900 aspect-square h-[6.375rem] rounded-lg bg-cover bg-center transition-all duration-200"
style={
Object {
- "backgroundImage": "url('https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/good-health-and-well-being@2x.png')",
+ "backgroundImage": "url('https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/good-health-and-well-being@2x.png')",
}
}
/>
@@ -159,7 +159,7 @@ exports[`Storyshots Components/Elements/SelectImageList Default 1`] = `
className="border-4 border-neutral-900 aspect-square h-[6.375rem] rounded-lg bg-cover bg-center transition-all duration-200"
style={
Object {
- "backgroundImage": "url('https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/quality-education@2x.png')",
+ "backgroundImage": "url('https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/quality-education@2x.png')",
}
}
/>
@@ -179,7 +179,7 @@ exports[`Storyshots Components/Elements/SelectImageList Default 1`] = `
className="border-4 border-neutral-900 aspect-square h-[6.375rem] rounded-lg bg-cover bg-center transition-all duration-200"
style={
Object {
- "backgroundImage": "url('https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/affordable-and-clean-energy@2x.png')",
+ "backgroundImage": "url('https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/affordable-and-clean-energy@2x.png')",
}
}
/>
@@ -199,7 +199,7 @@ exports[`Storyshots Components/Elements/SelectImageList Default 1`] = `
className="border-4 border-neutral-900 aspect-square h-[6.375rem] rounded-lg bg-cover bg-center transition-all duration-200"
style={
Object {
- "backgroundImage": "url('https://test.wrirestorationmarketplace.cubeapis.com/images/V2/sustainable-development-goals/climate-action@2x.png')",
+ "backgroundImage": "url('https://new-wri-staging.wri-restoration-marketplace-api.com/images/V2/sustainable-development-goals/climate-action@2x.png')",
}
}
/>
diff --git a/src/components/elements/Table/__snapshots__/Table.stories.storyshot b/src/components/elements/Table/__snapshots__/Table.stories.storyshot
index 1d2763868..e2ef42969 100644
--- a/src/components/elements/Table/__snapshots__/Table.stories.storyshot
+++ b/src/components/elements/Table/__snapshots__/Table.stories.storyshot
@@ -13,6 +13,14 @@ exports[`Storyshots Components/Elements/Table Default 1`] = `
@@ -94,6 +110,14 @@ exports[`Storyshots Components/Elements/Table Default 1`] = `
onClick={[Function]}
>
Funding source
+
Funding amount
+
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+ >
+
+
+ >
+
+
diff --git a/src/components/extensive/ActionTracker/cards/__snapshots__/ApplicationsCard.stories.storyshot b/src/components/extensive/ActionTracker/cards/__snapshots__/ApplicationsCard.stories.storyshot
index 786fab0dc..024613e50 100644
--- a/src/components/extensive/ActionTracker/cards/__snapshots__/ApplicationsCard.stories.storyshot
+++ b/src/components/extensive/ActionTracker/cards/__snapshots__/ApplicationsCard.stories.storyshot
@@ -258,24 +258,6 @@ exports[`Storyshots Components/Extensive/ActionTracker/ApplicationsCard Default
>
TerraFund for AFR100: Landscapes - Expression of Interest (Enterprises)
-
TerraFund for AFR100: Landscapes - Expression of Interest (Enterprises)
+
+
+
+ More info requested
+
+
- Awaiting Review
+ Awaiting approval
diff --git a/src/components/extensive/Pagination/__snapshots__/PerPageSelector.stories.storyshot b/src/components/extensive/Pagination/__snapshots__/PerPageSelector.stories.storyshot
index fcfc894f3..efcc498c7 100644
--- a/src/components/extensive/Pagination/__snapshots__/PerPageSelector.stories.storyshot
+++ b/src/components/extensive/Pagination/__snapshots__/PerPageSelector.stories.storyshot
@@ -35,7 +35,16 @@ exports[`Storyshots Components/Elements/Table/PerPageSelector Default 1`] = `
+ >
+
+
+
@@ -34,11 +42,27 @@ exports[`Storyshots Components/Generic/Layouts/MainLayout Default 1`] = `
onMouseDown={[Function]}
type="button"
>
+
English
+
@@ -103,6 +127,14 @@ exports[`Storyshots Components/Generic/Layouts/MainLayout Default 1`] = `
@@ -139,7 +187,16 @@ exports[`Storyshots Components/Generic/Layouts/MainLayout Default 1`] = `
className="flex items-center justify-center rounded-full hover:bg-opacity-60 tour-menu-button block lg:hidden"
disabled={false}
onClick={[Function]}
- />
+ >
+
+
+
@@ -28,11 +36,27 @@ exports[`Storyshots Components/Generic/Navbar Logged In 1`] = `
onMouseDown={[Function]}
type="button"
>
+
English
+
@@ -74,6 +98,14 @@ exports[`Storyshots Components/Generic/Navbar Logged In 1`] = `
@@ -110,7 +158,16 @@ exports[`Storyshots Components/Generic/Navbar Logged In 1`] = `
className="flex items-center justify-center rounded-full hover:bg-opacity-60 tour-menu-button block lg:hidden"
disabled={false}
onClick={[Function]}
- />
+ >
+
+
`;
@@ -122,6 +179,14 @@ exports[`Storyshots Components/Generic/Navbar Logged Out 1`] = `
+
@@ -143,11 +208,27 @@ exports[`Storyshots Components/Generic/Navbar Logged Out 1`] = `
onMouseDown={[Function]}
type="button"
>
+
English
+
@@ -212,6 +293,14 @@ exports[`Storyshots Components/Generic/Navbar Logged Out 1`] = `
@@ -248,7 +353,16 @@ exports[`Storyshots Components/Generic/Navbar Logged Out 1`] = `
className="flex items-center justify-center rounded-full hover:bg-opacity-60 tour-menu-button block lg:hidden"
disabled={false}
onClick={[Function]}
- />
+ >
+
+
`;
diff --git a/src/hooks/useGetCustomFormSteps/__snapshots__/useGetCustomFormSteps.stories.storyshot b/src/hooks/useGetCustomFormSteps/__snapshots__/useGetCustomFormSteps.stories.storyshot
index 5d9041557..b0167205e 100644
--- a/src/hooks/useGetCustomFormSteps/__snapshots__/useGetCustomFormSteps.stories.storyshot
+++ b/src/hooks/useGetCustomFormSteps/__snapshots__/useGetCustomFormSteps.stories.storyshot
@@ -237,6 +237,14 @@ exports[`Storyshots Components/Extensive/Form/Wizard With Get Form Step Hook 1`]
+
@@ -279,6 +287,14 @@ exports[`Storyshots Components/Extensive/Form/Wizard With Get Form Step Hook 1`]
+
@@ -385,6 +401,14 @@ exports[`Storyshots Components/Extensive/Form/Wizard With Get Form Step Hook 1`]
+
@@ -789,16 +813,25 @@ exports[`Storyshots Components/Extensive/Form/Wizard With Get Form Step Hook 1`]
+ >
+
+
- Upload File (File format: PDF max. 5MB)
+ Upload File (File format: PDF max. 10MB)
Date: Fri, 24 May 2024 10:22:42 -0700
Subject: [PATCH 07/19] [TM-929] Support framework key on nursery and nursery
report.
---
.../nurseries/components/NurseriesList.tsx | 40 ++++++++++---------
.../components/NurseryReportsList.tsx | 40 ++++++++++---------
2 files changed, 42 insertions(+), 38 deletions(-)
diff --git a/src/admin/modules/nurseries/components/NurseriesList.tsx b/src/admin/modules/nurseries/components/NurseriesList.tsx
index 0465fe5d2..17f64de3a 100644
--- a/src/admin/modules/nurseries/components/NurseriesList.tsx
+++ b/src/admin/modules/nurseries/components/NurseriesList.tsx
@@ -1,10 +1,11 @@
import { Divider, Stack, Typography } from "@mui/material";
-import { FC, useState } from "react";
+import { FC } from "react";
import {
AutocompleteInput,
Datagrid,
DateField,
EditButton,
+ FunctionField,
List,
ReferenceInput,
SearchInput,
@@ -19,15 +20,17 @@ import ListActions from "@/admin/components/Actions/ListActions";
import ExportProcessingAlert from "@/admin/components/Alerts/ExportProcessingAlert";
import CustomBulkDeleteWithConfirmButton from "@/admin/components/Buttons/CustomBulkDeleteWithConfirmButton";
import CustomDeleteWithConfirmButton from "@/admin/components/Buttons/CustomDeleteWithConfirmButton";
+import FrameworkSelectionDialog, { useFrameworkExport } from "@/admin/components/Dialogs/FrameworkSelectionDialog";
import { getCountriesOptions } from "@/constants/options/countries";
+import { useFrameworkChoices } from "@/constants/options/frameworks";
import { getChangeRequestStatusOptions, getStatusOptions } from "@/constants/options/status";
-import { fetchGetV2AdminENTITYExportFRAMEWORK } from "@/generated/apiComponents";
-import { downloadFileBlob } from "@/utils/network";
import { optionToChoices } from "@/utils/options";
import modules from "../..";
const NurseryDataGrid: FC = () => {
+ const frameworkChoices = useFrameworkChoices();
+
return (
}>
@@ -41,6 +44,15 @@ const NurseryDataGrid: FC = () => {
+
+ frameworkChoices.find((framework: any) => framework.id === record?.framework_key)?.name ??
+ record?.framework_key
+ }
+ sortable={false}
+ />
@@ -51,7 +63,7 @@ const NurseryDataGrid: FC = () => {
};
export const NurseriesList: FC = () => {
- const [exporting, setExporting] = useState(false);
+ const frameworkChoices = useFrameworkChoices();
const filters = [
,
@@ -68,6 +80,7 @@ export const NurseriesList: FC = () => {
>
,
+ ,
,
{
];
- const handleExport = () => {
- setExporting(true);
-
- fetchGetV2AdminENTITYExportFRAMEWORK({
- pathParams: {
- entity: "nurseries",
- framework: "terrafund"
- }
- })
- .then((response: any) => {
- downloadFileBlob(response, "Nurseries - terrafund.csv");
- })
- .finally(() => setExporting(false));
- };
+ const { exporting, openExportDialog, frameworkDialogProps } = useFrameworkExport("nurseries");
return (
<>
@@ -112,10 +112,12 @@ export const NurseriesList: FC = () => {
-
} filters={filters}>
+
} filters={filters}>
+
+
>
);
diff --git a/src/admin/modules/nurseryReports/components/NurseryReportsList.tsx b/src/admin/modules/nurseryReports/components/NurseryReportsList.tsx
index f4c14d185..15c08c148 100644
--- a/src/admin/modules/nurseryReports/components/NurseryReportsList.tsx
+++ b/src/admin/modules/nurseryReports/components/NurseryReportsList.tsx
@@ -1,10 +1,11 @@
import { Divider, Stack, Typography } from "@mui/material";
-import { FC, useState } from "react";
+import { FC } from "react";
import {
AutocompleteInput,
Datagrid,
DateField,
EditButton,
+ FunctionField,
List,
ReferenceInput,
SearchInput,
@@ -17,15 +18,17 @@ import {
import ListActions from "@/admin/components/Actions/ListActions";
import ExportProcessingAlert from "@/admin/components/Alerts/ExportProcessingAlert";
import CustomBulkDeleteWithConfirmButton from "@/admin/components/Buttons/CustomBulkDeleteWithConfirmButton";
+import FrameworkSelectionDialog, { useFrameworkExport } from "@/admin/components/Dialogs/FrameworkSelectionDialog";
import { getCountriesOptions } from "@/constants/options/countries";
+import { useFrameworkChoices } from "@/constants/options/frameworks";
import { getChangeRequestStatusOptions, getReportStatusOptions } from "@/constants/options/status";
-import { fetchGetV2AdminENTITYExportFRAMEWORK } from "@/generated/apiComponents";
-import { downloadFileBlob } from "@/utils/network";
import { optionToChoices } from "@/utils/options";
import modules from "../..";
const NurseryReportDataGrid: FC = () => {
+ const frameworkChoices = useFrameworkChoices();
+
return (
}>
@@ -41,6 +44,15 @@ const NurseryReportDataGrid: FC = () => {
+
+ frameworkChoices.find((framework: any) => framework.id === record?.framework_key)?.name ??
+ record?.framework_key
+ }
+ sortable={false}
+ />
@@ -48,7 +60,7 @@ const NurseryReportDataGrid: FC = () => {
};
export const NurseryReportsList: FC = () => {
- const [exporting, setExporting] = useState(false);
+ const frameworkChoices = useFrameworkChoices();
const filters = [
,
@@ -77,6 +89,7 @@ export const NurseryReportsList: FC = () => {
,
,
+ ,
,
{
/>
];
- const handleExport = () => {
- setExporting(true);
-
- fetchGetV2AdminENTITYExportFRAMEWORK({
- pathParams: {
- entity: "nursery-reports",
- framework: "terrafund"
- }
- })
- .then((response: any) => {
- downloadFileBlob(response, "Nursery Reports - terrafund.csv");
- })
- .finally(() => setExporting(false));
- };
+ const { exporting, openExportDialog, frameworkDialogProps } = useFrameworkExport("nursery-reports");
return (
<>
@@ -109,10 +109,12 @@ export const NurseryReportsList: FC = () => {
-
} filters={filters}>
+
} filters={filters}>
+
+
>
);
From e71ad72cd2fda6f15ea1cf6de4e994f184f6c5ab Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Mon, 27 May 2024 16:35:07 -0700
Subject: [PATCH 08/19] [TM-786] Handle some warnings in the codebase to help
clean up jest output.
---
.../Inputs/InputElements/InputLabel.tsx | 9 ++-
.../elements/Tabs/Default/TabButton.tsx | 72 +++++++++----------
src/components/elements/Text/Text.tsx | 9 +--
src/components/extensive/List/List.tsx | 2 +-
4 files changed, 44 insertions(+), 48 deletions(-)
diff --git a/src/components/elements/Inputs/InputElements/InputLabel.tsx b/src/components/elements/Inputs/InputElements/InputLabel.tsx
index 38e934669..3550727b8 100644
--- a/src/components/elements/Inputs/InputElements/InputLabel.tsx
+++ b/src/components/elements/Inputs/InputElements/InputLabel.tsx
@@ -1,6 +1,6 @@
import { useT } from "@transifex/react";
import classNames from "classnames";
-import { HTMLProps } from "react";
+import { forwardRef, HTMLProps, RefObject } from "react";
import { When } from "react-if";
import StatusPill from "@/components/elements/StatusPill/StatusPill";
@@ -12,7 +12,7 @@ export interface InputLabelProps extends HTMLProps {
feedbackRequired?: boolean;
}
-const InputLabel = (props: InputLabelProps) => {
+export default forwardRef(function InputLabel(props: InputLabelProps, ref) {
const t = useT();
const { feedbackRequired, required, children, className, ...labelProps } = props;
@@ -20,6 +20,7 @@ const InputLabel = (props: InputLabelProps) => {
{...labelProps}
+ ref={ref as RefObject}
as="label"
variant="text-bold-body-300"
className={classNames("mr-2 inline uppercase", className)}
@@ -34,6 +35,4 @@ const InputLabel = (props: InputLabelProps) => {
);
-};
-
-export default InputLabel;
+});
diff --git a/src/components/elements/Tabs/Default/TabButton.tsx b/src/components/elements/Tabs/Default/TabButton.tsx
index cdb96a69b..3980b1953 100644
--- a/src/components/elements/Tabs/Default/TabButton.tsx
+++ b/src/components/elements/Tabs/Default/TabButton.tsx
@@ -1,5 +1,5 @@
import classNames from "classnames";
-import { ButtonHTMLAttributes, DetailedHTMLProps } from "react";
+import { ButtonHTMLAttributes, DetailedHTMLProps, forwardRef } from "react";
import { When } from "react-if";
import Text from "@/components/elements/Text/Text";
@@ -16,40 +16,36 @@ export interface TabButtonProps extends DetailedHTMLProps {
- return (
-
-
- {item.title}
-
-
-
-
-
- );
-};
+export const TabButton = forwardRef(
+ ({ index, item, lastItem, selected, className, textVariant, ...buttonProps }: TabButtonProps, ref) => {
+ // @ts-ignore
+ buttonProps["ref"] = ref;
+ return (
+
+
+ {item.title}
+
+
+
+
+
+ );
+ }
+);
diff --git a/src/components/elements/Text/Text.tsx b/src/components/elements/Text/Text.tsx
index 1d36ee0f7..34298a0b7 100644
--- a/src/components/elements/Text/Text.tsx
+++ b/src/components/elements/Text/Text.tsx
@@ -1,6 +1,6 @@
import cn from "classnames";
import _ from "lodash";
-import { HTMLProps, ReactNode } from "react";
+import { ForwardedRef, forwardRef, HTMLProps, ReactElement, ReactNode, Ref } from "react";
import { TextVariants } from "@/types/common";
@@ -13,7 +13,7 @@ export type TextProps = HTMLProps & {
capitalize?: boolean;
};
-function Text(props: TextProps): JSX.Element {
+function Text(props: TextProps, ref: ForwardedRef): JSX.Element {
const { as: As, className, children, variant, capitalize, containHtml, ...rest } = props;
const Component = As || "p";
@@ -23,6 +23,7 @@ function Text(props: TextProps): JSX.Element {
return (
(props: TextProps): JSX.Element {
);
} else
return (
-
+
{typeof children === "string" ? _.unescape(children) : children}
);
}
-export default Text;
+export default forwardRef(Text) as (p: TextProps & { ref?: Ref }) => ReactElement;
diff --git a/src/components/extensive/List/List.tsx b/src/components/extensive/List/List.tsx
index 09bb7a9e7..3ccc82ef0 100644
--- a/src/components/extensive/List/List.tsx
+++ b/src/components/extensive/List/List.tsx
@@ -38,7 +38,7 @@ const List = , U>({
{startListElement ? {startListElement} : <>>}
{items.map((item, i, array) => (
-
+
{render(item, i, array)}
{dividerComponent}
From 3e9dd6727214668e2a3cec1e3974136a961ecb12 Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Mon, 27 May 2024 16:46:23 -0700
Subject: [PATCH 09/19] [TM-786] Set up test of github actions
---
.github/workflows/pull-request.yml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 .github/workflows/pull-request.yml
diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
new file mode 100644
index 000000000..b291ad262
--- /dev/null
+++ b/.github/workflows/pull-request.yml
@@ -0,0 +1,16 @@
+name: pull-request
+on: workflow_dispatch
+# pull_request:
+# branches: [main, staging, release/**]
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version-file: '.nvmrc'
+ - name: Install modules
+ run: yarn
+ - name: Test
+ run: yarn run jest --ci
From cb1a2a079f7faecaed187db6651a93cdc4eea8ad Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Mon, 27 May 2024 16:48:30 -0700
Subject: [PATCH 10/19] [TM-786] Add .nvmrc to match our node version on prod
---
.nvmrc | 1 +
1 file changed, 1 insertion(+)
create mode 100644 .nvmrc
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 000000000..603606bc9
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+18.17.0
From 4f549592469b1f9ad5a0c2cc07e2d4ffffa86011 Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Mon, 27 May 2024 16:51:17 -0700
Subject: [PATCH 11/19] [TM-786] Run test action on pull requests.
---
.github/workflows/pull-request.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
index b291ad262..194b0c659 100644
--- a/.github/workflows/pull-request.yml
+++ b/.github/workflows/pull-request.yml
@@ -1,7 +1,7 @@
name: pull-request
-on: workflow_dispatch
-# pull_request:
-# branches: [main, staging, release/**]
+on:
+ pull_request:
+ branches: [main, staging, release/**]
jobs:
test:
runs-on: ubuntu-latest
From 4ba0d878ddeee6d7e3607ca698e43ffcecc07086 Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Mon, 27 May 2024 21:18:54 -0700
Subject: [PATCH 12/19] [TM-786] Fix some generic typing.
---
src/components/elements/Text/Text.tsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/components/elements/Text/Text.tsx b/src/components/elements/Text/Text.tsx
index 34298a0b7..0baac7c40 100644
--- a/src/components/elements/Text/Text.tsx
+++ b/src/components/elements/Text/Text.tsx
@@ -1,6 +1,6 @@
import cn from "classnames";
import _ from "lodash";
-import { ForwardedRef, forwardRef, HTMLProps, ReactElement, ReactNode, Ref } from "react";
+import { ForwardedRef, forwardRef, HTMLProps, LegacyRef, ReactElement, ReactNode } from "react";
import { TextVariants } from "@/types/common";
@@ -13,7 +13,7 @@ export type TextProps = HTMLProps & {
capitalize?: boolean;
};
-function Text(props: TextProps, ref: ForwardedRef): JSX.Element {
+function Text(props: TextProps, ref: ForwardedRef): JSX.Element {
const { as: As, className, children, variant, capitalize, containHtml, ...rest } = props;
const Component = As || "p";
@@ -37,4 +37,4 @@ function Text(props: TextProps, ref: ForwardedRef): JSX.Element {
);
}
-export default forwardRef(Text) as (p: TextProps & { ref?: Ref }) => ReactElement;
+export default forwardRef(Text) as (p: TextProps & { ref?: LegacyRef }) => ReactElement;
From 82af91801faa16234b4f213cc058a8774e08cd9e Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Mon, 27 May 2024 21:19:23 -0700
Subject: [PATCH 13/19] [TM-786] Fix a hook dependency warning.
---
src/components/extensive/WorkdayCollapseGrid/WorkdaySection.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/extensive/WorkdayCollapseGrid/WorkdaySection.tsx b/src/components/extensive/WorkdayCollapseGrid/WorkdaySection.tsx
index 7a303c49b..db64af006 100644
--- a/src/components/extensive/WorkdayCollapseGrid/WorkdaySection.tsx
+++ b/src/components/extensive/WorkdayCollapseGrid/WorkdaySection.tsx
@@ -68,7 +68,7 @@ const WorkdaySection = ({ demographics, type, variant, onChange }: WorkdaySectio
updatedDemographics.splice(index, 1);
onChange(updatedDemographics);
},
- [demographics, onChange, type]
+ [demographics, onChange]
);
// Tailwind doesn't supply classes for high row counts, so we apply this prop ourselves.
From 9c09232b6a8ef762e7a5c302d1c3e30156521818 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 28 May 2024 22:55:45 +0000
Subject: [PATCH 14/19] chore(deps): bump pug from 3.0.2 to 3.0.3
Bumps [pug](https://github.com/pugjs/pug) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/pugjs/pug/releases)
- [Commits](https://github.com/pugjs/pug/compare/pug@3.0.2...pug@3.0.3)
---
updated-dependencies:
- dependency-name: pug
dependency-type: indirect
...
Signed-off-by: dependabot[bot]
---
yarn.lock | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/yarn.lock b/yarn.lock
index 505c07800..c18015ffc 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -12798,17 +12798,17 @@ pug-attrs@^3.0.0:
js-stringify "^1.0.2"
pug-runtime "^3.0.0"
-pug-code-gen@^3.0.2:
- version "3.0.2"
- resolved "https://registry.yarnpkg.com/pug-code-gen/-/pug-code-gen-3.0.2.tgz#ad190f4943133bf186b60b80de483100e132e2ce"
- integrity sha512-nJMhW16MbiGRiyR4miDTQMRWDgKplnHyeLvioEJYbk1RsPI3FuA3saEP8uwnTb2nTJEKBU90NFVWJBk4OU5qyg==
+pug-code-gen@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/pug-code-gen/-/pug-code-gen-3.0.3.tgz#58133178cb423fe1716aece1c1da392a75251520"
+ integrity sha512-cYQg0JW0w32Ux+XTeZnBEeuWrAY7/HNE6TWnhiHGnnRYlCgyAUPoyh9KzCMa9WhcJlJ1AtQqpEYHc+vbCzA+Aw==
dependencies:
constantinople "^4.0.1"
doctypes "^1.1.0"
js-stringify "^1.0.2"
pug-attrs "^3.0.0"
- pug-error "^2.0.0"
- pug-runtime "^3.0.0"
+ pug-error "^2.1.0"
+ pug-runtime "^3.0.1"
void-elements "^3.1.0"
with "^7.0.0"
@@ -12817,6 +12817,11 @@ pug-error@^2.0.0:
resolved "https://registry.yarnpkg.com/pug-error/-/pug-error-2.0.0.tgz#5c62173cb09c34de2a2ce04f17b8adfec74d8ca5"
integrity sha512-sjiUsi9M4RAGHktC1drQfCr5C5eriu24Lfbt4s+7SykztEOwVZtbFk1RRq0tzLxcMxMYTBR+zMQaG07J/btayQ==
+pug-error@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/pug-error/-/pug-error-2.1.0.tgz#17ea37b587b6443d4b8f148374ec27b54b406e55"
+ integrity sha512-lv7sU9e5Jk8IeUheHata6/UThZ7RK2jnaaNztxfPYUY+VxZyk/ePVaNZ/vwmH8WqGvDz3LrNYt/+gA55NDg6Pg==
+
pug-filters@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/pug-filters/-/pug-filters-4.0.0.tgz#d3e49af5ba8472e9b7a66d980e707ce9d2cc9b5e"
@@ -12879,11 +12884,11 @@ pug-walk@^2.0.0:
integrity sha512-yYELe9Q5q9IQhuvqsZNwA5hfPkMJ8u92bQLIMcsMxf/VADjNtEYptU+inlufAFYcWdHlwNfZOEnOOQrZrcyJCQ==
pug@^3.0.2:
- version "3.0.2"
- resolved "https://registry.yarnpkg.com/pug/-/pug-3.0.2.tgz#f35c7107343454e43bc27ae0ff76c731b78ea535"
- integrity sha512-bp0I/hiK1D1vChHh6EfDxtndHji55XP/ZJKwsRqrz6lRia6ZC2OZbdAymlxdVFwd1L70ebrVJw4/eZ79skrIaw==
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/pug/-/pug-3.0.3.tgz#e18324a314cd022883b1e0372b8af3a1a99f7597"
+ integrity sha512-uBi6kmc9f3SZ3PXxqcHiUZLmIXgfgWooKWXcwSGwQd2Zi5Rb0bT14+8CJjJgI8AB+nndLaNgHGrcc6bPIB665g==
dependencies:
- pug-code-gen "^3.0.2"
+ pug-code-gen "^3.0.3"
pug-filters "^4.0.0"
pug-lexer "^5.0.1"
pug-linker "^4.0.0"
From d18ae245e7518dd43664765544646d1ba6ab302a Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Wed, 29 May 2024 09:36:52 -0700
Subject: [PATCH 15/19] [TM-938] Include the self-reported numbers in the
project/site high level metrics.
---
.../components/ProjectInformationAside/HighLevelMetrics.tsx | 3 +++
.../components/SiteInformationAside/HighLevelMetrics.tsx | 3 +++
2 files changed, 6 insertions(+)
diff --git a/src/admin/components/ResourceTabs/InformationTab/components/ProjectInformationAside/HighLevelMetrics.tsx b/src/admin/components/ResourceTabs/InformationTab/components/ProjectInformationAside/HighLevelMetrics.tsx
index d7b65969d..5bb288d1d 100644
--- a/src/admin/components/ResourceTabs/InformationTab/components/ProjectInformationAside/HighLevelMetrics.tsx
+++ b/src/admin/components/ResourceTabs/InformationTab/components/ProjectInformationAside/HighLevelMetrics.tsx
@@ -29,6 +29,9 @@ const HighLevelMetics: FC = () => {
+
+
+
diff --git a/src/admin/components/ResourceTabs/InformationTab/components/SiteInformationAside/HighLevelMetrics.tsx b/src/admin/components/ResourceTabs/InformationTab/components/SiteInformationAside/HighLevelMetrics.tsx
index 6311dbeb2..551aaa8ff 100644
--- a/src/admin/components/ResourceTabs/InformationTab/components/SiteInformationAside/HighLevelMetrics.tsx
+++ b/src/admin/components/ResourceTabs/InformationTab/components/SiteInformationAside/HighLevelMetrics.tsx
@@ -27,6 +27,9 @@ const HighLevelMetics: FC = () => {
+
+
+
From 561bed4d3d0688d547579d628a45e4609155fac7 Mon Sep 17 00:00:00 2001
From: Nathan Curtis
Date: Wed, 29 May 2024 10:28:13 -0700
Subject: [PATCH 16/19] [TM-938] Update labels after product review.
---
.../ProjectInformationAside/HighLevelMetrics.tsx | 8 ++++----
.../components/SiteInformationAside/HighLevelMetrics.tsx | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/admin/components/ResourceTabs/InformationTab/components/ProjectInformationAside/HighLevelMetrics.tsx b/src/admin/components/ResourceTabs/InformationTab/components/ProjectInformationAside/HighLevelMetrics.tsx
index 5bb288d1d..ee72b1cfe 100644
--- a/src/admin/components/ResourceTabs/InformationTab/components/ProjectInformationAside/HighLevelMetrics.tsx
+++ b/src/admin/components/ResourceTabs/InformationTab/components/ProjectInformationAside/HighLevelMetrics.tsx
@@ -26,12 +26,12 @@ const HighLevelMetics: FC = () => {
-
-
-
-
+
+
+
+
diff --git a/src/admin/components/ResourceTabs/InformationTab/components/SiteInformationAside/HighLevelMetrics.tsx b/src/admin/components/ResourceTabs/InformationTab/components/SiteInformationAside/HighLevelMetrics.tsx
index 551aaa8ff..d6fa709eb 100644
--- a/src/admin/components/ResourceTabs/InformationTab/components/SiteInformationAside/HighLevelMetrics.tsx
+++ b/src/admin/components/ResourceTabs/InformationTab/components/SiteInformationAside/HighLevelMetrics.tsx
@@ -24,12 +24,12 @@ const HighLevelMetics: FC = () => {
-
-
-
-
+
+
+
+
From 0384387883877d8931415bfc436ad5ecc1e65a1c Mon Sep 17 00:00:00 2001
From: Limber Mamani Vallejos
Date: Wed, 29 May 2024 14:06:17 -0400
Subject: [PATCH 17/19] feat: TM-936 change HBF -> Harit Bharat Fund
---
src/pages/nursery/[uuid]/index.page.tsx | 2 +-
src/pages/project/[uuid]/index.page.tsx | 2 +-
src/pages/site/[uuid]/index.page.tsx | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pages/nursery/[uuid]/index.page.tsx b/src/pages/nursery/[uuid]/index.page.tsx
index 2560abd40..364552260 100644
--- a/src/pages/nursery/[uuid]/index.page.tsx
+++ b/src/pages/nursery/[uuid]/index.page.tsx
@@ -96,7 +96,7 @@ const NurseryDetailPage = () => {
nursery.framework_key === "ppc"
? t("Priceless Planet Coalition")
: nursery.framework_key === "hbf"
- ? "HBF"
+ ? "Harit Bharat Fund"
: t("TerraFund")
]}
hasBackButton={false}
diff --git a/src/pages/project/[uuid]/index.page.tsx b/src/pages/project/[uuid]/index.page.tsx
index 4b9d7bce0..8036db1b8 100644
--- a/src/pages/project/[uuid]/index.page.tsx
+++ b/src/pages/project/[uuid]/index.page.tsx
@@ -109,7 +109,7 @@ const ProjectDetailPage = () => {
isPPC
? t("Priceless Planet Coalition")
: isHBF
- ? "HBF"
+ ? "Harit Bharat Fund"
: isTerrafund
? t("TerraFund")
: reportingFramework.name
diff --git a/src/pages/site/[uuid]/index.page.tsx b/src/pages/site/[uuid]/index.page.tsx
index f6904f40c..6debfea7c 100644
--- a/src/pages/site/[uuid]/index.page.tsx
+++ b/src/pages/site/[uuid]/index.page.tsx
@@ -81,7 +81,7 @@ const SiteDetailPage = () => {
const subtitles = [
`${t("Organisation")}: ${site.organisation?.name}`,
- isPPC ? t("Priceless Planet Coalition") : isHBF ? "HBF" : t("TerraFund")
+ isPPC ? t("Priceless Planet Coalition") : isHBF ? "Harit Bharat Fund" : t("TerraFund")
];
if (isPPC) {
subtitles.push(t("Site ID: {id}", { id: site.ppc_external_id }));
From 610c8e13f6a1ddb240d34f427d1794312f40e58c Mon Sep 17 00:00:00 2001
From: Limber Mamani Vallejos
Date: Thu, 30 May 2024 10:27:20 -0400
Subject: [PATCH 18/19] feat: TM-936 change hbf -> Harit Bharat Fund to my
projects page
---
.../elements/Cards/ProjectCard/ProjectCard.tsx | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/components/elements/Cards/ProjectCard/ProjectCard.tsx b/src/components/elements/Cards/ProjectCard/ProjectCard.tsx
index 1241271b6..cfc7d0f1a 100644
--- a/src/components/elements/Cards/ProjectCard/ProjectCard.tsx
+++ b/src/components/elements/Cards/ProjectCard/ProjectCard.tsx
@@ -56,6 +56,12 @@ const ProjectCard = ({ project, onDelete, title, children, className, ...rest }:
);
};
+ const frameworkNames: { [key: string]: string } = {
+ ppc: "Priceless Planet Coalition",
+ hbf: "Harit Bharat Fund",
+ terrafund: "TerraFund"
+ };
+
return (
@@ -72,11 +78,7 @@ const ProjectCard = ({ project, onDelete, title, children, className, ...rest }:
{t("Framework")}:
- {project.framework_key === "ppc"
- ? t("Priceless Planet Coalition")
- : project.framework_key === "terrafund"
- ? t("TerraFund")
- : project.framework_key}
+ {frameworkNames[project.framework_key] ? t(frameworkNames[project.framework_key]) : project.framework_key}
From 9da6aa6e7735069b6ce35d537a812541fe38aa15 Mon Sep 17 00:00:00 2001
From: Jose Carlos Laura Ramirez
Date: Thu, 30 May 2024 12:48:18 -0400
Subject: [PATCH 19/19] [TM-938] revert: change workdays_count to
self_reported_workdays_count (#226)
---
src/pages/project/[uuid]/tabs/Overview.tsx | 6 +++++-
src/pages/site/[uuid]/tabs/Overview.tsx | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/pages/project/[uuid]/tabs/Overview.tsx b/src/pages/project/[uuid]/tabs/Overview.tsx
index a1c11230d..40556f5f4 100644
--- a/src/pages/project/[uuid]/tabs/Overview.tsx
+++ b/src/pages/project/[uuid]/tabs/Overview.tsx
@@ -52,7 +52,11 @@ const ProjectOverviewTab = ({ project }: ProjectOverviewTabProps) => {