Skip to content

Commit c8abe5c

Browse files
committed
Version v0.0.4. Redux-matter used to replace account actions, reducer, and middleware. Redux-matter updated to v0.0.3 and kyper-matter updated to v0.1.7.
1 parent 005f9e0 commit c8abe5c

File tree

29 files changed

+284
-267
lines changed

29 files changed

+284
-267
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: node_js
2+
node_js:
3+
- "0.12"
4+
- "4"
5+
- "5"
6+
branches:
7+
only:
8+
- master
9+
sudo: false
10+
script: "npm test"

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44
<a href="https://npmjs.org/package/generator-kyper-react">
55
<img src="https://img.shields.io/npm/v/generator-kyper-react.svg" alt="npm version">
66
</a>
7+
<!-- Build Status -->
8+
<a href="https://travis-ci.org/KyperTech/generator-kyper-react">
9+
<img title="Build Status" src="https://travis-ci.org/KyperTech/generator-kyper-react.svg">
10+
</a>
11+
<!-- Dependency Status -->
12+
<a href="https://david-dm.org/KyperTech/generator-kyper-react">
13+
<img src="https://david-dm.org/KyperTech/generator-kyper-react.svg" alt="dependency status">
14+
</a>
715
<!-- License -->
8-
<a href="https://github.com/KyperTech/generator-kyper-react/blob/master/LICENSE.md">
16+
<a href="https://github.com/KyperTech/generator-kyper-react/blob/master/LICENSE">
917
<img src="https://img.shields.io/npm/l/generator-kyper-react.svg" alt="license">
1018
</a>
1119
</p>

generators/app/templates/_matter-client.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import configureStore from './store/configureStore';
66
import { reduxReactRouter } from 'redux-router';
77
import { createHistory } from 'history';
88
import matter from './helpers/matter';
9-
9+
import Matter from 'kyper-matter';
10+
let matter = new Matter('<%= appName %>');
1011
const initialState = window.__INITIAL_STATE__ || {
11-
profile: matter.currentUser
12+
account: {id: matter.currentUser ? matter.currentUser.id : null},
13+
accounts: [matter.currentUser]
1214
};
1315

1416
const store = configureStore(initialState, reduxReactRouter, createHistory);

generators/app/templates/_package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "<%= appName %>",
33
"version": "<%= version %>",
4-
"main": "index.js",
4+
"main": "bin/server.js",
55
"scripts": {
66
"build": "npm run clean && npm run build-bundle && npm run build-server && npm run build-copy",
77
"build-bundle": "webpack --stats --progress --config webpack-production.config",
@@ -24,7 +24,6 @@
2424
"dependencies": {
2525
"express": "^4.13.3",
2626
"history": "1.13.0",
27-
"kyper-matter": "^0.1.6",
2827
"lodash": "^3.10.1",
2928
"normalizr": "^1.4.0",
3029
"proxy-middleware": "^0.13.1",
@@ -36,6 +35,8 @@
3635
"redux": "^3.0.0",
3736
"redux-router": "1.0.0-beta3",
3837
"redux-thunk": "^1.0.0",
38+
"redux-matter": "^0.0.3",
39+
"kyper-matter": "^0.1.7",
3940
"serve-static": "^1.10.0",
4041
"webpack": "^1.12.2",
4142
"extract-text-webpack-plugin": "^0.8.2",

generators/app/templates/app/actions/profile.js

Lines changed: 0 additions & 92 deletions
This file was deleted.

generators/app/templates/app/client.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3+
import { reduxReactRouter } from 'redux-router';
4+
import { createHistory } from 'history';
5+
import { getMatter } from 'redux-matter';
36
import Root from './root';
47
import configureStore from './store/configureStore';
58

6-
import { reduxReactRouter } from 'redux-router';
7-
import { createHistory } from 'history';
9+
let matter = getMatter();
10+
let entitiesObj = {accounts:{}};
11+
let accountObj = {};
812

9-
const initialState = window.__INITIAL_STATE__ || {
10-
};
13+
if(matter.currentUser){
14+
accountObj.id = matter.currentUser.id
15+
entitiesObj.accounts[matter.currentUser.id] = matter.currentUser
16+
}
1117

1218
const store = configureStore(initialState, reduxReactRouter, createHistory);
1319

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React, { Component, PropTypes } from 'react';
2+
import { Link } from 'react-router';
3+
import './AccountDropdown.scss';
4+
5+
class AccountDropdown extends Component {
6+
constructor() {
7+
super();
8+
this.state = {isOpen: false};
9+
this.toggleDropdown = this.toggleDropdown.bind(this);
10+
}
11+
static propTypes = {
12+
account: PropTypes.shape({
13+
username: PropTypes.string.isRequired
14+
}).isRequired,
15+
onLogoutClick: PropTypes.func
16+
};
17+
toggleDropdown() {
18+
this.setState({
19+
isOpen: !this.state.isOpen
20+
});
21+
}
22+
render() {
23+
if(!this.state.isOpen) {
24+
return (
25+
<div className="AccountDropdown-Closed">
26+
<button onClick={ this.toggleDropdown }>
27+
{this.props.account.username}
28+
</button>
29+
</div>
30+
);
31+
} else {
32+
return (
33+
<div className="AccountDropdown-Open">
34+
<button onClick={ this.toggleDropdown }>
35+
{this.props.account.username}
36+
</button>
37+
<Link className="AccountDropdown-Link" to="/profile">
38+
Profile
39+
</Link>
40+
<button onClick={ this.props.onLogoutClick }>
41+
Logout
42+
</button>
43+
</div>
44+
);
45+
}
46+
}
47+
}
48+
49+
export default AccountDropdown;

generators/app/templates/app/components/ProfileDropdown/ProfileDropdown.scss renamed to generators/app/templates/app/components/AccountDropdown/AccountDropdown.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.ProfileDropdown {
1+
.AccountDropdown {
22
&-Link {
33
text-decoration: none;
44
font-size: 1rem;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React, { Component, PropTypes } from 'react';
2+
import { Link } from 'react-router';
3+
import AccountDropdown from '../AccountDropdown/AccountDropdown';
4+
import './AccountManager.scss';
5+
6+
class AccountManager extends Component {
7+
constructor(props) {
8+
super(props);
9+
}
10+
static propTypes = {
11+
account: PropTypes.object,
12+
onLogoutClick: PropTypes.func
13+
};
14+
render() {
15+
if(this.props.account && this.props.account.username){
16+
return (
17+
<AccountDropdown
18+
account={ this.props.account }
19+
onLogoutClick={ this.props.onLogoutClick }
20+
/>
21+
)
22+
} else {
23+
return (
24+
<div className="AccountManager-Buttons">
25+
<Link className="AccountManager-Button" to="/login">
26+
Login
27+
</Link>
28+
<Link className="AccountManager-Button" to="/signup">
29+
Signup
30+
</Link>
31+
</div>
32+
);
33+
}
34+
}
35+
}
36+
37+
export default AccountManager;

generators/app/templates/app/components/ProfileManager/ProfileManager.scss renamed to generators/app/templates/app/components/AccountManager/AccountManager.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@import '../../variables';
2-
.ProfileManager {
2+
.AccountManager {
33
display: flex;
44
//Button group
55
&-Buttons {

0 commit comments

Comments
 (0)