Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
juhamust committed Jun 18, 2016
0 parents commit 50f139a
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"es2015",
"react"
]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
66 changes: 66 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "mozaik-ext-slack",
"version": "0.1.0",
"description": "Slack widgets to Mozaik dashboard",
"main": "index.js",
"scripts": {
"test": "ava"
},
"keywords": [
"slack",
"mozaik",
"dashboard",
"extension"
],
"author": "Juha Mustonen <[email protected]>",
"license": "MIT",
"dependencies": {
"babel-core": "6.7.6",
"babel-preset-es2015": "6.6.0",
"babel-preset-react": "6.5.0",
"babelify": "7.2.0",
"bluebird": "3.3.5",
"chalk": "1.1.3",
"convict": "^0.6.1",
"lodash": "^3.5.0",
"react-mixin": "3.0.4",
"reflux": "0.4.1",
"superagent": "1.8.3",
"superagent-bluebird-promise": "3.0.0",
"dotenv": "^0.5.1",
"pretty-print": "^1.0.0",
"react-classset": "0.0.2",
"validator": "^3.30.0"
},
"devDependencies": {
"ava": "^0.15.2",
"babel-eslint": "6.0.2",
"babel-register": "6.7.2",
"eslint": "^2.13.0",
"eslint-plugin-react": "^5.2.2",
"gulp": "^3.8.11",
"jsdom": "^9.2.1",
"proxyquire": "^1.7.9",
"touch": "0.0.3"
},
"peerDependencies": {
"mozaik": ">=1.4.2",
"react": "^0.13.3"
},
"browserify": {
"transform": [
"babelify"
]
},
"ava": {
"files": [
"tests/*.test.js"
],
"tap": false,
"failFast": true,
"require": [
"babel-register"
],
"babel": "inherit"
}
}
16 changes: 16 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Promise from 'bluebird';

const client = mozaik => {
const count = 0;

return {
channel(send, params) {
setInterval(() => {
count += 1;
send({ count });
}, 800);
}
};
};

export default client;
34 changes: 34 additions & 0 deletions src/components/Channel.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { Component } from 'react';
import reactMixin from 'react-mixin';
import { ListenerMixin } from 'reflux';
import Mozaik from 'mozaik/browser';

class Channel extends Component {
constructor(props) {
super(props);
this.state = { count: 0 };
}

getApiRequest() {
return { id: 'slack.channel.123' };
}

onApiData(data) {
console.log(data);
this.setState({ count: data.count });
}

render() {
const { count } = this.state;

return (
<div>{count}</div>
);
}
}

// apply the mixins on the component
reactMixin(ClientConsumer.prototype, ListenerMixin);
reactMixin(ClientConsumer.prototype, Mozaik.Mixin.ApiConsumer);

export default ClientConsumer;
Empty file added src/components/index.js
Empty file.
5 changes: 5 additions & 0 deletions tests/client.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import test from 'ava';

test('returns methods', t => {
t.true(true);
});

0 comments on commit 50f139a

Please sign in to comment.