Commit 62edab93 authored by Andrew Hrdy's avatar Andrew Hrdy

Merge dev into typescript

parents 6170ce32 0d1e3476
Pipeline #3914 passed with stage
in 1 minute and 31 seconds
# Changelog
## [2.2.2] - 2018-10-04
## [2.2.2] - 2019-01-31
### Removed
- temporarily removing label feature
### Removed
- Facility labels
### Changed
- performance improvements to facility card and favorite button
- Adheres to new alert schema in API v2.2
## [2.2.1] - 2018-09-18
......@@ -14,8 +16,6 @@
- Matomo Events API
### Removed
### Changed
- FacilityMap update code for better map performance
......@@ -118,4 +118,6 @@
[2.1.2]: https://git.gmu.edu/srct/whats-open-web/compare/v2.1.1...v2.1.2
[2.1.3]: https://git.gmu.edu/srct/whats-open-web/compare/v2.1.2...v2.1.3
[2.1.4]: https://git.gmu.edu/srct/whats-open-web/compare/v2.1.3...v2.1.4
[2.2.0]: https://git.gmu.edu/srct/whats-open-web/compare/v2.1.4...v2.2.0
\ No newline at end of file
[2.2.0]: https://git.gmu.edu/srct/whats-open-web/compare/v2.1.4...v2.2.0
[2.2.1]: https://git.gmu.edu/srct/whats-open-web/compare/v2.2.0...v2.2.1
[2.2.2]: https://git.gmu.edu/srct/whats-open-web/compare/v2.2.1...v2.2.2
\ No newline at end of file
......@@ -4141,9 +4141,9 @@
}
},
"earcut": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.1.3.tgz",
"integrity": "sha512-AxdCdWUk1zzK/NuZ7e1ljj6IGC+VAdC3Qb7QQDsXpfNrc5IM8tL9nNXUmEGE6jRHTfZ10zhzRhtDmWVsR5pd3A=="
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.1.4.tgz",
"integrity": "sha512-ttRjmPD5oaTtXOoxhFp9aZvMB14kBjapYaiBuzBB1elOgSLU9P2Ev86G2OClBg+uspUXERsIzXKpUWweH2K4Xg=="
},
"ecc-jsbn": {
"version": "0.1.1",
......@@ -6325,9 +6325,9 @@
"dev": true
},
"grid-index": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.0.0.tgz",
"integrity": "sha1-rSxdVM5bNUN/r/HXCprrPR0mERA="
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.1.0.tgz",
"integrity": "sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA=="
},
"grouped-queue": {
"version": "0.3.3",
......
......@@ -2,6 +2,8 @@ import React from 'react';
import classNames from 'classnames';
import {findLink} from '../utils/nameUtils';
import Chip from '@material-ui/core/Chip';
import Button from '@material-ui/core/Button';
import ArrowForwardIcon from '@material-ui/icons/ArrowForward';
const Alert = ({alert}) => {
const getUrgencyClass = () => {
......@@ -18,19 +20,33 @@ const Alert = ({alert}) => {
}
};
const getMessage = () => {
const links = findLink(alert.message);
const getBody = () => {
/*
API V2.2 removed the message field and replaced it with
subject and body. In order to ensure backwards compatability,
use the message field if it exists, otherwise use body.
TODO: Eventually, this check will be useless when older alerts
are phased out and should be removed to minimize complexity.
Alternatively, move this into the mapper once TypeScript is added.
*/
const body = alert.message ? alert.message : alert.body;
const links = findLink(body);
if (!links) {
return (<span className={'alert-message'}>
{alert.message}
</span>);
return (
<span className={'alert-body'}>
{body}
</span>
);
}
return (
<span className={'alert-message'}>
{alert.message.substring(0, links.index)}
<span className={'alert-body'}>
{body.substring(0, links.index)}
<a href={links[0]} className={'alert-link'} target="_blank" rel="noopener noreferrer">{links[0]}</a>
{alert.message.substring(links.index + links[0].length)}
{body.substring(links.index + links[0].length)}
</span>
);
};
......@@ -39,8 +55,24 @@ const Alert = ({alert}) => {
return (
<div className={'alert'}>
{getMessage()}
<Chip label={getChipLabel()} className={classNames('alert-urgency-chip', getUrgencyClass())}/>
<div className={'alert-subject-container'}>
<h3 className={'alert-subject'}>{alert.subject}</h3>
<Chip label={getChipLabel()} className={classNames('alert-urgency-chip', getUrgencyClass())} />
</div>
{getBody()}
{
alert.url &&
<span className={'alert-url-container'}>
<Button size={'small'} href={alert.url} target="_blank" rel="noopener noreferrer" classes={{
root: 'alert-url-button-root'
}}>
More Information
<ArrowForwardIcon />
</Button>
</span>
}
</div>
);
};
......
import React from 'react';
import Dialog from '@material-ui/core/Dialog';
import Grid from '@material-ui/core/Grid';
import FacilityLabels from './FacilityLabels';
import WeekHours from './WeekHours';
import Button from '@material-ui/core/Button';
import Avatar from '@material-ui/core/Avatar';
......@@ -64,10 +63,6 @@ class FacilityDialog extends React.Component {
</Typography>
</Grid>
<Grid item className={'fd-facility-labels'}>
<FacilityLabels facility={facility} />
</Grid>
<Grid item className={'fd-week-hours'}>
<WeekHours facility={facility} />
</Grid>
......
import React from 'react';
import Chip from '@material-ui/core/Chip';
const FacilityLabels = ({facility}) => {
return (
<div className={'label-chip-holder'}>
{facility.facility_labels && facility.facility_labels.map((label) =>
<Chip className={'label-chip'} key={label} label={label} />
)}
</div>
);
};
export default FacilityLabels;
\ No newline at end of file
......@@ -70,9 +70,6 @@ class Sidebar extends React.Component {
content={facility.facility_location && facility.facility_location.address} />
<TextwTitle label="Phone Number"
content={facility.phone_number ? phoneFormatter.format(facility.phone_number, '(NNN) NNN-NNNN') : 'Unknown'} />
{
//<TextwTitle label="Labels" content={<FacilityLabels facility={facility} />} />
}
<TextwTitle label="Hours" content={<WeekHours facility={facility} />} />
</div>
</div>
......
......@@ -49,6 +49,7 @@ class AlertContainer extends React.Component {
render() {
const {alerts} = this.props;
const activeAlerts = alerts.filter(this.isAlertActive);
return (
<div>
<IconButton classes={{
......
......@@ -2,7 +2,7 @@
padding: 8px 16px;
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
font-size: 0.875rem;
font-weight: 400;
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
......@@ -16,10 +16,21 @@
}
}
.alert-message {
.alert-subject-container {
display: flex;
flex-wrap: wrap;
margin-right: 10px;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 5px;
}
.alert-subject {
margin: 0;
}
.alert-body {
display: inline;
}
.alert-urgency-chip {
......@@ -29,6 +40,14 @@
color: white !important;
}
.alert-url-container {
width: 100%;
}
.alert-url-button-root {
padding: 0 !important;
min-height: 24px !important;
}
.alert-link {
color: #0645AD;
......
......@@ -60,12 +60,6 @@
align-items: center;
}
.fd-facility-labels {
@extend .fd-small-grid;
width: 100%;
}
.fd-week-hours {
@extend .fd-small-grid;
......
@import '../variables';
.label-chip-holder {
display: flex;
flex-wrap: wrap;
}
.label-chip {
height: 24px !important;
margin: 2px;
}
@media screen and (max-width: map-get($breakpoints, lg) - 1px) {
.label-chip-holder {
justify-content: center;
}
}
\ No newline at end of file
......@@ -8,7 +8,6 @@
@import './components/facilityCategory';
@import './components/facilityDialog';
@import './components/facilityStatus';
@import './components/facilityLabels';
@import './components/favoriteButton';
@import './components/mapDialog';
@import './components/sidebar';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment