Skip to content

Commit

Permalink
[#391] Create visuals component
Browse files Browse the repository at this point in the history
  • Loading branch information
wayangalihpratama committed Jan 16, 2025
1 parent 075992e commit ec0f783
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 27 deletions.
2 changes: 1 addition & 1 deletion frontend/src/pages/cases/Case.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
AssessImpactMitigationStrategies,
ClosingGap,
} from "./steps";
import { EnterIncomeDataVisual } from "./components";
import { EnterIncomeDataVisual } from "./visuals";
import "./steps/steps.scss";
import { isEmpty } from "lodash";

Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/cases/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ export { default as CaseFilter } from "./CaseFilter";
export { default as CaseSettings } from "./CaseSettings";
export { default as SegmentForm } from "./SegmentForm";
export { default as CaseForm } from "./CaseForm";
export { default as EnterIncomeDataVisual } from "./EnterIncomeDataVisual";
export { default as EnterIncomeDataForm } from "./EnterIncomeDataForm";
export { default as VisualCardWrapper } from "./VisualCardWrapper";
36 changes: 12 additions & 24 deletions frontend/src/pages/cases/steps/UnderstandIncomeGap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import React, { useCallback, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { stepPath, CurrentCaseState } from "../store";
import { Row, Col, Card, Space } from "antd";
import { VisualCardWrapper } from "../components";
import {
ChartIncomeGap,
CompareIncomeGap,
ChartIncomeDriverAcrossSegments,
} from "../visuals";

/**
* STEP 3
Expand Down Expand Up @@ -48,29 +52,13 @@ const UnderstandIncomeGap = ({ setbackfunction, setnextfunction }) => {
</Col>
{/* Chart */}
<Col span={24}>
<Card className="card-visual-wrapper">
<Row gutter={[20, 20]} align="middle">
<Col span={16}>
<VisualCardWrapper title="Income gap" bordered>
Chart
</VisualCardWrapper>
</Col>
<Col span={8}>
<Space direction="vertical">
<div className="section-title">
What is the current income of the farmers and their income
gap?
</div>
<div className="section-description">
This graph helps you explore the composition of household
income and identify the gap between current income and the
income target. Use it to uncover variations across segments
and consider where tailored strategies might be needed.
</div>
</Space>
</Col>
</Row>
</Card>
<ChartIncomeGap />
</Col>
<Col span={24}>
<CompareIncomeGap />
</Col>
<Col span={24}>
<ChartIncomeDriverAcrossSegments />
</Col>
{/* EOL Chart */}
</Row>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/pages/cases/steps/steps.scss
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@
}

#understand-income-gap {
margin-bottom: 100px;

.header-wrapper {
.title {
color: #01625f;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from "react";
import { Card, Col, Row, Space } from "antd";
import { VisualCardWrapper } from "../components";

const ChartIncomeDriverAcrossSegments = () => {
return (
<Card className="card-visual-wrapper">
<Row gutter={[20, 20]} align="middle">
<Col span={16}>
<VisualCardWrapper title="Income drivers across segments" bordered>
Chart
</VisualCardWrapper>
</Col>
<Col span={8}>
<Space direction="vertical">
<div className="section-title">Explore your income drivers</div>
<div className="section-description">
This graph lets you explore and compare income drivers across
segments, showing their current values and the gaps to feasible
levels. It helps you spot differences and identify where progress
is possible.
</div>
</Space>
</Col>
</Row>
</Card>
);
};

export default ChartIncomeDriverAcrossSegments;
32 changes: 32 additions & 0 deletions frontend/src/pages/cases/visuals/ChartIncomeGap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import { Card, Col, Row, Space } from "antd";
import { VisualCardWrapper } from "../components";

const ChartIncomeGap = () => {
return (
<Card className="card-visual-wrapper">
<Row gutter={[20, 20]} align="middle">
<Col span={16}>
<VisualCardWrapper title="Income gap" bordered>
Chart
</VisualCardWrapper>
</Col>
<Col span={8}>
<Space direction="vertical">
<div className="section-title">
What is the current income of the farmers and their income gap?
</div>
<div className="section-description">
This graph helps you explore the composition of household income
and identify the gap between current income and the income target.
Use it to uncover variations across segments and consider where
tailored strategies might be needed.
</div>
</Space>
</Col>
</Row>
</Card>
);
};

export default ChartIncomeGap;
29 changes: 29 additions & 0 deletions frontend/src/pages/cases/visuals/CompareIncomeGap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react";
import { Card, Col, Row, Space, Table } from "antd";

const CompareIncomeGap = () => {
return (
<Card className="card-visual-wrapper">
<Row gutter={[20, 20]} align="middle">
<Col span={8}>
<Space direction="vertical">
<div className="section-title">
Compare the income gap per segment with the number of farmers each
segment represents.
</div>
<div className="section-description">
This table gives an overview of the number of farmers in each
segment, and the income gap at current and feasible levels. Use it
to determine focus segments.
</div>
</Space>
</Col>
<Col span={16}>
<Table columns={[]} dataSource={[]} />
</Col>
</Row>
</Card>
);
};

export default CompareIncomeGap;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useMemo } from "react";
import { Card, Row, Col, Space, Tag } from "antd";
import { CaseUIState, CurrentCaseState, CaseVisualState } from "../store";
import { thousandFormatter } from "../../../components/chart/options/common";
import { VisualCardWrapper } from ".";
import { VisualCardWrapper } from "../components";
import Chart from "../../../components/chart";

const EnterIncomeDataVisual = () => {
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/pages/cases/visuals/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as EnterIncomeDataVisual } from "./EnterIncomeDataVisual";
export { default as ChartIncomeGap } from "./ChartIncomeGap";
export { default as CompareIncomeGap } from "./CompareIncomeGap";
export { default as ChartIncomeDriverAcrossSegments } from "./ChartIncomeDriverAcrossSegments";

0 comments on commit ec0f783

Please sign in to comment.