-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#391] Initial layout for EnterIncomeData visual
- Loading branch information
1 parent
2282fcc
commit 636d436
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 30 additions & 2 deletions
32
frontend/src/pages/cases/components/EnterIncomeDataVisual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,35 @@ | ||
import React from "react"; | ||
import React, { useMemo } from "react"; | ||
import { Card, Row, Col } from "antd"; | ||
import { CaseUIState, CurrentCaseState } from "../store"; | ||
|
||
const EnterIncomeDataVisual = () => { | ||
return <div>EnterIncomeDataVisual</div>; | ||
const { activeSegmentId } = CaseUIState.useState((s) => s.general); | ||
const currentCase = CurrentCaseState.useState((s) => s); | ||
|
||
const currentSegment = useMemo( | ||
() => | ||
currentCase.segments.find((segment) => segment.id === activeSegmentId) || | ||
null, | ||
[currentCase.segments, activeSegmentId] | ||
); | ||
|
||
if (!currentSegment) { | ||
return <div>Failed to load current segment data</div>; | ||
} | ||
|
||
return ( | ||
<Row gutter={[20, 20]}> | ||
<Col span={24}> | ||
<Card>{currentSegment.target}</Card> | ||
</Col> | ||
<Col span={24}> | ||
<Card>Household Income Bar Chart</Card> | ||
</Col> | ||
<Col span={24}> | ||
<Card>Household Income Table</Card> | ||
</Col> | ||
</Row> | ||
); | ||
}; | ||
|
||
export default EnterIncomeDataVisual; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters