-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic functionality of adding self service is working
- Loading branch information
Showing
7 changed files
with
346 additions
and
295 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,101 +1,105 @@ | ||
import { Typography } from "@mui/material"; | ||
import HeaderBox from "./HeaderBox"; | ||
import { Typography } from '@mui/material'; | ||
import HeaderBox from './HeaderBox'; | ||
import ScoreSection from './ScoreSection'; | ||
import Pane from './Pane'; | ||
import Section from './Section'; | ||
import { Box, Stack } from '@mui/material'; | ||
import theme from '../theme'; | ||
|
||
const getSectionData = (community, isSelectable, availableOptions, onSelectionChange) => [ | ||
{ | ||
header: 'State', | ||
cards: community.state, | ||
availableSelections: isSelectable ? availableOptions?.state || [] : [], | ||
}, | ||
{ | ||
header: 'Activities', | ||
cards: community.activities, | ||
availableSelections: isSelectable ? availableOptions?.activities || [] : [], | ||
}, | ||
{ | ||
header: 'Sectors', | ||
cards: community.sectors, | ||
availableSelections: isSelectable ? availableOptions?.sectors || [] : [], | ||
}, | ||
{ | ||
header: 'Hazards', | ||
cards: community.hazards, | ||
availableSelections: isSelectable ? availableOptions?.hazards || [] : [], | ||
}, | ||
{ | ||
header: 'Size', | ||
cards: community.size, | ||
availableSelections: isSelectable ? availableOptions?.size || [] : [], | ||
} | ||
].map((section, index) => { | ||
section.type = 'community' | ||
section.key = `section${index}` | ||
section.isSelectable = isSelectable | ||
section.onSelectionChange = onSelectionChange | ||
return section | ||
}); | ||
const getSectionData = (community, isSelectable, availableOptions, onSelectionChange) => | ||
[ | ||
{ | ||
header: 'State', | ||
cards: community.state, | ||
availableSelections: isSelectable ? availableOptions?.state || [] : [], | ||
}, | ||
{ | ||
header: 'Activities', | ||
cards: community.activities, | ||
availableSelections: isSelectable ? availableOptions?.activities || [] : [], | ||
}, | ||
{ | ||
header: 'Sectors', | ||
cards: community.sectors, | ||
availableSelections: isSelectable ? availableOptions?.sectors || [] : [], | ||
}, | ||
{ | ||
header: 'Hazards', | ||
cards: community.hazards, | ||
availableSelections: isSelectable ? availableOptions?.hazards || [] : [], | ||
}, | ||
{ | ||
header: 'Size', | ||
cards: community.size, | ||
availableSelections: isSelectable ? availableOptions?.size || [] : [], | ||
}, | ||
].map((section, index) => { | ||
section.type = 'community'; | ||
section.key = `section${index}`; | ||
section.rowToHover = `section${index}`; | ||
section.isSelectable = isSelectable; | ||
section.onSelectionChange = onSelectionChange; | ||
return section; | ||
}); | ||
|
||
export default function CommunityPane({ | ||
community, | ||
isSelectable = false, | ||
availableOptions = {}, | ||
onSelectionChange = () => {} | ||
}) { | ||
community, | ||
isSelectable = false, | ||
availableOptions = {}, | ||
onSelectionChange = () => {}, | ||
}) { | ||
const sectionData = getSectionData(community, isSelectable, availableOptions, onSelectionChange); | ||
|
||
return ( | ||
<Box | ||
<Box | ||
sx={{ | ||
bgcolor: 'primary.white', | ||
borderRadius: 4, | ||
border: `0px solid ${theme.palette.primary.white}`, | ||
pr: 1, | ||
pl: 1, | ||
pt: 0, | ||
pb: 1, | ||
}} | ||
> | ||
<Stack sx={{ width: '100%' }}> | ||
<HeaderBox> | ||
<Typography | ||
color="primary.main" | ||
fontWeight="700" | ||
align="center" | ||
variant="h5" | ||
sx={{ | ||
fontSize: { | ||
xs: '1rem', | ||
lg: '1.5rem', | ||
}, | ||
}} | ||
> | ||
{community.name} | ||
</Typography> | ||
</HeaderBox> | ||
{/* filler box to match height of "Matched Practitioners" heading */} | ||
<Box sx={{ height: '40px', width: '100%' }} /> | ||
</Stack> | ||
<Pane | ||
boxShadow={2} | ||
sx={{ pl: 1 }} | ||
> | ||
{sectionData.map((section, index) => { | ||
return Section(section); | ||
})} | ||
<ScoreSection | ||
sx={{ | ||
bgcolor: 'primary.white', | ||
borderRadius: 4, | ||
border: `0px solid ${theme.palette.primary.white}`, | ||
pr: 1, | ||
pr: 2, | ||
pl: 1, | ||
pt: 0, | ||
pb: 1, | ||
justifyContent: 'space-between', | ||
}} | ||
> | ||
<Stack sx={{ width: '100%' }}> | ||
<HeaderBox> | ||
<Typography | ||
color="primary.main" | ||
fontWeight="700" | ||
align="center" | ||
variant="h5" | ||
sx={{ | ||
fontSize: { | ||
'xs': '1rem', | ||
'lg': '1.5rem', | ||
} | ||
}} | ||
>{community.name}</Typography> | ||
</HeaderBox> | ||
{/* filler box to match height of "Matched Practitioners" heading */} | ||
<Box sx={{ height: '40px', width: '100%', }}></Box> | ||
</Stack> | ||
<Pane | ||
boxShadow={2} | ||
sx={{ pl: 1 }} | ||
> | ||
{sectionData.map((section, index) => { | ||
return Section(section) | ||
})} | ||
<ScoreSection | ||
sx={{ | ||
pr: 2, | ||
pl: 1, | ||
justifyContent: 'space-between', | ||
}} | ||
> | ||
<div>Total</div> | ||
<div>{community.totalCategories}</div> | ||
</ScoreSection> | ||
</Pane> | ||
</Box> | ||
) | ||
<div>Total</div> | ||
<div>{community.totalCategories}</div> | ||
</ScoreSection> | ||
</Pane> | ||
</Box> | ||
); | ||
} |
Oops, something went wrong.