Skip to content

An infrastructure for collaborative dashboards run on a firestore datasource

Notifications You must be signed in to change notification settings

dincozdemir/grill-core

Repository files navigation

Grill is an infrastructure for collaborative dashboards run on a firestore datasource.

Installation:

yarn add grill-core

Usage

Import reducers as:

import { combineReducers } from 'redux';
import { reducers } from 'grill-core';

export default combineReducers(reducers);

Import actions as:

import { actions } from 'grill-core';
const {
  listenToBoard,
  unListenToBoard,
  addLane,
  addCell,
  removeCell,
  editCellStart,
  editCellEnd
} = actions;

export {
  listenToBoard,
  unListenToBoard,
  addLane,
  addCell,
  removeCell,
  editCellStart,
  editCellEnd
};

Import selectors as:

import { selectors } from 'grill-core';
const { boardSelector } = selectors;
export { boardSelector };

Grill requires a firebase project with firestore enabled
Configure grill-core as:

import { initialize } from 'grill-core';

initialize({
  boardName: 'XRetro',
  firebaseConfig: {
    apiKey: 'xxxx',
    authDomain: 'xxx.firebaseapp.com',
    databaseURL: 'https://xxx.firebaseio.com',
    projectId: 'xxx',
    storageBucket: 'xxx.appspot.com',
    messagingSenderId: 'abc'
  }
});

Use grill-core in your component as:

import { connect } from 'react-redux';
import {
  listenToBoard,
  unListenToBoard,
  addLane,
  addCell,
  removeCell,
  editCellStart,
  editCellEnd
} from '../../redux/actions';
import { boardSelector } from '../../selectors';
import Board from './Board';

export default connect(
  state => ({
    board: boardSelector(state)
  }),
  {
    listenToBoard,
    unListenToBoard,
    addLane,
    addCell,
    removeCell,
    editCellStart,
    editCellEnd
  }
)(Board);
class Board extends React.Component {
  componentDidMount() {
    this.props.listenToBoard();
  }

  componentDidUnMount() {
    this.props.unListenToBoard();
  }
  ...
}

About

An infrastructure for collaborative dashboards run on a firestore datasource

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published