Commit 0295bd7d authored by Andrew Hrdy's avatar Andrew Hrdy

Fixed outstanding transcompilation errors, doesn't actually run yet.

parent 0ac9e3af
Pipeline #3953 passed with stage
in 1 minute and 12 seconds
......@@ -556,6 +556,11 @@
"resolved": "https://registry.npmjs.org/@types/classnames/-/classnames-2.2.7.tgz",
"integrity": "sha512-rzOhiQ55WzAiFgXRtitP/ZUT8iVNyllEpylJ5zHzR4vArUvMB39GTk+Zon/uAM0JxEFAWnwsxC2gH8s+tZ3Myg=="
},
"@types/geojson": {
"version": "7946.0.6",
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.6.tgz",
"integrity": "sha512-f6qai3iR62QuMPPdgyH+LyiXTL2n9Rf62UniJjV7KHrbiwzLTZUKsdq0mFSTxAHbO7JvwxwC4tH0m1UnweuLrA=="
},
"@types/history": {
"version": "4.7.2",
"resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.2.tgz",
......@@ -570,6 +575,14 @@
"indefinite-observable": "^1.0.1"
}
},
"@types/mapbox-gl": {
"version": "0.51.4",
"resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-0.51.4.tgz",
"integrity": "sha512-+MqOB1O81rBKPE0mobvgfMs7FugtNnZY42y4sOHj/ljyoIiidyAQ+N27Jd5eTZ8arLAMzbxmDJ0s5oukAgZroQ==",
"requires": {
"@types/geojson": "*"
}
},
"@types/material-ui": {
"version": "0.21.6",
"resolved": "https://registry.npmjs.org/@types/material-ui/-/material-ui-0.21.6.tgz",
......@@ -584,6 +597,11 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.9.4.tgz",
"integrity": "sha512-Zl8dGvAcEmadgs1tmSPcvwzO1YRsz38bVJQvH1RvRqSR9/5n61Q1ktcDL0ht3FXWR+ZpVmXVwN1LuH4Ax23NsA=="
},
"@types/phone-formatter": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/@types/phone-formatter/-/phone-formatter-0.0.2.tgz",
"integrity": "sha1-Q50ks7w02lo7iPaTYBSgp5Oej6g="
},
"@types/prop-types": {
"version": "15.5.9",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.5.9.tgz",
......
......@@ -46,9 +46,9 @@ class CustomAppBar extends React.Component<{}, CustomAppBarState> {
<SearchBar onSearchExpand={() => this.setState({
isSearchExpanded: true
})}
onSearchCollapse={() => this.setState({
isSearchExpanded: false
})}/>
onSearchCollapse={() => this.setState({
isSearchExpanded: false
})}/>
<IconButton onClick={this.toggleExpand} aria-label="Menu"
className={classNames('app-bar-menu-button', 'app-bar-text-color')}>
<MenuIcon/>
......
import * as React from 'react';
import ReactMapboxGl, {Marker, Popup} from 'react-mapbox-gl';
import {getMaxBounds, getCenterOfCampusRegion} from '../utils/mapboxUtils';
import mapboxgl from 'mapbox-gl';
import * as mapboxgl from 'mapbox-gl';
import {removeBrackets} from '../utils/nameUtils';
import { IFacility, CampusRegion, IFacilityLocation } from '../models/facility.model';
import MenuItem from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import Select from '@material-ui/core/Select';
import FormControl from '@material-ui/core/FormControl';
import Typography from '@material-ui/core/Typography';
......
import * as React from 'react';
import classNames from 'classnames';
import { removeBrackets } from '../utils/nameUtils';
import phoneFormatter from 'phone-formatter';
import * as phoneFormatter from 'phone-formatter';
import ReactPiwik from 'react-piwik';
import { IFacility } from '../models/facility.model';
......@@ -56,7 +56,7 @@ class Sidebar extends React.Component<SidebarProps, SidebarState> {
<meta></meta>
<Paper
className={classNames(['sidebar-root', (isSidebarOpen && 'sidebar-open'), (!isSidebarOpen && 'sidebar-closed')])}>
<IconButton className={'sidebar-close-btn'} size="small" onClick={this.handleSidebarClose}>
<IconButton className={'sidebar-close-btn'} onClick={this.handleSidebarClose}>
<CloseIcon />
</IconButton>
<div className={'sidebar-row1'}>
......
......@@ -22,7 +22,7 @@ class TextwTitle extends React.Component<TextwTitleProps> {
export interface TextwTitleProps {
label: string;
content: string | Element;
content: any;
}
export default TextwTitle;
\ No newline at end of file
......@@ -126,12 +126,12 @@ interface AlertContainerState {
anchorEl: HTMLElement
}
const mapStateToProps = (state: ApplicationState): Partial<AlertContainerProps> => ({
const mapStateToProps = (state: ApplicationState) => ({
alerts: state.alerts.alerts,
viewedAlerts: state.alerts.viewedAlerts
})
const mapDispatchToProps = (dispatch: Dispatch): Partial<AlertContainerProps> => ({
const mapDispatchToProps = (dispatch: Dispatch) => ({
addViewedAlerts: (alertIds: number[]) => dispatch(addViewedAlerts(alertIds))
});
......
......@@ -160,12 +160,12 @@ export interface FacilityCardState {
modified: string;
}
const mapStateToProps = (state: ApplicationState): Partial<FacilityCardProps> => ({
const mapStateToProps = (state: ApplicationState) => ({
favorites: state.ui.favorites,
selectedFacility: state.ui.selectedFacility
});
const mapDispatchToProps = (dispatch: Dispatch): Partial<FacilityCardProps> => ({
const mapDispatchToProps = (dispatch: Dispatch) => ({
setSelectedFacility: (facility: IFacility) => dispatch(setSelectedFacility(facility)),
addFavoriteFacility: (slug: string) => dispatch(addFavoriteFacility(slug)),
removeFavoriteFacility: (slug: string) => dispatch(removeFavoriteFacility(slug)),
......
......@@ -58,7 +58,7 @@ export interface LayoutProps {
setSelectedFacility: (facility: IFacility) => any;
}
const mapStateToProps = (state: ApplicationState): Partial<LayoutProps> => ({
const mapStateToProps = (state: ApplicationState) => ({
facilities: state.facilities.facilities,
alerts: state.alerts.alerts,
favorites: state.ui.favorites,
......@@ -68,7 +68,7 @@ const mapStateToProps = (state: ApplicationState): Partial<LayoutProps> => ({
isSidebarOpen: state.ui.sidebar.isOpen
});
const mapDispatchToProps = (dispatch: Dispatch): Partial<LayoutProps> => ({
const mapDispatchToProps = (dispatch: Dispatch) => ({
fetchFacilities: () => dispatch(fetchFacilities()),
fetchAlerts: () => dispatch(fetchAlerts()),
setSidebarExpansion: (isOpen: boolean) => dispatch(setSidebarExpansion(isOpen)),
......
......@@ -41,11 +41,13 @@ class SearchBar extends React.Component<SearchBarProps, SearchBarState> {
handleRegionChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
ReactPiwik.push(['trackEvent', 'change-campus', e.target.value]);
const campusRegion = (CampusRegion as any)[e.target.value];
this.setState({
campus: e.target.value
campus: campusRegion
});
this.props.setSelectedCampusRegion(e.target.value);
this.props.setSelectedCampusRegion(campusRegion);
};
handleFocus = () => {
......@@ -140,8 +142,8 @@ class SearchBar extends React.Component<SearchBarProps, SearchBarState> {
export interface SearchBarProps {
setSearchTerm: (term: string) => any;
setSelectedCampusRegion: (region: CampusRegion) => any;
onSearchExpand: () => any;
onSearchCollapse: () => any;
onSearchExpand: () => void;
onSearchCollapse: () => void;
}
export interface SearchBarState {
......@@ -151,7 +153,7 @@ export interface SearchBarState {
campus: CampusRegion
}
const mapDispatchToProps = (dispatch: Dispatch): Partial<SearchBarProps> => ({
const mapDispatchToProps = (dispatch: Dispatch) => ({
setSearchTerm: (term: string) => dispatch(setSearchTerm(term)),
setSelectedCampusRegion: (region: CampusRegion) => dispatch(setSelectedCampusRegion(region))
});
......
declare module 'react-piwik';
\ No newline at end of file
declare module 'react-piwik';
declare var __webpack_public_path__: string;
\ No newline at end of file
import { callApi } from '../../utils/api.util';
import { call, put, takeEvery, fork, all } from 'redux-saga/effects';
import { setAlerts } from '../../actions/api';
import { AlertActionTypes } from './alert.action-types';
import { LOCAL_STORAGE_VIEWED_ALERTS_KEY } from '..';
import { setAlerts } from './alert.actions';
const API_GET_ALERTS = 'https://api.srct.gmu.edu/whatsopen/v2/alerts/?ordering=urgency_tag';
......
import { CampusRegion, IFacility } from '../../models/facility.model';
import { UiAction, UiActionTypes } from './ui.action-types';
import { LOCAL_STORAGE_FAVORITES_KEY } from '../declarations';
import { combineReducers } from 'redux';
export interface SearchBarState {
......@@ -57,18 +56,12 @@ const searchReducer = (state: SearchBarState = {searchTerm: '', campusRegion: Ca
}
}
// TODO: This is not pure, need some sort of middleware layer.
const favoritesReducer = (state: string[] = [], action: UiAction): string[] => {
let newState;
switch (action.type) {
case UiActionTypes.ADD_FAVORITE_FACILITY:
newState = [...state, action.facilitySlug];
localStorage.setItem(LOCAL_STORAGE_FAVORITES_KEY, JSON.stringify(newState))
return newState;
return [...state, action.facilitySlug];
case UiActionTypes.REMOVE_FAVORITE_FACILITY:
newState = state.filter(slug => slug !== action.facilitySlug);
localStorage.setItem(LOCAL_STORAGE_FAVORITES_KEY, JSON.stringify(newState));
return newState;
return state.filter(slug => slug !== action.facilitySlug);
default:
return state;
}
......
......@@ -14,7 +14,7 @@ module.exports = {
publicPath: paths.publicPath
},
resolve: {
extensions: ['.js', '.jsx', '.json']
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json']
},
module: {
rules: [
......
......@@ -19,7 +19,7 @@ module.exports = {
publicPath: paths.publicPath
},
resolve: {
extensions: ['.js', '.jsx', '.json']
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json']
},
module: {
rules: [
......
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