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

fix: show correct unit type for manage projects list screen #2344

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 2 commits
Commits
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
4 changes: 3 additions & 1 deletion src/features/user/ManageProjects/ProjectsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ function SingleProject({ project }: { project: Properties }) {
Number(project.countPlanted),
1
)}{' '}
{tCommon('tree', { count: Number(project.countPlanted) })}
{project.unitType === 'm2'
? tCommon(project.unitType)
: tCommon('tree', { count: Number(project.countPlanted) })}
</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I suggest simply using something like
    tCommon(project.unitType, {formattedCount, count})
    instead of handling different unitTypes in different ways. Make sure to not affect places that use the existing translation keys - you probably need new keys.

  2. API needs to be updated to return countPlanted / areaConserved etc. for unitType = 'm2'. This should consider conservation projects as well. Discuss this with @jmiridis

  3. Show the total units value if unitType is 'trees' or 'm2'.

  4. Update the type of project to reflect the API response. Be specific about the values unitType can take.

) : (
<></>
Expand Down
Loading