Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Emmanouil Konstantinidis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Github Notifier
Github Notifier [![Build Status](https://magnum.travis-ci.com/ekonstantinidis/github-notifier.svg?token=9QR4ewbqbkEmHps6q5sq&branch=master)](https://magnum.travis-ci.com/ekonstantinidis/github-notifier)
==========
Github Notifications on your menu bar.

Expand Down
8 changes: 8 additions & 0 deletions src/js/actions/actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var Reflux = require('reflux');

var Actions = Reflux.createActions({


});

module.exports = Actions;
13 changes: 11 additions & 2 deletions src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ var React = require('react');
var Router = require('react-router');

var Navigation = require('./components/navigation');
var LoginPage = require('./components/login');
var NotificationsPage = require('./components/notifications');
var AuthStore = require('./stores/auth');

var Route = Router.Route;
var NotFoundRoute = Router.NotFoundRoute;
var DefaultRoute = Router.DefaultRoute;
var RouteHandler = Router.RouteHandler;

var App = React.createClass({
statics: {
Expand Down Expand Up @@ -31,8 +39,9 @@ var NotFound = React.createClass({

var routes = (
<Route handler={App} path="/">
<DefaultRoute handler={RepositoriesPage} />
<Route name="login" handler={NotFound}/>
<DefaultRoute handler={NotificationsPage} />
<Route name="notifications" handler={NotificationsPage}/>
<Route name="login" handler={LoginPage}/>
<NotFoundRoute handler={NotFound}/>
</Route>
);
Expand Down
18 changes: 18 additions & 0 deletions src/js/components/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var React = require('react');
var Reflux = require('reflux');
var Loading = require('reloading');

var Actions = require('../actions/actions');

var Login = React.createClass({

render: function () {
return (
<div className="container-fluid main-container">
<h1>Login</h1>
</div>
);
}
});

module.exports = Login;
18 changes: 18 additions & 0 deletions src/js/components/notifications.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var React = require('react');
var Reflux = require('reflux');
var Loading = require('reloading');

var Actions = require('../actions/actions');

var Notifications = React.createClass({

render: function () {
return (
<div className="container-fluid main-container">
<h1>Notifications</h1>
</div>
);
}
});

module.exports = Notifications;
29 changes: 29 additions & 0 deletions src/js/stores/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var Reflux = require('reflux');
var Actions = require('../actions/actions');

var AuthStore = Reflux.createStore({
listenables: Actions,

init: function () {
this._githubtoken = window.localStorage.getItem('githubtoken') || false;
},

onLogin: function (token) {
this._githubtoken = token;
window.localStorage.setItem('githubtoken', token);
this.trigger(this.authStatus());
},

onLogout: function () {
window.localStorage.clear();
this._githubtoken = false;
this.trigger(this.authStatus());
},

authStatus: function () {
var self = this;
return self._githubtoken;
}
});

module.exports = AuthStore;
25 changes: 25 additions & 0 deletions src/js/utils/api-requests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var request = require('superagent');

var apiRequests = {
get: function (url) {
return request
.get(url)
.set('Accept', 'application/json');
},

post: function (url, params) {
return request
.post(url)
.send(params)
.set('Accept', 'application/json');
},

put: function (url, params) {
return request
.put(url)
.send(params)
.set('Accept', 'application/json');
}
};

module.exports = apiRequests;