Skip to content

Commit

Permalink
Merge 08f58bd into b36d812
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Benitte committed Mar 20, 2016
2 parents b36d812 + 08f58bd commit 833f6f0
Show file tree
Hide file tree
Showing 34 changed files with 844 additions and 747 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"
]
}
61 changes: 52 additions & 9 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,20 +1,63 @@
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"blockBindings": true,
"jsx": true
},
},
"env": {
"browser": true,
"node": true
"es6": true
},
"plugins": [
"react"
],
"rules": {
"strict": 0,
"quotes": "single",
"indent": 4,
"no-multi-spaces": false,
"no-underscore-dangle": false,
"eol-last": [0],
"semi": 2,
"prefer-template": 2,
"indent": [2, 4, {
"SwitchCase": 1
}],
"dot-notation": [2, {
"allowKeywords": true
}],
"key-spacing": [2, {
"align": "value",
"beforeColon": false,
"afterColon": true
}]
}],
"quotes": [2, "single"],
"jsx-quotes": [2, "prefer-double"],
"array-bracket-spacing": [2, "never"],
"eol-last": 2,
"comma-style": [2, "last"],
"space-before-function-paren": [2, {
"anonymous": "always",
"named": "never"
}],
"react/jsx-key": 2,
"react/jsx-pascal-case": 2,
"react/jsx-indent": [2, 4],
"react/jsx-closing-bracket-location": 2,
"react/jsx-curly-spacing": [2, "never"],
"react/jsx-no-duplicate-props": [2, {
"ignoreCase": true
}],
"react/jsx-no-bind": [1, {
"ignoreRefs": false,
"allowArrowFunctions": false,
"allowBind": false
}],
"react/no-direct-mutation-state": 2,
"react/no-deprecated": [2, {
"react": "0.13.3"
}],
"react/prop-types": [1, {}],
"react/react-in-jsx-scope": 2,
"react/prefer-es6-class": [2, "always"],
"react/display-name": 2
}
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store
node_modules
npm-debug.log
.nyc_output
coverage
5 changes: 3 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/tests
test
preview
.travis.yml
.travis.yml
.eslintrc
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
language: node_js
node_js:
- '0.12'
- '0.12'
- '4'
- '5'
script:
- npm run eslint
- npm run test-cover
after_success:
- npm run coveralls
2 changes: 0 additions & 2 deletions mocha.opts

This file was deleted.

60 changes: 44 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,70 @@
},
"homepage": "https://github.com/plouc/mozaik-ext-github",
"main": "./src/components/index.js",
"keywords": [
"github",
"mozaik",
"widget",
"extension",
"dashboard"
],
"engines": {
"node": "0.12.x"
},
"dependencies": {
"babelify": "^6.1.3",
"babelify": "7.2.0",
"babel-core": "6.7.2",
"babel-preset-es2015": "6.6.0",
"babel-preset-react": "6.5.0",
"chalk": "^1.1.0",
"convict": "^0.6.1",
"lodash": "^3.2.0",
"lodash": "4.6.1",
"moment": "^2.10.3",
"moment-duration-format": "^1.3.0",
"react": "^0.13.3",
"react-mixin": "^1.7.0",
"reflux": "^0.2.5",
"react-mixin": "3.0.4",
"reflux": "0.4.0",
"superagent": "^1.2.0",
"superagent-bluebird-promise": "^0.6.0"
},
"devDependencies": {
"babel": "^5.8.12",
"babel-eslint": "^1.0.6",
"chai": "^3.2.0",
"eslint": "^0.15.1",
"jsdom": "^2.0.0",
"mocha": "^2.2.5",
"mockery": "^1.4.0",
"sinon": "^1.15.4"
"ava": "0.13.0",
"babel-eslint": "5.0.0",
"babel-register": "6.7.2",
"coveralls": "2.11.8",
"enzyme": "2.1.0",
"eslint": "2.2.0",
"eslint-plugin-react": "4.2.2",
"mockery": "1.4.1",
"nyc": "6.1.1",
"react": "^0.13.3",
"sinon": "1.17.3"
},
"peerDependencies": {
"mozaik": "1.x"
"mozaik": ">=1.0.11",
"react": "^0.13.3"
},
"scripts": {
"test": "mocha --opts mocha.opts ./src/tests/**/*.test.js",
"eslint": "eslint ./src/*"
"eslint": "eslint --ext .js --ext .jsx ./src/*",
"test": "ava",
"test-cover": "nyc ava",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"cover-report": "nyc report --reporter=lcov && open coverage/lcov-report/index.html"
},
"browserify": {
"transform": [
"babelify"
]
},
"ava": {
"babel": "inherit",
"require": [
"babel-register"
]
},
"nyc": {
"extension": [
".js",
".jsx"
]
}
}
2 changes: 1 addition & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ const client = function (mozaik) {
return apiCalls;
};

