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