Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RELEASE] Utltimate Ulmus #761

Merged
merged 100 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
cf703fc
[TM-1400] Organisation now has tree_species_historical
roguenet Nov 26, 2024
fa5a0bc
[TM-1493] Deploy storybook to github pages.
roguenet Nov 26, 2024
a3cddde
[TM-1493] Rebuild on all pushes to `staging`
roguenet Nov 26, 2024
604c7d1
[TM-1493] Add a link to the storybook build on the README.
roguenet Nov 26, 2024
0f8e602
[TM-1493] Start including a production build of the app in the PR checks
roguenet Nov 26, 2024
0f2f688
[TM-1512] Format numbers in dashboard popups (#710)
cesarLima1 Nov 28, 2024
c8574c2
[TM-1530] update links to terrafund MRV framework (#711)
cesarLima1 Nov 28, 2024
20bd3d8
[TM-1529] add Total legend in trees planted section (#712)
cesarLima1 Nov 28, 2024
add4066
[TM-1392] monitoring indicator implement web design (#713)
dottyy Nov 29, 2024
38234a8
[TM-1528] add cover image for projects (#714)
cesarLima1 Nov 29, 2024
82b52c5
[TM-1511] change label and fix style issues (#715)
cesarLima1 Nov 29, 2024
f8e2854
[TM-1536] add delayed job progress alert (#716)
LimberHope Dec 2, 2024
b9947dc
[TM-1509] initial satellite map (#717)
egrojMonroy Dec 2, 2024
b6b77d5
Merge pull request #707 from wri/task/TM-1493-github-storybook
roguenet Dec 2, 2024
4b8db47
[TM-1508] change projection for street map (#719)
egrojMonroy Dec 2, 2024
7d214e4
Merge pull request #720 from wri/main
roguenet Dec 2, 2024
a95a159
Merge pull request #705 from wri/feat/TM-1400-taxonomic-schema
roguenet Dec 2, 2024
3808d7f
[TM-1533] Site loading polygon review page (#718)
cesarLima1 Dec 3, 2024
746e83d
[TM-1534] add indeterminate linear loader for polygon validation data…
cesarLima1 Dec 3, 2024
2b45c64
[TM-1392] show Indicators in site and project (#723)
dottyy Dec 3, 2024
aba7591
[TM-1535] loader count polygons (#722)
egrojMonroy Dec 4, 2024
d71490b
[TM-1535] add missing word loaded to text (#725)
cesarLima1 Dec 4, 2024
eab3706
[TM-1476] WEB DESIGN: Update the tree species UI to enable users to …
dottyy Dec 4, 2024
d5ac48e
[TM-1392] remove Analyzed (#727)
dottyy Dec 4, 2024
7a8b51b
[TM-1533] indeterminate progress (#726)
dottyy Dec 4, 2024
e22b5ed
[TM-1402] Wire up the autocomplete search API.
roguenet Dec 5, 2024
f4d53dc
[TM-1402] Remove stray console log.
roguenet Dec 6, 2024
f473b77
[TM-1552] fix display of error messages (#729)
egrojMonroy Dec 9, 2024
8c22bb1
[TM-1535] add icon expand in polygons review (#728)
dottyy Dec 9, 2024
7fecc40
[TM-1402] Tune up the autocomplete search.
roguenet Dec 10, 2024
da1828f
[TM-1535] remove add polygon in polygon review (#731)
dottyy Dec 10, 2024
add66d3
Feat/tm 1535 edit position btn Expand and edit table site monitored (…
dottyy Dec 10, 2024
ffa083b
[TM-1402] Improve auto complete and tree species input UX.
roguenet Dec 10, 2024
adb0d44
[TM-1402] Cleanup some more testing UI.
roguenet Dec 10, 2024
946a71d
[TM-1402] Clear out the auto complete box when a new species is added.
roguenet Dec 11, 2024
ac65048
[TM-1531] delayed job with data (#733)
egrojMonroy Dec 11, 2024
ecd3ec4
[TM-1425] dev monitoring indicators (#730)
LimberHope Dec 11, 2024
2921b52
[TM-1402] Define an entity context for forms.
roguenet Dec 11, 2024
f04a7d5
[TM-1402] Wired up the "new" tag against the new establishment tree d…
roguenet Dec 11, 2024
9a07c46
[TM-1402] Missing parens in hover text.
roguenet Dec 12, 2024
20404f2
[TM-1402] Switch to yarn
roguenet Dec 12, 2024
f99cb19
Bump nanoid from 3.3.6 to 3.3.8
dependabot[bot] Dec 12, 2024
1bf04ff
[TM-1466] add donut chart for eco region monitored data (#736)
cesarLima1 Dec 12, 2024
015613f
[TM-1425] add loading to analysis and date of analysis (#737)
LimberHope Dec 12, 2024
c22fdd8
[TM-1402] Some cleanup on layout logic and translations.
roguenet Dec 12, 2024
86210ee
[TM-1425] Tree cover loss graph (#738)
cesarLima1 Dec 12, 2024
d5f93f9
[TM-1402] Integrate previous planting counts.
roguenet Dec 12, 2024
5740c64
[TM-1402] Run the test suite on all pull requests.
roguenet Dec 13, 2024
64584f4
[TM-1402] Don't try to set the debug method in test envs.
roguenet Dec 13, 2024
f0cae93
[TM-1402] Regenerate storyshot for tree species input.
roguenet Dec 13, 2024
63e10b4
Merge pull request #735 from wri/dependabot/npm_and_yarn/nanoid-3.3.8
roguenet Dec 13, 2024
94577ad
[TM-1467] add default value tu dropwdown analysis (#740)
LimberHope Dec 13, 2024
1a97ce7
[TM-1468] clear style monitored (#741)
dottyy Dec 13, 2024
030be0c
[TM-1559] change style in sidebar site view version dropdown (#742)
dottyy Dec 13, 2024
2250727
Merge pull request #739 from wri/feat/TM-1402-tree-species-design-int…
roguenet Dec 13, 2024
448211f
[TM-1398] Merge remote-tracking branch 'origin/staging' into epic/TM-…
roguenet Dec 13, 2024
5f2d873
[TM-1557] change style modal approved select all (#743)
dottyy Dec 13, 2024
bbc3a18
[TM-1425] reload and no data for monitored charts (#747)
cesarLima1 Dec 13, 2024
8cc7096
Merge pull request #744 from wri/epic/TM-1398-tree-species
roguenet Dec 13, 2024
699cfda
[TM-1556] Admin Views: Add info icon text (#746)
dottyy Dec 16, 2024
3c54477
[TM-1425] change icon edit in table monitored and chagen text style b…
dottyy Dec 16, 2024
aa996f2
[TM-1466] sort list of polygons (#749)
cesarLima1 Dec 16, 2024
7e879ac
[TM-1466] change format in tootltip for doughnut chart (#751)
cesarLima1 Dec 16, 2024
582a4eb
[TM-1402] Prepopulate the tree list with all species that have been p…
roguenet Dec 16, 2024
b069527
[TM-1425] text style dropdown monitored indicator (#750)
dottyy Dec 16, 2024
8022bc4
[TM-1402] Avoid displaying the previous counts column on seeding inputs.
roguenet Dec 16, 2024
f9b86f6
[TM-1402] don't use taxonomic auto complete search for seedings.
roguenet Dec 16, 2024
f4cc037
[TM-1402] If previous counts are being displayed, don't allow deletin…
roguenet Dec 16, 2024
0623131
[TM-1402] Make the min for tree species 0.
roguenet Dec 16, 2024
26b6702
[TM-1402] Update storyshot.
roguenet Dec 16, 2024
58b2999
[TM-1402] Update storyshot.
roguenet Dec 16, 2024
322b6a4
[TM-1402] Fix production build.
roguenet Dec 16, 2024
fea065d
Merge pull request #752 from wri/feat/TM-1402-prepopulate-tree-rows
roguenet Dec 17, 2024
0a7af7f
[TM-1468] minor updates in charts (#754)
cesarLima1 Dec 17, 2024
7294de1
[TM-1425] edit style text monitored sec barChart (#753)
dottyy Dec 17, 2024
36392e2
[TM-1571] Text updates to the dashboard's "learn more" page (#755)
dottyy Dec 17, 2024
1ebedd9
[TM-1467] show tooltip over the land use type chart (#756)
cesarLima1 Dec 17, 2024
efcec32
[TM-1563] Audit Log [Site, Nursery, Project Admin Views]: Extend the …
dottyy Dec 17, 2024
19b9898
[TM-1576] Update form header content for site reports.
roguenet Dec 17, 2024
f5766aa
[TM-1578] Prevent adding a species that is already on the list.
roguenet Dec 17, 2024
0d4f273
[TM-1542] remove percentage based questions warning label (#763)
pachonjcl Dec 18, 2024
5227a43
[TM-1561] Edit position sort in table (#764)
dottyy Dec 18, 2024
94605d6
Merge pull request #758 from wri/feat/TM-1576-site-report-banner
roguenet Dec 18, 2024
8f5ac93
Merge pull request #760 from wri/feat/TM-1578-duplicate-species-names
roguenet Dec 18, 2024
f9bed09
Tm 1561 site attribute table site view admin provide consistent paddi…
dottyy Dec 18, 2024
e7933ec
[TM-1580] Respect the label specified in the form builder.
roguenet Dec 18, 2024
29e71a0
Fix/tm 1425 add color tag monitored table (#768)
dottyy Dec 18, 2024
366cf90
[TM-1581] Make sure to use the collection defined in the form props.
roguenet Dec 18, 2024
46a0864
[TM-1581] formHook.watch() appears to be more reliable for getting th…
roguenet Dec 18, 2024
4182272
[TM-1531] update job result attributes (#771)
LimberHope Dec 19, 2024
63eb149
[TM-1559] edit sidebar add text nowrap (#770)
dottyy Dec 19, 2024
0a2e376
Merge pull request #767 from wri/fix/TM-1580-species-input-label
roguenet Dec 19, 2024
afd0526
Fix/tm 1561 edit width cell table (#772)
dottyy Dec 19, 2024
d2c0242
[TM-1581] Use the input collection to filter which establishment and …
roguenet Dec 19, 2024
005d5f8
[TM-1581] [TM-1582] Update column title.
roguenet Dec 19, 2024
f73b765
Merge pull request #774 from wri/fix/TM-1581-tree-collections
roguenet Dec 19, 2024
c8778e3
[TM-1562] add replanting collection and some changes (#775)
LimberHope Dec 19, 2024
0dceeb4
[TM-1531] add job service url and script (#734)
egrojMonroy Dec 19, 2024
f401c5d
[TM-1556] add text in tooltips polygon review (#776)
dottyy Dec 20, 2024
ec1104e
[TM-1562] add new field to site report view (#777)
LimberHope Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/deploy-github-storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Workflow taken from the Storybook docs: https://storybook.js.org/docs/sharing/publish-storybook#github-pages
name: Build and Publish Storybook to GitHub Pages

on:
push:
branches:
- 'staging'

permissions:
contents: read
pages: write
id-token: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20.x'

- uses: bitovi/[email protected]
with:
install_command: yarn install
build_command: yarn build-storybook
path: storybook-static
checkout: false
3 changes: 2 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: pull-request
on:
pull_request:
branches: [main, staging, release/**]
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -14,3 +13,5 @@ jobs:
run: yarn
- name: Test
run: yarn run jest --ci
- name: Build
run: NEXT_PUBLIC_TARGET_ENV=staging yarn build
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 🌲 Terramatch Web Platform 🌲

### Storybook
We host the `staging` build of Storybook on [Github Pages](https://wri.github.io/wri-terramatch-website/)

### Installation

```
Expand Down
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const userSentryWebpackPluginOptions = {
// Suppresses source map uploading logs during build
silent: true,

org: process.env.SENTRY_ORG || "3-sided-cube",
project: process.env.SENTRY_PROJECT || "wri-web-platform-version-2",
org: process.env.SENTRY_ORG ?? "wri-terramatch",
project: process.env.SENTRY_PROJECT ?? "terramatch-frontend",
authToken: process.env.SENTRY_AUTH_TOKEN
};

Expand Down
28 changes: 22 additions & 6 deletions openapi-codegen.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,40 @@ type EnvironmentName = (typeof ENVIRONMENT_NAMES)[number];
type Environment = {
apiBaseUrl: string;
userServiceUrl: string;
jobServiceUrl: string;
entityServiceUrl: string;
};

const ENVIRONMENTS: { [Property in EnvironmentName]: Environment } = {
local: {
apiBaseUrl: "http://localhost:8080",
userServiceUrl: "http://localhost:4010"
userServiceUrl: "http://localhost:4010",
jobServiceUrl: "http://localhost:4020",
entityServiceUrl: "http://localhost:4050"
},
dev: {
apiBaseUrl: "https://api-dev.terramatch.org",
userServiceUrl: "https://api-dev.terramatch.org"
userServiceUrl: "https://api-dev.terramatch.org",
jobServiceUrl: "https://api-dev.terramatch.org",
entityServiceUrl: "https://api-dev.terramatch.org"
},
test: {
apiBaseUrl: "https://api-test.terramatch.org",
userServiceUrl: "https://api-test.terramatch.org"
userServiceUrl: "https://api-test.terramatch.org",
jobServiceUrl: "https://api-test.terramatch.org",
entityServiceUrl: "https://api-test.terramatch.org"
},
staging: {
apiBaseUrl: "https://api-staging.terramatch.org",
userServiceUrl: "https://api-staging.terramatch.org"
userServiceUrl: "https://api-staging.terramatch.org",
jobServiceUrl: "https://api-staging.terramatch.org",
entityServiceUrl: "https://api-staging.terramatch.org"
},
prod: {
apiBaseUrl: "https://api.terramatch.org",
userServiceUrl: "https://api.terramatch.org"
userServiceUrl: "https://api.terramatch.org",
jobServiceUrl: "https://api.terramatch.org",
entityServiceUrl: "https://api.terramatch.org"
}
};

Expand All @@ -60,13 +72,17 @@ if (!ENVIRONMENT_NAMES.includes(declaredEnv as EnvironmentName)) {
const DEFAULTS = ENVIRONMENTS[declaredEnv];
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL ?? DEFAULTS.apiBaseUrl;
const userServiceUrl = process.env.NEXT_PUBLIC_USER_SERVICE_URL ?? DEFAULTS.userServiceUrl;
const jobServiceUrl = process.env.NEXT_PUBLIC_JOB_SERVICE_URL ?? DEFAULTS.jobServiceUrl;
const entityServiceUrl = process.env.NEXT_PUBLIC_ENTITY_SERVICE_URL ?? DEFAULTS.entityServiceUrl;

// The services defined in the v3 Node BE codebase. Although the URL path for APIs in the v3 space
// are namespaced by feature set rather than service (a service may contain multiple namespaces), we
// isolate the generated API integration by service to make it easier for a developer to find where
// the associated BE code is for a given FE API integration.
const SERVICES = {
"user-service": userServiceUrl
"user-service": userServiceUrl,
"job-service": jobServiceUrl,
"entity-service": entityServiceUrl
};

const config: Record<string, Config> = {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"generate:api": "openapi-codegen gen api",
"generate:jobService": "openapi-codegen gen jobService",
"generate:userService": "openapi-codegen gen userService",
"generate:services": "npm run generate:userService",
"generate:entityService": "openapi-codegen gen entityService",
"generate:services": "yarn generate:userService && yarn generate:entityService && yarn generate:jobService",
"tx:push": "eval $(grep '^TRANSIFEX_TOKEN' .env) && eval $(grep '^TRANSIFEX_SECRET' .env) && txjs-cli push --key-generator=hash src/ --token=$TRANSIFEX_TOKEN --secret=$TRANSIFEX_SECRET",
"tx:pull": "eval $(grep '^TRANSIFEX_TOKEN' .env) && eval $(grep '^TRANSIFEX_SECRET' .env) && txjs-cli pull --token=$TRANSIFEX_TOKEN --secret=$TRANSIFEX_SECRET"
},
Expand Down
Binary file modified public/images/graphic-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions public/images/graphic-8.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/map-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/monitoring-graph-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/monitoring-graph-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/monitoring-graph-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/monitoring-graph-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/monitoring-graph-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions src/admin/components/Alerts/DelayedJobsProgressAlert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { Alert, AlertTitle, CircularProgress } from "@mui/material";
import { FC, useEffect, useState } from "react";
import { useStore } from "react-redux";

import ApiSlice from "@/store/apiSlice";
import { AppStore } from "@/store/store";

type DelayedJobsProgressAlertProps = {
show: boolean;
title?: string;
setIsLoadingDelayedJob?: (value: boolean) => void;
};

const DelayedJobsProgressAlert: FC<DelayedJobsProgressAlertProps> = ({ show, title, setIsLoadingDelayedJob }) => {
const [delayedJobProcessing, setDelayedJobProcessing] = useState<number>(0);
const [delayedJobTotal, setDalayedJobTotal] = useState<number>(0);
const [progressMessage, setProgressMessage] = useState<string>("Running 0 out of 0 polygons (0%)");

const store = useStore<AppStore>();
useEffect(() => {
let intervalId: any;
if (show) {
intervalId = setInterval(() => {
const { total_content, processed_content, progress_message } = store.getState().api;
setDalayedJobTotal(total_content);
setDelayedJobProcessing(processed_content);
if (progress_message != "") {
setProgressMessage(progress_message);
}
}, 1000);
}

return () => {
if (intervalId) {
setDelayedJobProcessing(0);
setDalayedJobTotal(0);
setProgressMessage("Running 0 out of 0 polygons (0%)");
clearInterval(intervalId);
}
};
}, [show]);

const abortDelayedJob = () => {
ApiSlice.abortDelayedJob(true);
ApiSlice.addTotalContent(0);
ApiSlice.addProgressContent(0);
ApiSlice.addProgressMessage("Running 0 out of 0 polygons (0%)");
setDelayedJobProcessing(0);
setDalayedJobTotal(0);
setIsLoadingDelayedJob?.(false);
};

if (!show) return null;

const calculatedProgress = delayedJobTotal! > 0 ? Math.round((delayedJobProcessing! / delayedJobTotal!) * 100) : 0;

const severity = calculatedProgress >= 75 ? "success" : calculatedProgress >= 50 ? "info" : "warning";

return (
<div className="fixed bottom-5 left-0 z-50 flex w-full items-center justify-center">
<Alert
severity={severity}
icon={<CircularProgress size={18} color="inherit" />}
action={
<button
onClick={abortDelayedJob}
className="ml-2 rounded px-2 py-1 text-sm font-medium text-red-200 hover:bg-red-300"
>
Cancel
</button>
}
>
<AlertTitle>{title}</AlertTitle>
{progressMessage ?? "Running 0 out of 0 polygons (0%)"}
</Alert>
</div>
);
};

export default DelayedJobsProgressAlert;
53 changes: 28 additions & 25 deletions src/admin/components/EntityEdit/EntityEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useNavigate, useParams } from "react-router-dom";
import modules from "@/admin/modules";
import WizardForm from "@/components/extensive/WizardForm";
import LoadingContainer from "@/components/generic/Loading/LoadingContainer";
import EntityProvider from "@/context/entity.provider";
import FrameworkProvider, { Framework } from "@/context/framework.provider";
import {
GetV2FormsENTITYUUIDResponse,
Expand Down Expand Up @@ -73,31 +74,33 @@ export const EntityEdit = () => {
<div className="mx-auto w-full max-w-7xl">
<LoadingContainer loading={isLoading}>
<FrameworkProvider frameworkKey={framework}>
<WizardForm
steps={formSteps!}
errors={error}
onBackFirstStep={() => navigate("..")}
onChange={data =>
updateEntity({
pathParams: { uuid: entityUUID, entity: entityName },
body: { answers: normalizedFormData(data, formSteps!) }
})
}
formStatus={isSuccess ? "saved" : isUpdating ? "saving" : undefined}
onSubmit={() => navigate(createPath({ resource, id, type: "show" }))}
defaultValues={defaultValues}
title={title}
tabOptions={{
markDone: true,
disableFutureTabs: true
}}
summaryOptions={{
title: "Review Details",
downloadButtonText: "Download"
}}
roundedCorners
hideSaveAndCloseButton
/>
<EntityProvider entityUuid={entityUUID} entityName={entityName}>
<WizardForm
steps={formSteps!}
errors={error}
onBackFirstStep={() => navigate("..")}
onChange={data =>
updateEntity({
pathParams: { uuid: entityUUID, entity: entityName },
body: { answers: normalizedFormData(data, formSteps!) }
})
}
formStatus={isSuccess ? "saved" : isUpdating ? "saving" : undefined}
onSubmit={() => navigate(createPath({ resource, id, type: "show" }))}
defaultValues={defaultValues}
title={title}
tabOptions={{
markDone: true,
disableFutureTabs: true
}}
summaryOptions={{
title: "Review Details",
downloadButtonText: "Download"
}}
roundedCorners
hideSaveAndCloseButton
/>
</EntityProvider>
</FrameworkProvider>
</LoadingContainer>
</div>
Expand Down
18 changes: 15 additions & 3 deletions src/admin/components/Fields/CustomChipField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,36 @@ const STATUS_CLASSNAME_MAP: { [key: string]: string } = {
Approved: "bg-green-30 text-green-100",
Rejected: "bg-yellow-300 text-yellow-700",
"Under Review": "bg-yellow-300 text-yellow-700",
Submitted: "bg-blue-200 text-blue",
"Awaiting approval": "bg-blue-200 text-blue",
"Awaiting Review": "bg-blue-200 text-blue",
"Planting In Progress": "bg-yellow-300 text-yellow-700",
"Restoration in progress": "bg-green-30 text-green-100",
Draft: "bg-grey-200 text-grey-500",
Started: "bg-grey-200 text-grey-500",
Unknown: "bg-grey-200 text-grey-500",
"Needs Info": "bg-tertiary-50 text-tertiary-650",
"Needs more information": "bg-tertiary-50 text-tertiary-650",
"More info requested": "bg-tertiary-50 text-tertiary-650",
"No Update": "bg-grey-200 text-grey-500"
"No Update": "bg-grey-200 text-grey-500",
approved: "bg-green-30 text-green-100",
submitted: "bg-blue-200 text-blue",
"needs-more-information": "bg-tertiary-50 text-tertiary-650"
};

const CustomChipField = ({ label = "" }: { label: string | undefined }) => {
const CustomChipField = ({
label = "",
classNameChipField
}: {
label: string | undefined;
classNameChipField?: string;
}) => {
return (
<div
className={classNames(
"text-14 w-fit-content whitespace-nowrap rounded-[3px] px-2 capitalize",
STATUS_CLASSNAME_MAP[label] ?? "bg-grey-200 text-grey-500"
STATUS_CLASSNAME_MAP[label] ?? "bg-grey-200 text-grey-500",
classNameChipField
)}
>
{label == "Unknown" ? "Started" : label}
Expand Down
31 changes: 31 additions & 0 deletions src/admin/components/ResourceTabs/AuditLogTab/AuditLogTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -58,6 +59,10 @@ const AuditLogTab: FC<IProps> = ({ 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 = () => {
Expand Down Expand Up @@ -133,6 +138,32 @@ const AuditLogTab: FC<IProps> = ({ label, entity, ...rest }) => {
/>
</Grid>
</Grid>
<div className="px-2 py-2">
<When condition={buttonToggle === AuditLogButtonStates.PROJECT && !record?.project}>
<Text variant="text-16-bold" className="mb-6">
History and Discussion for {record && record?.name}
</Text>
{auditLogData && <AuditLogTable auditLogData={auditLogData} auditData={auditData} refresh={refetch} />}
</When>
<When condition={buttonToggle !== AuditLogButtonStates.PROJECT || verifyEntity}>
<>
<div className="mb-6">
{!isSite && !verifyEntity && <Text variant="text-16-bold">History and Discussion for {title()}</Text>}
{(isSite || verifyEntity) && (
<Text variant="text-16-bold">
History and Discussion for{" "}
<Link className="text-16-bold !text-[#000000DD]" to={redirectTo}>
{title()}
</Link>
</Text>
)}
</div>
<When condition={!!auditLogData}>
<AuditLogTable auditLogData={auditLogData!} auditData={auditData} refresh={refetch} />
</When>
</>
</When>
</div>
</TabbedShowLayout.Tab>
</When>
);
Expand Down
Loading
Loading