This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Store, createStore, applyMiddleware } from 'redux'; | |
import thunk from 'redux-thunk'; | |
import reducer from './reducers'; | |
import Api from 'helpers/api'; | |
import errorHandler from 'redux/middlewares/errorHandler'; | |
const devToolsExtension: string = 'devToolsExtension'; | |
let devtools: any = window[devToolsExtension] ? window[devToolsExtension]() : (f: any) => f; | |
const api = new Api(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
import * as consts from '../constants'; | |
export default store => next => action => { | |
const {api, type, ...rest} = action; | |
if (!api) { | |
return next(action); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as consts from 'redux/constants'; | |
export default store => next => action => { | |
const {error} = action; | |
if (error && error.response && error.response.data.result === 5) { | |
next({ type: consts.DISPLAY_ERROR, error: error.response.data}); | |
} else { | |
next(action); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getCoords(elem: any) { | |
var box = elem.getBoundingClientRect(); | |
return { | |
top: box.top + window.pageYOffset, | |
left: box.left + window.pageXOffset, | |
right: box.right + window.pageXOffset, | |
bottom: box.bottom + window.pageYOffset, | |
width: box.width, | |
height: box.height | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class Api { | |
get(url: string, config?: AxiosRequestConfig) { | |
return new Promise((resolve, reject) => { | |
axios.get(BASE_URL + url, config) | |
.then(({data}) => resolve(data)) | |
.catch(error => reject(error)); | |
}); | |
} | |
put(url: string, _data: any = {}) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MongoClient = require('mongodb').MongoClient, | |
commandLineArgs = require('command-line-args'), | |
assert = require('assert'); | |
var options = commandLineOptions(); | |
MongoClient.connect('mongodb://localhost:27017/crunchbase', function(err, db) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.prototype.editRow = function (config) { | |
if(config.name) { | |
if(this._isUniqueTag(config.name, self.shapes['grouped'])) { | |
d3.select(self.currentGroupForEdit).select('text').text(config.name) | |
} else { | |
alert('Group tag have to be unique. ' + config.name + ' is already existing.') | |
} | |
} | |
if(config.numberOfSeats) { | |
var elements = d3.select(self.currentGroupForEdit).selectAll('g.point'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.prototype.calculateCoords = function (rowNumber, currentShape) { | |
var max_y = 20; | |
d3.selectAll('g.group').each(function (d) { | |
var coords = d3.transform(d3.select(this).attr("transform")); | |
var grpX = coords.translate[0]; | |
var grpY = coords.translate[1]; | |
if (grpY > max_y) { | |
max_y = grpY; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.prototype.makeDynamicArc = function (data) { | |
var rowLen = data.rowLen; | |
var shape0_x, | |
shape0_y; | |
var shape0_w = data.tag.w, | |
shape0_h = data.tag.h; | |
var shapeType = data.shape.shapeType, | |
shapeW = data.shape.w, | |
shapeH = data.shape.h; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function loadPlans(etag) { | |
return { | |
types: [LOAD_PLANS, LOAD_PLANS_SUCCESS, LOAD_PLANS_FAIL], | |
promise: (client) => client.get('/plans', { | |
headers: { | |
'If-None-Match': etag | |
} | |
}) | |
}; | |
} |