Skip to content

Instantly share code, notes, and snippets.

View johnrhampton's full-sized avatar
🎧

johnrhampton

🎧
View GitHub Profile
'use strict';
import 'babel-polyfill';
import React from 'react';
import {render} from 'react-dom';
import {Provider} from 'react-redux';
import {initializeSockets} from './common/adapters/socket.adapter';
import * as main_store from './common/stores/main.store';
import App from './containers/App';
@johnrhampton
johnrhampton / index.js
Last active June 21, 2016 12:30
/containers/App/index.js
'use strict';
import React, {Component, PropTypes} from 'react';
import {render} from 'react-dom';
import {Router, Route, hashHistory} from 'react-router';
var SnackBar = require('../../common/snackbar.js');
// Material UI Theme
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import {blue500, grey500} from 'material-ui/styles/colors';
@johnrhampton
johnrhampton / index.js
Created June 21, 2016 12:32
/containers/StartScreen/index.js
'use strict';
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {changeRoute} from '../../common/actions/navigation.action';
import {login, updateLoginField} from '../../common/actions/user.action';
import {BG_IMAGES} from '../../common/constants/backgrounds';
import Login from '../../components/Login';
@johnrhampton
johnrhampton / index.js
Created June 21, 2016 12:34
/components/Login/index.js
'use strict';
import React, {PropTypes} from 'react';
import {HotKeys} from 'react-hotkeys';
import {VERSION} from '../../common/constants/environment';
import LoginLoading from './LoginLoading';
const Login = ({hotKeyMap, loading, username, password, phone_ext, handleLoginFieldChange, handleLogin}) => {
const handlers = {
@johnrhampton
johnrhampton / user.action.js
Created June 21, 2016 12:35
/common/actions/user.action
'use strict';
import * as userService from '../services/user.service';
import {connectSocket} from '../adapters/socket.adapter';
import {changeRoute} from './navigation.action';
import {
showLoading,
hideLoading
} from './loading.action';
import {SITE_CONTEXT} from '../constants/system';
@johnrhampton
johnrhampton / index.js
Created June 21, 2016 12:36
/common/reducers/index.js
'use strict';
import {combineReducers} from 'redux';
import admin_reducer from './admin';
import {dialer_reducer} from './dialer.reducer';
import {disposition_reducer} from './disposition.reducer';
import {lead_reducer} from './lead.reducer';
import {loading_reducer} from './loading.reducer';
import {navigation_reducer} from './navigation.reducer';
@johnrhampton
johnrhampton / user.reducer.js
Created June 21, 2016 12:37
/common/reducers/user.reducer.js
'use strict';
import {cloneDeep} from 'lodash';
import {
CHANGE_SITE_CONTEXT,
LEADS_PROFILE,
LOGIN_COMPLETE,
LOGIN_REQUEST,
LOGOUT_REQUEST,
@johnrhampton
johnrhampton / main.store.js
Created June 21, 2016 12:40
/common/stores/main.store.js
'use strict';
import {createStore, applyMiddleware, compose} from 'redux';
import thunkMiddleware from 'redux-thunk';
import createLogger from 'redux-logger';
import rootReducer from '../reducers';
import {ENV_TYPE} from '../constants/environment';
export let createStores = (initialState) => {
@johnrhampton
johnrhampton / user.service.js
Created June 21, 2016 12:41
/common/services/user.service.js
'use strict';
import {post} from './http.service';
import {API_PATH, SOCKET_ID} from '../constants/environment.js';
import {USER} from '../constants/endpoints';
export function login(username, password, phoneExt) {
return new Promise(
(resolve, reject) => {
var url = API_PATH + USER.LOGIN;
@johnrhampton
johnrhampton / recurse_function.js
Created September 9, 2016 19:46
recursive function
function doSomethingForAWhile() {
return new Promise((resolve, reject) => {
var maxStatusChecks = 10;
var statusCheckCount = 0;
var delay = 750;
(function doSomething() {
return checkSomethingAsync()
.then(() => {
return timeout(delay || 500);