Commit bb8dd2d9 authored by Zachary Seguin's avatar Zachary Seguin
Browse files

Updates

parent 5f1394ff
......@@ -46,9 +46,9 @@ class App extends Component {
<Route exact path='/' render={() => <Redirect to="/active" />} />
<Route path='/active' component={Active} />
<Route path='/search' component={Search} />
<Route path='/alert/:id' component={Alert} />
<Route path='/alerts/:id' component={Alert} />
</Switch>
{ isModal ? <Route path="/alert/:id" component={Alert.Modal} /> : null}
{ isModal ? <Route path="/alerts/:id" component={Alert.Modal} /> : null}
</Grid.Column>
</Grid.Row>
<Grid.Row>
......
......@@ -88,6 +88,7 @@ class AlertsLocalized extends Component {
<FetchAlerts loaded={(success, results) => this.loaded(success, results)}
searchId={this.state.time.toISOString()}
params={{
count: 100,
superseded: false,
language: 'en-CA',
sort: '-effective',
......@@ -155,6 +156,7 @@ class ActiveAll extends Component {
<FetchAlerts loaded={(success, results) => this.loaded(success, results)}
searchId={this.state.time.toISOString()}
params={{
count: 100,
superseded: false,
language: 'en-CA',
sort: '-effective',
......
......@@ -85,7 +85,7 @@ class Alert extends Component {
const aid = id[0];
const iid = parseInt(id[1], 10)
fetch(URI(`https://api.alerts.zacharyseguin.ca/alerts/${aid}`)
fetch(URI(`/api/alerts/${aid}`)
.toString())
.then(res => res.json(), err => {
var state = this.state;
......@@ -198,9 +198,9 @@ class Alert extends Component {
{info.resources.map(res => {
var resourceUri = res.digest
? URI(res.digest.toLowerCase()).suffix(URI(res.uri).suffix().toLowerCase())
.absoluteTo(URI("https://www2.csclub.uwaterloo.ca/~ztseguin/alerts/resources/"))
.absoluteTo(URI("https://zsalerts.blob.core.windows.net/resources/"))
: URI(URI(res.uri).filename().toLowerCase())
.absoluteTo(URI("https://www2.csclub.uwaterloo.ca/~ztseguin/alerts/resources/"));
.absoluteTo(URI("https://zsalerts.blob.core.windows.net/resources/"));
return (
<List.Item key={resourceUri}>
......@@ -256,4 +256,4 @@ class AlertModal extends Component {
Alert.Modal = withRouter(AlertModal);
export default withRouter(Alert);
\ No newline at end of file
export default withRouter(Alert);
......@@ -5,7 +5,7 @@ import { Card, Grid, Header, Label } from 'semantic-ui-react';
import Moment from 'react-moment';
import 'moment-timezone';
import Pluralize from 'react-pluralize';
import { Link } from 'react-router-dom';
import { Link } from 'react-router-dom';
import Alert from './Alert';
......@@ -32,7 +32,7 @@ class AlertListItem extends Component {
return (
<Link className="alert" to={{
pathname: `/alert/${this.props.hit.id}`,
pathname: `/alerts/${this.props.hit.id}`,
state: { modal: true, hit: this.props.hit },
}}>
<Card fluid>
......@@ -67,7 +67,7 @@ class AlertListItem extends Component {
Issued by {info.senderName}
<br />
<Moment format="lll">{info.effective || alert.sent}</Moment> to <Moment format="lll">{info.expires}</Moment>
<div className="areas">
{info.areas.map((a, i) => {
a.hit = (this.props.hit.area_hits || []).indexOf(i) !== -1;
......
......@@ -14,7 +14,7 @@ class AlertsMap extends Component {
lineWidth: 2,
lineJoin: "round"
});
renderOverlays(props) {
// Remove current overlays
this._map.removeOverlays(this._map.overlays);
......@@ -41,7 +41,7 @@ class AlertsMap extends Component {
});
})
var overlay = new window.mapkit.PolygonOverlay(points, {
var overlay = new window.mapkit.PolygonOverlay(points, {
style: this.areaStyle,
data: hit
});
......@@ -82,7 +82,7 @@ class AlertsMap extends Component {
if (e.overlay) {
this.props.history.push({
pathname: `/alert/${e.overlay.data.id}`,
pathname: `/alerts/${e.overlay.data.id}`,
state: { modal: true, hit: e.overlay.data }
});
}
......
......@@ -49,7 +49,7 @@ class FetchAlerts extends Component {
state.errors = [];
this.setState(state);
fetch(URI('https://api.alerts.zacharyseguin.ca/alerts')
fetch(URI('/api/alerts')
.search(params || {}).toString())
.then(res => {
return res.json();
......@@ -102,10 +102,10 @@ class FetchAlerts extends Component {
})}
</Container>
{this.state.result && this.state.result.total > (this.props.params.size || 10) ? (
{this.state.result && this.state.result.total > (this.props.params.count || 10) ? (
<Container className="paginator">
<Pagination offset={this.props.params.start || 0}
limit={this.props.params.size || 10}
limit={this.props.params.count || 10}
total={Math.min(parseInt(this.state.result.total, 10), 10000)} onClick={(e, props, offset) => {
this.updateValue('start', offset);
}} />
......
......@@ -14,10 +14,6 @@ import './AppFooter.css';
const AppFooter = () => (
<Container as="footer" className="app-footer">
<Container as="p" textAlign="center">
Visit the <a href="https://legacy.alerts.zacharyseguin.ca">Legacy Alerts Canada System</a>.
</Container>
<Container as="p" textAlign="center">
Copyright &copy; 2018 &mdash; <a href="https://zacharyseguin.ca">Zachary Seguin</a>
<br />
......@@ -26,4 +22,4 @@ const AppFooter = () => (
</Container>
)
export default AppFooter;
\ No newline at end of file
export default AppFooter;
Supports Markdown
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