Skip to content

Commit

Permalink
MapExists boolean dashboard update (#2124)
Browse files Browse the repository at this point in the history
* update map dashboard

* code smells

* add console log

* Update map exists boolean for dashboard

* remove console log

* update map exists to optional chaining

* code smells

* update imports

* add loading variable

* nest grid into projectlocation component
  • Loading branch information
djnunez-aot authored Sep 8, 2023
1 parent d59de15 commit e217261
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 35 deletions.
2 changes: 1 addition & 1 deletion met-api/tests/unit/services/test_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_create_submission(session): # pylint:disable=unused-argument

def test_create_submission_rollback(session): # pylint:disable=unused-argument
"""Assert that a submission failure will rollback changes to email verification."""
survey, eng = factory_survey_and_eng_model()
survey, _ = factory_survey_and_eng_model()
email_verification = factory_email_verification(survey.id)
participant = factory_participant_model()

Expand Down
14 changes: 5 additions & 9 deletions met-web/src/components/dashboard/EngagementsAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,11 @@ const EngagementsAccordion = ({
<Grid item xs={12} sm={!mapExists ? 6 : 4}>
<SurveysCompleted engagement={engagement} engagementIsLoading={false} />
</Grid>
<When condition={mapExists}>
<Grid item xs={12} sm={4}>
<ProjectLocation
engagement={engagement}
engagementIsLoading={false}
handleProjectMapData={handleProjectMapData}
/>
</Grid>
</When>
<ProjectLocation
engagement={engagement}
engagementIsLoading={false}
handleProjectMapData={handleProjectMapData}
/>
</Grid>
<Grid item xs={12} mt={2}>
<SubmissionTrend engagement={engagement} engagementIsLoading={false} />
Expand Down
14 changes: 5 additions & 9 deletions met-web/src/components/publicDashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,11 @@ const Dashboard = () => {
engagementIsLoading={isEngagementLoading}
/>
</Grid>
<When condition={mapExists}>
<Grid item sm={8} md={4} sx={{ width: isTablet ? '90%' : '100%' }}>
<ProjectLocation
engagement={engagement}
engagementIsLoading={isEngagementLoading}
handleProjectMapData={handleProjectMapData}
/>
</Grid>
</When>
<ProjectLocation
engagement={engagement}
engagementIsLoading={isEngagementLoading}
handleProjectMapData={handleProjectMapData}
/>
</Grid>
<Grid id={'submissiontrend'} item xs={12}>
<SubmissionTrend
Expand Down
34 changes: 18 additions & 16 deletions met-web/src/components/publicDashboard/KPI/ProjectLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,24 @@ const ProjectLocation = ({ engagement, engagementIsLoading, handleProjectMapData

return (
<>
<MetLabel mb={{ md: 0.5, lg: 2 }}>Project Location</MetLabel>
<MetPaper sx={{ textAlign: 'center' }}>
<Box
sx={{
width: '100%',
height: '280px',
}}
>
<MetMap
geojson={geoJSONDecode(data.geojson)}
latitude={data.latitude}
longitude={data.longitude}
markerLabel={data.marker_label}
/>
</Box>
</MetPaper>
<Grid item sm={8} md={4} sx={{ width: isTablet ? '90%' : '100%' }}>
<MetLabel mb={{ md: 0.5, lg: 2 }}>Project Location</MetLabel>
<MetPaper sx={{ textAlign: 'center' }}>
<Box
sx={{
width: '100%',
height: '280px',
}}
>
<MetMap
geojson={geoJSONDecode(data.geojson)}
latitude={data.latitude}
longitude={data.longitude}
markerLabel={data.marker_label}
/>
</Box>
</MetPaper>
</Grid>
</>
);
};
Expand Down

0 comments on commit e217261

Please sign in to comment.