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
const express = require('express') | |
const bodyParser = require('body-parser') | |
const cors = require('cors') | |
const {graphqlExpress, graphiqlExpress} = require('graphql-server-express') | |
const schema = require('../graphql/schema.js') | |
const PORT = 3000 | |
const app = express() |
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
const {merge, range, uniqueId} = require('lodash') | |
const {makeExecutableSchema} = require('graphql-tools') | |
const { | |
schema: clickSchema, | |
} = require('./clicks.schema.js') | |
let clicks = [] | |
const rootSchema = [` | |
type Query { |
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
// On the renderer side, we listen for the 'done' event, and for the close | |
// event. We also send the 'open' event when the graphql button is clicked. | |
ipc.on('open:graphql_window:done', (event) => { | |
console.log('open:graphql_window:done') | |
addClass(graphiql, 'hidden') | |
removeClass(graphiqlLoading, 'hidden') | |
}) | |
ipc.on('close:graphql_window', (event) => { | |
console.log('close:graphql_window') |
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
// --------------------------- | |
// Apollo Client Configuration | |
// --------------------------- | |
import {ApolloClient, createNetworkInterface} from 'react-apollo' | |
export const client = new ApolloClient({ | |
networkInterface: createNetworkInterface({ | |
addTypename: true, | |
dataIdFromObject: (result) => ( | |
result._id && result.__typename |
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
// --------------------------- | |
// Apollo Client Configuration | |
// --------------------------- | |
import {ApolloClient, createNetworkInterface} from 'react-apollo' | |
export const client = new ApolloClient({ | |
networkInterface: createNetworkInterface({ | |
uri: 'http://localhost:3000/graphql' | |
}), | |
addTypename: true, |
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 React from 'react' | |
import {gql, graphql} from 'react-apollo' | |
import update from 'immutability-helper' | |
import Click from '../components/Click.js' | |
class ClickContainer extends React.Component { | |
state = { | |
message: '', | |
} |
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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import Root from './containers/Root.js'; | |
import configureStore from './store/configureStore.js' | |
import './_styles/index.css'; | |
const Loading = () => (<h1>Loading...</h1>) | |
const store = configureStore() |
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 React from 'react' | |
import T from 'prop-types' | |
import uniqueId from 'lodash/uniqueId' | |
import isArray from 'lodash/isArray' | |
import {IMargin, IScale, IAxisOptions} from './propTypes.js' | |
const d3 = Object.assign({}, | |
require('d3-selection'), | |
require('d3-scale'), | |
require('d3-array') |
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 React from 'react' | |
import T from 'prop-types' | |
import Chart from './Chart.js' | |
import D3Background from './D3Background.js' | |
import D3XAxis from './D3XAxis.js' | |
import D3YAxis from './D3YAxis.js' | |
import D3Bars from './D3Bars.js' | |
const D3SubjectBarsChart = ({data}) => ( | |
<Chart |
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 React from 'react' | |
import T from 'prop-types' | |
import Chart from './Chart.js' | |
import Background from './Background.js' | |
import Axis from './Axis.js' | |
import Bars from './Bars.js' | |
const SubjectBarsChart = ({data}) => ( | |
<Chart | |
data={data} |