export { client as default };
export default client;
21 changes: 15 additions & 6 deletions src/components/Branch.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import React, { Component } from 'react';
import React, { Component, PropTypes } from 'react';


class Branch extends Component {
render() {
let { branch } = this.props;
const { branch } = this.props;

let authorAvatar = null;
let authorNode = null;

if (branch.commit) {
if (branch.commit.author) {
const { commit } = branch;

if (commit.author) {
authorAvatar = (
<div className="github__branch__avatar">
<img src={branch.commit.author.avatar_url} />
<img src={commit.author.avatar_url} />
</div>
);

authorNode = <span>by {branch.commit.author.login}</span>
authorNode = <span>by {commit.author.login}</span>;
}
}

Expand All @@ -30,4 +32,11 @@ class Branch extends Component {
}
}

export { Branch as default };
Branch.displayName = 'Branch';

Branch.propTypes = {
branch: PropTypes.object.isRequired
};


export default Branch;
36 changes: 16 additions & 20 deletions src/components/IssueLabelsTreemap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,31 @@ const { Treemap } = Mozaik.Component;
class IssueLabelsTreemap extends Component {
constructor(props) {
super(props);
this.state = {
labels: []
};

this.state = { labels: [] };
}

getApiRequest() {
let { labels, repository } = this.props;

return {
id: `github.issueLabelsAggregations.${ _.pluck(labels, 'name').join('.') }`,
params: {
labels: labels,
repository: repository
}
params: { repository, labels }
};
}

onApiData(labels) {
this.setState({
labels: labels
});
this.setState({ labels });
}

render() {
let { labels } = this.state;
const { labels } = this.state;

let data = labels.map(label => {
return {
label: label.name,
count: label.count,
color: label.color
};
});
const data = labels.map(label => ({
label: label.name,
count: label.count,
color: label.color
}));

return (
<div>
Expand All @@ -57,8 +49,11 @@ class IssueLabelsTreemap extends Component {
}
}

IssueLabelsTreemap.displayName = 'IssueLabelsTreemap';

IssueLabelsTreemap.propTypes = {
labels: PropTypes.arrayOf(PropTypes.shape({
repository: PropTypes.string.isRequired,
labels: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string,
color: PropTypes.string
})).isRequired
Expand All @@ -67,4 +62,5 @@ IssueLabelsTreemap.propTypes = {
reactMixin(IssueLabelsTreemap.prototype, ListenerMixin);
reactMixin(IssueLabelsTreemap.prototype, Mozaik.Mixin.ApiConsumer);

export { IssueLabelsTreemap as default };

export default IssueLabelsTreemap;
32 changes: 17 additions & 15 deletions src/components/OrganizationBadge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,33 @@ import Mozaik from 'mozaik/browser';
class OrganizationBadge extends Component {
constructor(props) {
super(props);
this.state = {
organization: null
};

this.state = { organization: null };
}

getApiRequest() {
let { organization } = this.props;
const { organization } = this.props;

return {
id: `github.organization.${ organization }`,
params: {
organization: organization
}
params: { organization }
};
}

onApiData(organization) {
this.setState({
organization: organization
});
this.setState({ organization });
}

render() {
let { organization, title } = this.props;
var titleNode = (
const { organization, title } = this.props;

let titleNode = (
<span>
<span className="widget__header__subject">{title || organization}</span>
</span>
);
var organizationNode = (

let organizationNode = (
<div className="widget__body" />
);

Expand All @@ -47,6 +44,7 @@ class OrganizationBadge extends Component {
<span className="widget__header__subject">{this.state.organization.name}</span>
</span>
) : title;

organizationNode = (
<div className="widget__body">
<div className="github__organization-badge__banner">
Expand Down Expand Up @@ -91,11 +89,15 @@ class OrganizationBadge extends Component {
}
}

OrganizationBadge.displayName = 'OrganizationBadge';

OrganizationBadge.propTypes = {
organization: PropTypes.string.isRequired
organization: PropTypes.string.isRequired,
title: PropTypes.string
};

reactMixin(OrganizationBadge.prototype, ListenerMixin);
reactMixin(OrganizationBadge.prototype, Mozaik.Mixin.ApiConsumer);

export { OrganizationBadge as default };

export default OrganizationBadge;

0 comments on commit 833f6f0

Please sign in to comment.