Skip to content

Commit

Permalink
[TM-1625] sort project list in dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarLima1 committed Jan 22, 2025
1 parent 64a30c8 commit a38585b
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions src/pages/dashboard/project-list/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,32 +98,34 @@ const ProjectList = () => {
const { activeProjects } = useDashboardData(filters);

const DATA_TABLE_PROJECT_LIST = activeProjects
? activeProjects?.map(
(item: {
uuid: string;
name: string;
organisation: string;
programme: string;
country_slug: string;
project_country: string;
trees_under_restoration: number;
hectares_under_restoration: number;
jobs_created: number;
}) => ({
uuid: item.uuid,
project: item?.name,
organization: item?.organisation,
programme: getFrameworkName(frameworks, item?.programme),
country: {
country_slug: item?.country_slug,
label: item?.project_country,
image: `/flags/${item?.country_slug?.toLowerCase()}.svg`
},
treesPlanted: item.trees_under_restoration.toLocaleString(),
restorationHectares: item.hectares_under_restoration.toLocaleString(),
jobsCreated: item.jobs_created.toLocaleString()
})
)
? activeProjects
.map(
(item: {
uuid: string;
name: string;
organisation: string;
programme: string;
country_slug: string;
project_country: string;
trees_under_restoration: number;
hectares_under_restoration: number;
jobs_created: number;
}) => ({
uuid: item.uuid,
project: item?.name,
organization: item?.organisation,
programme: getFrameworkName(frameworks, item?.programme),
country: {
country_slug: item?.country_slug,
label: item?.project_country,
image: `/flags/${item?.country_slug?.toLowerCase()}.svg`
},
treesPlanted: item.trees_under_restoration.toLocaleString(),
restorationHectares: item.hectares_under_restoration.toLocaleString(),
jobsCreated: item.jobs_created.toLocaleString()
})
)
.sort((a: { organization: string }, b: { organization: any }) => a.organization.localeCompare(b.organization))
: [];

return (
Expand Down

0 comments on commit a38585b

Please sign in to comment.