declare var require ; declare var module ; import MuiThemeProvider from '@material-ui/core/styles/MuiThemeProvider' ; import * as React from 'react' ; import * as ReactDOM from 'react-dom' ; import { Provider } from 'react-redux' ; import * as Redux from 'redux' ; import theme from 'shared/Theme' ; import { downloadCards } from './actions/Cards' ; import { loadFiltersFromUrl } from './actions/Filters' ; import { getStore } from './Store' ; export type ThunkAction < R , S = { } , E = { } , A extends Redux . Action < any > = Redux . AnyAction > = ( dispatch : Redux . Dispatch < A > , getState : ( ) => S , extraArgument : E ) => R ; declare module 'redux' { export interface Dispatch < A extends Redux . Action < any > = Redux . AnyAction > { < R , E > ( asyncAction ) : R ; } } const store = getStore ( ) ; store . dispatch ( loadFiltersFromUrl ( ) ) ; store . dispatch ( downloadCards ( store . getState ( ) . filters . source . current ) ) ; window . addEventListener ( 'keydown' , ( event ) => { if ( event . ctrlKey || event . metaKey ) { switch ( String . fromCharCode ( event . which ) . toLowerCase ( ) ) { case 'p' : store . dispatch ( { type : 'LAYOUT_PRINTING' , printing : true } ) ; setTimeout ( ( ) => { store . dispatch ( { type : 'LAYOUT_PRINTING' , printing : false } ) ; } , 10000 ) ; return false ; default : break ; } } } ) ; const setupHotReload = ( ) => { if ( module . hot ) { module . hot . accept ( ) ; module . hot . accept ( './components/Main' , ( ) => { setTimeout ( ( ) => { render ( ) ; } ) ; } ) ; } } ; const render = ( ) => { const MainContainer = require ( './components/MainContainer' ) . default ; const base = document . getElementById ( 'app' ) ; if ( ! base ) { throw new Error ( 'Could not find react-app element' ) ; } ReactDOM . unmountComponentAtNode ( base ) ; ReactDOM . render ( < Provider store = { store } > < MuiThemeProvider theme = { theme } > < MainContainer /> < /MuiThemeProvider> < /Provider>, base); } ; setupHotReload ( ) ; render ( ) ;