Skip to content

Commit

Permalink
big refactor of frontend to be awesome
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Mar 9, 2017
1 parent 53333cb commit 40d2828
Show file tree
Hide file tree
Showing 41 changed files with 383 additions and 322 deletions.
12 changes: 12 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules
coverage
build
.DS_Store
.env
*.log
npm-debug.log*
.mongo-db
.e2e
cypress/videos
dist
12 changes: 12 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules
coverage
build
.DS_Store
.env
*.log
npm-debug.log*
.mongo-db
.e2e
cypress/videos
dist
4 changes: 2 additions & 2 deletions client/package-scripts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const {series, rimraf, commonTags} = require('nps-utils')
const {series, rimraf, commonTags, crossEnv} = require('nps-utils')
module.exports = {
scripts: {
dev: 'react-scripts start',
dev: crossEnv('PORT=8080 react-scripts start'),
build: 'react-scripts build',
default: 'pushstate-server build',
test: {
Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"nps": "^5.0.4",
"nps-utils": "^1.2.0",
"pushstate-server": "^2.2.1",
"react-scripts": "^0.9.0"
"react-scripts": "^0.9.4"
},
"license": "MIT",
"repository": "[email protected]:kentcdodds/testing-workshop.git",
Expand Down
172 changes: 0 additions & 172 deletions client/src/components/Profile.js

This file was deleted.

48 changes: 0 additions & 48 deletions client/src/components/ProfileFavorites.js

This file was deleted.

34 changes: 22 additions & 12 deletions client/src/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
import ReactDOM from 'react-dom'
import {Provider} from 'react-redux'
import React from 'react'
import {Router, Route, IndexRoute, browserHistory} from 'react-router'
import store from './store'
import {
Router,
Route,
IndexRoute,
browserHistory,
hashHistory,
} from 'react-router'

import App from './components/App'
import Article from './components/Article'
import Editor from './components/Editor'
import Home from './components/Home'
import Login from './components/Login'
import ConnectedProfile from './components/Profile'
import ProfileFavorites from './components/ProfileFavorites'
import Register from './components/Register'
import Settings from './components/Settings'
import store from './store'
import App from './screens/app'
import Article from './screens/article'
import Editor from './screens/editor'
import Home from './screens/home'
import Login from './screens/login'
import ConnectedProfile from './screens/profile'
import ProfileFavorites from './screens/profile-favorites'
import Register from './screens/register'
import Settings from './screens/settings'

ReactDOM.render(
<Provider store={store}>
<Router history={browserHistory}>
<Router
history={
process.env.NODE_ENV === 'production' ? browserHistory : hashHistory
}
>
<Route path="/" component={App}>
<IndexRoute component={Home} />
<Route path="login" component={Login} />
Expand Down
2 changes: 1 addition & 1 deletion client/src/middleware.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import agent from './agent'
import agent from './shared/agent'

const promiseMiddleware = store => next => action => {
if (isPromise(action.payload)) {
Expand Down
4 changes: 2 additions & 2 deletions client/src/reducer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {combineReducers} from 'redux'
import article from './reducers/article'
import articleList from './reducers/articleList'
import articleList from './reducers/article-list'
import auth from './reducers/auth'
import common from './reducers/common'
import editor from './reducers/editor'
import home from './reducers/home'
import profile from './reducers/profile'
import profileFavorites from './reducers/profileFavorites'
import profileFavorites from './reducers/profile-favorites'
import settings from './reducers/settings'

export default combineReducers({
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions client/src/components/App.js → client/src/screens/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import {connect} from 'react-redux'
import agent from '../agent'
import Header from './Header'
import agent from '../shared/agent'
import Header from '../shared/components/header'

const mapStateToProps = state => ({
appLoaded: state.common.appLoaded,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import {Link} from 'react-router'
import {connect} from 'react-redux'
import agent from '../../agent'
import agent from '../../shared/agent'

const mapDispatchToProps = dispatch => ({
onClickDelete: payload => dispatch({type: 'DELETE_ARTICLE', payload}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {Link} from 'react-router'
import ArticleActions from './ArticleActions'
import ArticleActions from './article-actions'

const ArticleMeta = props => {
const article = props.article
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import {Link} from 'react-router'
import CommentInput from './CommentInput'
import CommentList from './CommentList'
import CommentInput from './comment-input'
import CommentList from './comment-list'

const CommentContainer = props => {
if (props.currentUser) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {connect} from 'react-redux'
import agent from '../../agent'
import agent from '../../shared/agent'

const mapDispatchToProps = dispatch => ({
onSubmit: payload => dispatch({type: 'ADD_COMMENT', payload}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Comment from './Comment'
import Comment from './comment'

const CommentList = props => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {Link} from 'react-router'
import DeleteButton from './DeleteButton'
import DeleteButton from './delete-button'

const Comment = props => {
const comment = props.comment
Expand Down
Loading

0 comments on commit 40d2828

Please sign in to comment.