Skip to content

Commit b03c697

Browse files
authored
Merge pull request #1906 from DorianDeptuch/update-styling-of-service-request-details-modal-1870
Update styling of service request details modal 1870
2 parents 073a806 + 4deec8a commit b03c697

File tree

3 files changed

+102
-53
lines changed

3 files changed

+102
-53
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ stats.json
2929
docker/
3030
venv/
3131
.vscode
32+
.prettierignore
3233

3334
# socrata experimental files
3435
*-socrata*
@@ -39,4 +40,5 @@ venv/
3940
# archive
4041
/archive/aws/API\ Responses/*
4142

42-
.DS_Store
43+
.DS_Store
44+

components/Map/Map.jsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const styles = (theme) => ({
8181
marginRight: 5,
8282
},
8383
'& .mapboxgl-popup': {
84+
maxWidth: '474px!important',
8485
'&-anchor-bottom .mapboxgl-popup-tip': {
8586
borderTopColor: theme.palette.primary.main,
8687
},
@@ -95,6 +96,11 @@ const styles = (theme) => ({
9596
},
9697
},
9798
},
99+
loadedModal: {
100+
'& .mapboxgl-popup-content': {
101+
borderRadius: 30,
102+
},
103+
},
98104
menuWrapper: {
99105
position: 'absolute',
100106
left: '20px',
@@ -422,7 +428,7 @@ class Map extends React.Component {
422428

423429
addPopup = (coordinates, requestId) => {
424430
this.setState({ selectedRequestId: requestId });
425-
this.popup = new mapboxgl.Popup()
431+
this.popup = new mapboxgl.Popup({closeButton: false, anchor: 'left'})
426432
.setLngLat(coordinates)
427433
.setDOMContent(this.requestDetail)
428434
.addTo(this.map);
@@ -762,6 +768,12 @@ class Map extends React.Component {
762768
this.setState({ filteredRequestCounts: counts });
763769
};
764770

771+
setRequestDetailLoading = (isLoading) => {
772+
if (!isLoading && this.popup) {
773+
this.popup.addClassName(this.props.classes.loadedModal);
774+
}
775+
};
776+
765777
//// RENDER ////
766778

767779
render() {
@@ -822,7 +834,10 @@ class Map extends React.Component {
822834
boundaryStyle={mapStyle === 'dark' ? 'light' : 'dark'}
823835
/>
824836
<div ref={(el) => (this.requestDetail = el)}>
825-
<RequestDetail requestId={selectedRequestId} />
837+
<RequestDetail
838+
requestId={selectedRequestId}
839+
loadingCallback={this.setRequestDetailLoading}
840+
/>
826841
</div>
827842
{this.state.mapReady && requestTypes && (
828843
<>

components/Map/RequestDetail.jsx

Lines changed: 82 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,63 @@ const styles = theme => ({
2828
backgroundColor: theme.palette.primary.main,
2929
padding: '0 8',
3030
width: '100%',
31+
marginBottom: '64px',
3132
},
3233
requestType: {
3334
...theme.typography.h5,
3435
marginRight: 5,
36+
fontFamily: 'Roboto',
37+
fontWeight: 700,
38+
fontSize: '40px',
39+
},
40+
sectionHeader: {
41+
fontFamily: 'Roboto',
42+
fontWeight: 'normal',
43+
fontSize: '24px',
44+
marginTop: '0px',
45+
marginBottom: '5px'
46+
},
47+
detailsStyles: {
48+
fontFamily: 'Roboto',
49+
fontWeight: 200,
50+
fontSize: '16px',
51+
color: '#FFFFFF',
52+
paddingLeft: '18px',
53+
marginTop: '0px',
54+
marginBottom: '10px'
3555
},
3656
icon: {
3757
display: 'block',
3858
},
3959
divider: {
4060
marginTop: 6,
41-
marginBottom: 8,
61+
marginBottom: 30,
62+
marginLeft: '22px',
63+
marginRight: '22px',
64+
backgroundColor: '#000000'
4265
},
43-
info1: {
44-
...theme.typography.body1,
45-
marginTop: 0,
46-
marginBottom: 0,
66+
serviceRequestFieldNameValue: {
67+
fontFamily: 'Roboto',
68+
fontWeight: 600,
69+
fontSize: '16px',
4770
},
48-
councilName: {
49-
color: '#A8A8A8',
50-
marginTop: 5,
71+
reportedAndClosedStatus: {
72+
fontFamily: 'Roboto',
73+
fontWeight: 200,
74+
fontSize: '14px',
75+
color: '#FFB104',
76+
},
77+
sourceAndAgency: {
78+
fontFamily: 'Roboto',
79+
fontWeight: 100,
80+
fontSize: '10px',
81+
color: '#FFFFFF'
5182
},
5283
info2: {
5384
marginTop: 14,
85+
marginLeft: '22px',
86+
marginRight: '22px',
87+
width: '411px',
5488
},
5589
});
5690

@@ -64,6 +98,7 @@ function RequestDetail({
6498
dispatchUpdatePinInfo,
6599
startDate,
66100
endDate,
101+
loadingCallback,
67102
}) {
68103
const { conn } = useContext(DbContext);
69104
const getPinInfo = useCallback(async () => {
@@ -116,6 +151,13 @@ function RequestDetail({
116151
fetchPins();
117152
}, [requestId, getPinInfo]);
118153

154+
useEffect(() => {
155+
const isLoading = isEmpty(pinsInfo);
156+
if (loadingCallback) {
157+
loadingCallback(isLoading);
158+
}
159+
}, [pinsInfo, loadingCallback]);
160+
119161
const renderDaysOpen = days => {
120162
switch (days) {
121163
case 0:
@@ -167,71 +209,61 @@ function RequestDetail({
167209

168210
return (
169211
<div className={classes.popupContent}>
170-
<Grid container direction="row" justifyContent="flex-start" alignItems="center">
171-
<Grid className={classes.requestType} item>
172-
{formattedTypeName}
173-
</Grid>
174-
<Grid item>
175-
<FiberManualRecordIcon
176-
className={classes.icon}
177-
style={{
178-
color,
179-
fontSize: 16,
180-
}}
181-
/>
182-
</Grid>
212+
<Grid container direction="row" justifyContent="center" alignItems="center" style={{marginTop: '19px'}}>
213+
<FiberManualRecordIcon
214+
className={classes.icon}
215+
style={{
216+
color,
217+
fontSize: 27,
218+
marginRight: '12px',
219+
}}
220+
/>
221+
<Grid className={classes.requestType} style={{fontSize: '40px'}} item>
222+
{formattedTypeName}
223+
</Grid>
183224
</Grid>
184225
<Divider className={classes.divider} />
185-
<p className={classes.info1}>{toTitleCase(address)}</p>
186-
<p className={classes.councilName}>{councilName}</p>
226+
<div style={{marginLeft: '22px'}}>
227+
<p className={classes.sectionHeader}>Location:</p>
228+
<p className={classes.detailsStyles}>{toTitleCase(address)}</p>
229+
<p className={classes.sectionHeader}>Neighborhood Council:</p>
230+
<p className={classes.detailsStyles} style={{marginBottom: '29px'}}>{councilName}</p>
231+
</div>
187232
<Grid
188233
className={classes.info2}
189234
container
190235
direction="row"
191236
justifyContent="space-between"
192237
alignItems="flex-start"
193238
>
194-
<Grid item xs={6}>
239+
<Grid className={classes.serviceRequestFieldNameValue} style={{ textDecoration: 'underline', marginBottom: '31px' }} item xs={4}>
195240
Service request:
196241
</Grid>
197-
<Grid item xs={6} style={{ textAlign: 'right' }}>
198-
{srnumber}
199-
</Grid>
200-
<Grid item xs={6}>
201-
Reported on:
242+
<Grid className={classes.serviceRequestFieldNameValue} style={{ textAlign: 'right' }} item xs={4}>
243+
#&nbsp;{srnumber}
202244
</Grid>
203-
<Grid item xs={6} style={{ textAlign: 'right' }}>
204-
{moment(createdDate).format('l')}
245+
<Grid className={classes.reportedAndClosedStatus} style={{marginBottom: '15px'}} item xs={12} >
246+
Reported: {moment(createdDate).format('l')}
205247
</Grid>
206248
{closedDate ? (
207249
<>
208-
<Grid item xs={6}>
209-
Closed on:
210-
</Grid>
211-
<Grid item xs={6} style={{ textAlign: 'right' }}>
212-
{moment(closedDate).format('l')}
250+
<Grid className={classes.reportedAndClosedStatus} style={{marginBottom: '75px'}} item xs={12}>
251+
Closed: {moment(closedDate).format('l')}
213252
</Grid>
214253
</>
215254
) : (
216255
<>
217-
<Grid item xs={6}>
218-
Status:
219-
</Grid>
220-
<Grid item xs={6} style={{ textAlign: 'right' }}>
221-
{`Open (${renderDaysOpen(daysOpen)})`}
256+
<Grid className={classes.reportedAndClosedStatus} style={{marginBottom: '75px'}} item xs={12}>
257+
Status: {`Open (${renderDaysOpen(daysOpen)})`}
222258
</Grid>
223259
</>
224260
)}
225-
<Grid item xs={6}>
226-
Source:
227-
</Grid>
228-
<Grid item xs={6} style={{ textAlign: 'right' }}>
229-
{sourceName}
230-
</Grid>
231-
<Grid item xs={3}>
232-
Agency:
261+
262+
<Grid item xs={4}>
263+
Source: {sourceName}
233264
</Grid>
234-
<Grid item xs={9} style={{ textAlign: 'right' }}>
265+
<Grid item xs={4} style={{ textAlign: 'right' }}>
266+
Agency:&nbsp;
235267
<Link
236268
href={website}
237269
aria-label={`${agencyName} website`}

0 commit comments

Comments
 (0)