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 {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
// --------------------------- | |
// 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
// --------------------------- | |
// 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
// 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
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
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 {BrowserWindow} = require('electron') | |
const url = require('url') | |
const path = require('path') | |
/** | |
* @function serverWindow | |
* @description Opens the server window. | |
* @param {Function} onClose Function to call after a 'closed' event. | |
*/ | |
function serverWindow(onClose=function(){}) { |
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 {BrowserWindow} = require('electron') | |
const url = require('url') | |
const path = require('path') | |
/** | |
* @function serverWindow | |
* @description Opens the server window. | |
* @param {Function} onClose Function to call after a 'closed' event. | |
*/ | |
function serverWindow(onClose=function(){}) { |
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
function createWindows() { | |
if (wins.server === null) | |
wins.server = serverWindow(() => wins.server = null) | |
if (wins.main === null) | |
wins.main = mainWindow(() => wins.main = null) | |
} |