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

[MRXN23-529] add info to solutions report #1604

Merged
merged 3 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
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
29 changes: 25 additions & 4 deletions app/layout/scenarios/reports/solutions/resume/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,35 @@ import React from 'react';

import { useRouter } from 'next/router';

import { useProjectCostSurfaces } from 'hooks/cost-surface';
import { useProjectUsers } from 'hooks/project-users';
import { useProject } from 'hooks/projects';
import { useScenario, useScenarioPU } from 'hooks/scenarios';
import { useProjectWDPAs } from 'hooks/wdpa';

export const ResumePage = (): JSX.Element => {
const { query } = useRouter();
const { pid, sid } = query as { pid: string; sid: string };
const projectQuery = useProject(pid);
const scenarioQuery = useScenario(sid);

const costSurfaceQuery = useProjectCostSurfaces(
pid,
{},
{
select: (data) =>
data.filter((cs) => cs.scenarios.filter((s) => s.id === sid).length > 0)?.[0],
}
);

const protectedAreaQuery = useProjectWDPAs(
pid,
{ sort: 'name' },
{
select: (data) => data.map(({ id, name }) => ({ id, name })),
}
);

const projectUsersQuery = useProjectUsers(pid);
const PUDataQuery = useScenarioPU(sid);

Expand Down Expand Up @@ -40,7 +59,7 @@ export const ResumePage = (): JSX.Element => {

<div className={SECTION_CLASSES}>
<h3 className={TITLE_CLASSES}>Cost surface:</h3>
<p className={TEXT_CLASSES}>Lorem Ipsum</p>
<p className={TEXT_CLASSES}>{costSurfaceQuery.data?.name}</p>
</div>

{projectQuery.data?.planningUnitAreakm2 && (
Expand All @@ -59,19 +78,21 @@ export const ResumePage = (): JSX.Element => {

<div className={SECTION_CLASSES}>
<h3 className={TITLE_CLASSES}>Planning Unit Grid Area:</h3>
<p className={TEXT_CLASSES}>Lorem Ipsum</p>
<p className={TEXT_CLASSES}>{projectQuery.data.planningAreaName}</p>
</div>
</div>
<div>
<div className={SECTION_CLASSES}>
<h3 className={TITLE_CLASSES}>Protected Areas:</h3>
<p className={TEXT_CLASSES}>Lorem Ipsum</p>
<p className={TEXT_CLASSES}>
{protectedAreaQuery.data?.map(({ name }) => name).join(', ')}
</p>
</div>

<div className={SECTION_CLASSES}>
<h3 className={TITLE_CLASSES}>No. of planning units:</h3>
<div className="flex flex-col space-y-3">
<p className={TEXT_CLASSES}>Total: {PUDataQuery.data?.available.length}</p>
<p className={TEXT_CLASSES}>Available PU: {PUDataQuery.data?.available.length}</p>
<p className={TEXT_CLASSES}>Included PU: {PUDataQuery.data?.included.length}</p>
<p className={TEXT_CLASSES}>Excluded PU: {PUDataQuery.data?.excluded.length}</p>
</div>
Expand Down
Loading