From 1508eac92de2f22087219b059e883f5971cbfbe8 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 15:51:43 -0300 Subject: [PATCH 01/20] Removing divs from routes --- client/coral-admin/index.ejs | 4 ++-- client/coral-admin/package.json | 1 + client/coral-admin/public/index.html | 4 ++-- client/coral-admin/src/components/App.js | 11 +++++------ client/coral-admin/src/components/Header.js | 9 +++++---- .../coral-admin/src/containers/CommunityContainer.js | 10 ++++++++++ client/coral-admin/webpack.config.dev.js | 6 ++++++ client/coral-admin/webpack.config.js | 8 +++++++- 8 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 client/coral-admin/src/containers/CommunityContainer.js diff --git a/client/coral-admin/index.ejs b/client/coral-admin/index.ejs index 9b5fe84bf..038fb58d7 100644 --- a/client/coral-admin/index.ejs +++ b/client/coral-admin/index.ejs @@ -10,8 +10,8 @@ body, #root { width: 100%; height: 100%; - margin: 0; - background: #fff; + margin: 0; + background: #fff; } diff --git a/client/coral-admin/package.json b/client/coral-admin/package.json index ced6a3512..26f355e3d 100644 --- a/client/coral-admin/package.json +++ b/client/coral-admin/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "build": "./node_modules/.bin/webpack --config webpack.config.js", + "watch": "./node_modules/.bin/webpack --config webpack.config.js --watch", "start": "./node_modules/.bin/webpack-dev-server --config webpack.config.dev.js --inline --hot --content-base public --port 3142" }, "keywords": [], diff --git a/client/coral-admin/public/index.html b/client/coral-admin/public/index.html index c31c22a6d..daf7304c8 100644 --- a/client/coral-admin/public/index.html +++ b/client/coral-admin/public/index.html @@ -10,8 +10,8 @@ body, #root { width: 100%; height: 100%; - margin: 0; - background: #fff; + margin: 0; + background: #fff; } diff --git a/client/coral-admin/src/components/App.js b/client/coral-admin/src/components/App.js index 545cd80a4..ff1c8f1d0 100644 --- a/client/coral-admin/src/components/App.js +++ b/client/coral-admin/src/components/App.js @@ -18,14 +18,13 @@ export default class App extends React.Component {
-
- - - - + + + + + -
diff --git a/client/coral-admin/src/components/Header.js b/client/coral-admin/src/components/Header.js index 8aebe7864..88a92c7ef 100644 --- a/client/coral-admin/src/components/Header.js +++ b/client/coral-admin/src/components/Header.js @@ -9,14 +9,15 @@ export default (props) => (
- Moderate - Configure + Moderate + Community + Configure
- Moderate - Configure + Moderate + Configure {props.children} diff --git a/client/coral-admin/src/containers/CommunityContainer.js b/client/coral-admin/src/containers/CommunityContainer.js new file mode 100644 index 000000000..6eb673125 --- /dev/null +++ b/client/coral-admin/src/containers/CommunityContainer.js @@ -0,0 +1,10 @@ +import React, { Component } from 'react' +import { connect } from 'react-redux' +import I18n from 'coral-framework/i18n/i18n' +import translations from '../translations' + +export default class CommunityContainer extends Component { + render() { + return
Hello
+ } +} \ No newline at end of file diff --git a/client/coral-admin/webpack.config.dev.js b/client/coral-admin/webpack.config.dev.js index ca3b5cab5..277da1877 100644 --- a/client/coral-admin/webpack.config.dev.js +++ b/client/coral-admin/webpack.config.dev.js @@ -36,6 +36,12 @@ module.exports = { context: __dirname, postcss: [autoprefixer, precss] } + }), + new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify('development'), + 'VERSION': JSON.stringify(require("./package.json").version) + } }) ], resolve: { diff --git a/client/coral-admin/webpack.config.js b/client/coral-admin/webpack.config.js index 67d5aef22..92a758cce 100644 --- a/client/coral-admin/webpack.config.js +++ b/client/coral-admin/webpack.config.js @@ -35,6 +35,12 @@ module.exports = Object.assign({}, devConfig, { debug: false } }), - new webpack.optimize.UglifyJsPlugin() + new webpack.optimize.UglifyJsPlugin(), + new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify('production'), + 'VERSION': JSON.stringify(require("./package.json").version) + } + }) ] }) From ef3a34680a3eccaa4dc730c13811bc5cb774d931 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 15:52:09 -0300 Subject: [PATCH 02/20] config for pre git --- client/coral-admin/package.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/coral-admin/package.json b/client/coral-admin/package.json index 26f355e3d..b8e147c48 100644 --- a/client/coral-admin/package.json +++ b/client/coral-admin/package.json @@ -39,5 +39,14 @@ "style-loader": "0.13.1", "webpack": "2.1.0-beta.25", "webpack-dev-server": "1.16.1" + }, + "config": { + "pre-git": { + "commit-msg": [], + "pre-commit": [], + "pre-push": [], + "post-commit": [], + "post-merge": [] + } } } From b18104c8d9e0bf819bec210212ca8349729432e6 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 16:19:53 -0300 Subject: [PATCH 03/20] Layout Container and Route handling --- client/coral-admin/package.json | 2 +- client/coral-admin/src/AppRouter.js | 24 ++++++++++++++++++ client/coral-admin/src/components/App.js | 23 +++-------------- client/coral-admin/src/components/Header.js | 6 ++--- .../coral-admin/src/components/ui/Layout.js | 5 ++++ .../src/containers/LayoutContainer.js | 25 +++++++++++++++++++ 6 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 client/coral-admin/src/AppRouter.js create mode 100644 client/coral-admin/src/components/ui/Layout.js create mode 100644 client/coral-admin/src/containers/LayoutContainer.js diff --git a/client/coral-admin/package.json b/client/coral-admin/package.json index b8e147c48..3d82facbe 100644 --- a/client/coral-admin/package.json +++ b/client/coral-admin/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "build": "./node_modules/.bin/webpack --config webpack.config.js", - "watch": "./node_modules/.bin/webpack --config webpack.config.js --watch", + "watch": "./node_modules/.bin/webpack --config webpack.config.dev.js --watch", "start": "./node_modules/.bin/webpack-dev-server --config webpack.config.dev.js --inline --hot --content-base public --port 3142" }, "keywords": [], diff --git a/client/coral-admin/src/AppRouter.js b/client/coral-admin/src/AppRouter.js new file mode 100644 index 000000000..85bfbd49d --- /dev/null +++ b/client/coral-admin/src/AppRouter.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { Router, Route, Redirect, IndexRoute, IndexRedirect, browserHistory } from 'react-router'; + +import config from 'services/config' + +import ModerationQueue from 'containers/ModerationQueue' +import CommentStream from 'containers/CommentStream' +import EmbedLink from 'components/EmbedLink' +import Configure from 'containers/Configure' +import CommunityContainer from 'containers/CommunityContainer' + +const routes = ( + + + + + + + +); + +const AppRouter = () => ; + +export default AppRouter; diff --git a/client/coral-admin/src/components/App.js b/client/coral-admin/src/components/App.js index ff1c8f1d0..4e904257e 100644 --- a/client/coral-admin/src/components/App.js +++ b/client/coral-admin/src/components/App.js @@ -1,32 +1,17 @@ - import React from 'react' import { Provider } from 'react-redux' -import { Layout } from 'react-mdl' import 'material-design-lite' -import { Router, Route, browserHistory } from 'react-router' -import ModerationQueue from 'containers/ModerationQueue' +import { Layout } from 'react-mdl' import Header from 'components/Header' import store from 'services/store' -import CommentStream from 'containers/CommentStream' -import EmbedLink from 'components/EmbedLink' -import Configure from 'containers/Configure' -import config from 'services/config' + +import AppRouter from '../AppRouter' export default class App extends React.Component { render (props) { return ( - -
- - - - - - - -
-
+
) } diff --git a/client/coral-admin/src/components/Header.js b/client/coral-admin/src/components/Header.js index 88a92c7ef..6aed77913 100644 --- a/client/coral-admin/src/components/Header.js +++ b/client/coral-admin/src/components/Header.js @@ -9,9 +9,9 @@ export default (props) => (
- Moderate - Community - Configure + Moderate + Community + Configure
diff --git a/client/coral-admin/src/components/ui/Layout.js b/client/coral-admin/src/components/ui/Layout.js new file mode 100644 index 000000000..1daac2d8d --- /dev/null +++ b/client/coral-admin/src/components/ui/Layout.js @@ -0,0 +1,5 @@ +import React from 'react' + +export const Layout = () => ( + +) \ No newline at end of file diff --git a/client/coral-admin/src/containers/LayoutContainer.js b/client/coral-admin/src/containers/LayoutContainer.js new file mode 100644 index 000000000..1d0c0d4f5 --- /dev/null +++ b/client/coral-admin/src/containers/LayoutContainer.js @@ -0,0 +1,25 @@ +import React, { Component }from 'react' +import { connect } from 'react-redux' + +import Layout from '../components/ui/Layout' + +class LayoutContainer extends Component { + render () { + return + } +} + +LayoutContainer.propTypes = {}; + +const mapStateToProps = state => { + return { + data: {} + }; +}; + +const mapDispatchToProps = (dispatch, ownProps) => ({ + dispatch +}); + +export default connect(mapStateToProps, mapDispatchToProps, null)(LayoutContainer); + From b7c0602a2c4caba15cfe4d14711ae8052a1f7746 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 16:32:09 -0300 Subject: [PATCH 04/20] Header, Drawer, Layout --- client/coral-admin/src/AppRouter.js | 1 + client/coral-admin/src/components/Header.js | 15 ++------------- client/coral-admin/src/components/ui/Drawer.js | 14 ++++++++++++++ client/coral-admin/src/components/ui/Layout.js | 10 ++++++++-- .../coral-admin/src/containers/LayoutContainer.js | 2 +- 5 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 client/coral-admin/src/components/ui/Drawer.js diff --git a/client/coral-admin/src/AppRouter.js b/client/coral-admin/src/AppRouter.js index 85bfbd49d..55ff1a90f 100644 --- a/client/coral-admin/src/AppRouter.js +++ b/client/coral-admin/src/AppRouter.js @@ -8,6 +8,7 @@ import CommentStream from 'containers/CommentStream' import EmbedLink from 'components/EmbedLink' import Configure from 'containers/Configure' import CommunityContainer from 'containers/CommunityContainer' +import LayoutContainer from 'containers/LayoutContainer' const routes = ( diff --git a/client/coral-admin/src/components/Header.js b/client/coral-admin/src/components/Header.js index 6aed77913..ed60f497b 100644 --- a/client/coral-admin/src/components/Header.js +++ b/client/coral-admin/src/components/Header.js @@ -1,12 +1,9 @@ import React from 'react' -import { Layout, Navigation, Drawer, Header } from 'react-mdl' +import { Navigation, Header } from 'react-mdl' import { Link } from 'react-router' import styles from './Header.css' -import config from 'services/config' -// App header. If we add a navbar it should be here -export default (props) => ( - +export default () => (
Moderate @@ -14,12 +11,4 @@ export default (props) => ( Configure
- - - Moderate - Configure - - - {props.children} -
) diff --git a/client/coral-admin/src/components/ui/Drawer.js b/client/coral-admin/src/components/ui/Drawer.js new file mode 100644 index 000000000..ffb77fbfe --- /dev/null +++ b/client/coral-admin/src/components/ui/Drawer.js @@ -0,0 +1,14 @@ +import React from 'react' +import { Navigation, Drawer } from 'react-mdl' +import { Link } from 'react-router' +import styles from './Header.css' +import config from 'services/config' + +export default () => ( + + + Moderate + Configure + + +) diff --git a/client/coral-admin/src/components/ui/Layout.js b/client/coral-admin/src/components/ui/Layout.js index 1daac2d8d..cdc2f5b41 100644 --- a/client/coral-admin/src/components/ui/Layout.js +++ b/client/coral-admin/src/components/ui/Layout.js @@ -1,5 +1,11 @@ import React from 'react' +import { Layout as LayoutMDL} from 'react-mdl' +import Header from '../Header' -export const Layout = () => ( - +export const Layout = ({ children }) => ( + > +
+ + {children} + ) \ No newline at end of file diff --git a/client/coral-admin/src/containers/LayoutContainer.js b/client/coral-admin/src/containers/LayoutContainer.js index 1d0c0d4f5..a96d73505 100644 --- a/client/coral-admin/src/containers/LayoutContainer.js +++ b/client/coral-admin/src/containers/LayoutContainer.js @@ -1,7 +1,7 @@ import React, { Component }from 'react' import { connect } from 'react-redux' -import Layout from '../components/ui/Layout' +import { Layout } from '../components/ui/Layout' class LayoutContainer extends Component { render () { From 130fc259bf11446a1dce631d260b86c7cedb8c7c Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 16:36:52 -0300 Subject: [PATCH 05/20] Cleanup --- client/coral-admin/src/components/App.js | 1 - client/coral-admin/src/components/Header.js | 14 -------------- .../coral-admin/src/components/{ => ui}/Header.css | 0 client/coral-admin/src/components/ui/Header.js | 14 ++++++++++++++ client/coral-admin/src/components/ui/Layout.js | 5 +++-- 5 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 client/coral-admin/src/components/Header.js rename client/coral-admin/src/components/{ => ui}/Header.css (100%) create mode 100644 client/coral-admin/src/components/ui/Header.js diff --git a/client/coral-admin/src/components/App.js b/client/coral-admin/src/components/App.js index 4e904257e..1fbbe1448 100644 --- a/client/coral-admin/src/components/App.js +++ b/client/coral-admin/src/components/App.js @@ -2,7 +2,6 @@ import React from 'react' import { Provider } from 'react-redux' import 'material-design-lite' import { Layout } from 'react-mdl' -import Header from 'components/Header' import store from 'services/store' import AppRouter from '../AppRouter' diff --git a/client/coral-admin/src/components/Header.js b/client/coral-admin/src/components/Header.js deleted file mode 100644 index ed60f497b..000000000 --- a/client/coral-admin/src/components/Header.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react' -import { Navigation, Header } from 'react-mdl' -import { Link } from 'react-router' -import styles from './Header.css' - -export default () => ( -
- - Moderate - Community - Configure - -
-) diff --git a/client/coral-admin/src/components/Header.css b/client/coral-admin/src/components/ui/Header.css similarity index 100% rename from client/coral-admin/src/components/Header.css rename to client/coral-admin/src/components/ui/Header.css diff --git a/client/coral-admin/src/components/ui/Header.js b/client/coral-admin/src/components/ui/Header.js new file mode 100644 index 000000000..0c2d8753f --- /dev/null +++ b/client/coral-admin/src/components/ui/Header.js @@ -0,0 +1,14 @@ +import React from 'react' +import { Navigation, Header } from 'react-mdl' +import { Link } from 'react-router' +import styles from './Header.css' + +export default () => ( +
+ + Moderate + Community + Configure + +
+) diff --git a/client/coral-admin/src/components/ui/Layout.js b/client/coral-admin/src/components/ui/Layout.js index cdc2f5b41..fd963b667 100644 --- a/client/coral-admin/src/components/ui/Layout.js +++ b/client/coral-admin/src/components/ui/Layout.js @@ -1,9 +1,10 @@ import React from 'react' import { Layout as LayoutMDL} from 'react-mdl' -import Header from '../Header' +import Header from './Header' +import Drawer from './Drawer' export const Layout = ({ children }) => ( - > +
{children} From a36524a55f1879f81d1f2fc6af12ac45d6d21feb Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 17:21:12 -0300 Subject: [PATCH 06/20] merge --- client/coral-admin/postcss.config.js | 7 +++++++ views/admin.ejs | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 client/coral-admin/postcss.config.js create mode 100644 views/admin.ejs diff --git a/client/coral-admin/postcss.config.js b/client/coral-admin/postcss.config.js new file mode 100644 index 000000000..d5267160a --- /dev/null +++ b/client/coral-admin/postcss.config.js @@ -0,0 +1,7 @@ +module.exports = { + plugins: [ + require('postcss-smart-import')({ /* ...options */ }), + require('precss')({ /* ...options */ }), + require('autoprefixer')({ /* ...options */ }) + ] +} diff --git a/views/admin.ejs b/views/admin.ejs new file mode 100644 index 000000000..038fb58d7 --- /dev/null +++ b/views/admin.ejs @@ -0,0 +1,22 @@ + + + + + + Talk - Coral Admin + + + + + +
+ + + From cba476edfe05e07367ba4bde02f71da1194f2110 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 17:49:48 -0300 Subject: [PATCH 07/20] removing watch adding webpack const for env vars --- client/coral-admin/package.json | 1 - client/coral-admin/webpack.config.dev.js | 41 ------------------------ client/coral-admin/webpack.config.js | 1 + 3 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 client/coral-admin/webpack.config.dev.js diff --git a/client/coral-admin/package.json b/client/coral-admin/package.json index f19191581..190e6830b 100644 --- a/client/coral-admin/package.json +++ b/client/coral-admin/package.json @@ -5,7 +5,6 @@ "main": "index.js", "scripts": { "build": "./node_modules/.bin/webpack --config webpack.config.js", - "watch": "./node_modules/.bin/webpack --config webpack.config.dev.js --watch", "start": "./node_modules/.bin/webpack-dev-server --config webpack.config.dev.js --inline --hot --content-base public --port 3142" }, "keywords": [], diff --git a/client/coral-admin/webpack.config.dev.js b/client/coral-admin/webpack.config.dev.js deleted file mode 100644 index ac4b6fe07..000000000 --- a/client/coral-admin/webpack.config.dev.js +++ /dev/null @@ -1,41 +0,0 @@ -const path = require('path') -const autoprefixer = require('autoprefixer') -const precss = require('precss') - -module.exports = { - entry: { - 'bundle': path.join(__dirname, 'src', 'index') - }, - output: { - path: path.join(__dirname, '..', '..', 'dist', 'coral-admin'), - filename: '[name].js' - }, - module: { - loaders: [ - { test: /.js$/, loader: 'babel', include: path.join(__dirname, 'src'), exclude: /node_modules/ }, - { test: /\.json$/, loaders: 'json', include: __dirname, exclude: /node_modules/ }, - { test: /.css$/, loaders: ['style-loader', 'css-loader?modules&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss-loader'] } - ] - }, - plugins: [ - autoprefixer, - precss, - new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': JSON.stringify('development'), - 'VERSION': JSON.stringify(require("./package.json").version) - } - }) - ], - resolve: { - root: [ - path.resolve('./src'), - path.resolve('../') - ] - }, - devServer: { - historyApiFallback: { - index: '/' - } - } -} \ No newline at end of file diff --git a/client/coral-admin/webpack.config.js b/client/coral-admin/webpack.config.js index a92f5ec26..7b6f0ee5c 100644 --- a/client/coral-admin/webpack.config.js +++ b/client/coral-admin/webpack.config.js @@ -3,6 +3,7 @@ const devConfig = require('./webpack.config.dev') const autoprefixer = require('autoprefixer') const precss = require('precss') const Copy = require('copy-webpack-plugin') +const webpack = require('webpack') module.exports = Object.assign({}, devConfig, { module: { From ce31161ef942479dfbfb39174fabedba72b00c3a Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 18:22:27 -0300 Subject: [PATCH 08/20] Production webpack --- client/coral-admin/webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-admin/webpack.config.js b/client/coral-admin/webpack.config.js index 7b6f0ee5c..8aa87e0b3 100644 --- a/client/coral-admin/webpack.config.js +++ b/client/coral-admin/webpack.config.js @@ -19,7 +19,7 @@ module.exports = Object.assign({}, devConfig, { precss, new webpack.DefinePlugin({ 'process.env': { - 'NODE_ENV': JSON.stringify('development'), + 'NODE_ENV': JSON.stringify('production'), 'VERSION': JSON.stringify(require("./package.json").version) } }) From 8920a59a92feef4c1e9cd3596152b1d1bce4371c Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 18:25:54 -0300 Subject: [PATCH 09/20] =?UTF-8?q?=C3=A1dding=20dev=20back?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/coral-admin/webpack.config.dev.js | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 client/coral-admin/webpack.config.dev.js diff --git a/client/coral-admin/webpack.config.dev.js b/client/coral-admin/webpack.config.dev.js new file mode 100644 index 000000000..d58e33320 --- /dev/null +++ b/client/coral-admin/webpack.config.dev.js @@ -0,0 +1,32 @@ +const path = require('path') +const autoprefixer = require('autoprefixer') +const precss = require('precss') + +module.exports = { + entry: { + 'bundle': path.join(__dirname, 'src', 'index') + }, + output: { + path: path.join(__dirname, '..', '..', 'dist', 'coral-admin'), + filename: '[name].js' + }, + module: { + loaders: [ + { test: /.js$/, loader: 'babel', include: path.join(__dirname, 'src'), exclude: /node_modules/ }, + { test: /\.json$/, loaders: 'json', include: __dirname, exclude: /node_modules/ }, + { test: /.css$/, loaders: ['style-loader', 'css-loader?modules&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss-loader'] } + ] + }, + plugins: [ autoprefixer, precss ], + resolve: { + root: [ + path.resolve('./src'), + path.resolve('../') + ] + }, + devServer: { + historyApiFallback: { + index: '/' + } + } +} \ No newline at end of file From 285830211fab16b8652a2daa4189ef61895c61bd Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 18:46:50 -0300 Subject: [PATCH 10/20] Updated Links --- client/coral-admin/package.json | 2 +- client/coral-admin/src/AppRouter.js | 11 +++++------ client/coral-admin/src/components/ui/Drawer.js | 6 +++--- client/coral-admin/src/components/ui/Header.js | 6 +++--- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/client/coral-admin/package.json b/client/coral-admin/package.json index 190e6830b..c04809b0f 100644 --- a/client/coral-admin/package.json +++ b/client/coral-admin/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "build": "./node_modules/.bin/webpack --config webpack.config.js", + "build": "./node_modules/.bin/webpack --config webpack.config.js --watch", "start": "./node_modules/.bin/webpack-dev-server --config webpack.config.dev.js --inline --hot --content-base public --port 3142" }, "keywords": [], diff --git a/client/coral-admin/src/AppRouter.js b/client/coral-admin/src/AppRouter.js index 55ff1a90f..673a368f8 100644 --- a/client/coral-admin/src/AppRouter.js +++ b/client/coral-admin/src/AppRouter.js @@ -11,12 +11,11 @@ import CommunityContainer from 'containers/CommunityContainer' import LayoutContainer from 'containers/LayoutContainer' const routes = ( - - - - - - + + + + + ); diff --git a/client/coral-admin/src/components/ui/Drawer.js b/client/coral-admin/src/components/ui/Drawer.js index ffb77fbfe..b1c87baaf 100644 --- a/client/coral-admin/src/components/ui/Drawer.js +++ b/client/coral-admin/src/components/ui/Drawer.js @@ -2,13 +2,13 @@ import React from 'react' import { Navigation, Drawer } from 'react-mdl' import { Link } from 'react-router' import styles from './Header.css' -import config from 'services/config' export default () => ( - Moderate - Configure + Moderate + Community + Configure ) diff --git a/client/coral-admin/src/components/ui/Header.js b/client/coral-admin/src/components/ui/Header.js index 0c2d8753f..1455721d8 100644 --- a/client/coral-admin/src/components/ui/Header.js +++ b/client/coral-admin/src/components/ui/Header.js @@ -6,9 +6,9 @@ import styles from './Header.css' export default () => (
- Moderate - Community - Configure + Moderate + Community + Configure
) From c9453c3c2af9846e79970b105974743763e84459 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 18:48:43 -0300 Subject: [PATCH 11/20] Route nesting --- client/coral-admin/src/AppRouter.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/client/coral-admin/src/AppRouter.js b/client/coral-admin/src/AppRouter.js index 673a368f8..3fa2f431d 100644 --- a/client/coral-admin/src/AppRouter.js +++ b/client/coral-admin/src/AppRouter.js @@ -1,7 +1,5 @@ import React from 'react'; -import { Router, Route, Redirect, IndexRoute, IndexRedirect, browserHistory } from 'react-router'; - -import config from 'services/config' +import { Router, Route, Redirect, IndexRoute, browserHistory } from 'react-router'; import ModerationQueue from 'containers/ModerationQueue' import CommentStream from 'containers/CommentStream' @@ -11,11 +9,11 @@ import CommunityContainer from 'containers/CommunityContainer' import LayoutContainer from 'containers/LayoutContainer' const routes = ( - - - - - + + + + + ); From 52fd6c1618b0d7283de719f9d479d85a720ab173 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 18:50:40 -0300 Subject: [PATCH 12/20] Community route --- client/coral-admin/src/AppRouter.js | 1 + client/coral-admin/src/containers/CommunityContainer.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/coral-admin/src/AppRouter.js b/client/coral-admin/src/AppRouter.js index 3fa2f431d..8f24093d4 100644 --- a/client/coral-admin/src/AppRouter.js +++ b/client/coral-admin/src/AppRouter.js @@ -13,6 +13,7 @@ const routes = ( + ); diff --git a/client/coral-admin/src/containers/CommunityContainer.js b/client/coral-admin/src/containers/CommunityContainer.js index 6eb673125..7aed080d4 100644 --- a/client/coral-admin/src/containers/CommunityContainer.js +++ b/client/coral-admin/src/containers/CommunityContainer.js @@ -5,6 +5,10 @@ import translations from '../translations' export default class CommunityContainer extends Component { render() { - return
Hello
+ return ( +
+

Community

+
+ ) } } \ No newline at end of file From ad1d55557488989fa220b8c307f8cc6be0eeb738 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 18:51:52 -0300 Subject: [PATCH 13/20] Removing the watch --- client/coral-admin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-admin/package.json b/client/coral-admin/package.json index c04809b0f..190e6830b 100644 --- a/client/coral-admin/package.json +++ b/client/coral-admin/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "build": "./node_modules/.bin/webpack --config webpack.config.js --watch", + "build": "./node_modules/.bin/webpack --config webpack.config.js", "start": "./node_modules/.bin/webpack-dev-server --config webpack.config.dev.js --inline --hot --content-base public --port 3142" }, "keywords": [], From 6738ff86e15d709515a46c4379e2f2dc20b6345f Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 19:35:56 -0300 Subject: [PATCH 14/20] changes --- client/coral-admin/src/AppRouter.js | 10 +++++----- .../src/containers/CommunityContainer.js | 2 +- .../coral-admin/src/containers/LayoutContainer.js | 14 ++++---------- .../coral-admin/src/containers/ModerationQueue.js | 4 +--- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/client/coral-admin/src/AppRouter.js b/client/coral-admin/src/AppRouter.js index 8f24093d4..40465bd19 100644 --- a/client/coral-admin/src/AppRouter.js +++ b/client/coral-admin/src/AppRouter.js @@ -1,5 +1,5 @@ -import React from 'react'; -import { Router, Route, Redirect, IndexRoute, browserHistory } from 'react-router'; +import React from 'react' +import { Router, Route, Redirect, IndexRoute, browserHistory } from 'react-router' import ModerationQueue from 'containers/ModerationQueue' import CommentStream from 'containers/CommentStream' @@ -16,8 +16,8 @@ const routes = ( -); +) -const AppRouter = () => ; +const AppRouter = () => -export default AppRouter; +export default AppRouter diff --git a/client/coral-admin/src/containers/CommunityContainer.js b/client/coral-admin/src/containers/CommunityContainer.js index 7aed080d4..bd13ca04b 100644 --- a/client/coral-admin/src/containers/CommunityContainer.js +++ b/client/coral-admin/src/containers/CommunityContainer.js @@ -7,7 +7,7 @@ export default class CommunityContainer extends Component { render() { return (
-

Community

+

Community

) } diff --git a/client/coral-admin/src/containers/LayoutContainer.js b/client/coral-admin/src/containers/LayoutContainer.js index a96d73505..7373c30c2 100644 --- a/client/coral-admin/src/containers/LayoutContainer.js +++ b/client/coral-admin/src/containers/LayoutContainer.js @@ -9,17 +9,11 @@ class LayoutContainer extends Component { } } -LayoutContainer.propTypes = {}; +LayoutContainer.propTypes = {} -const mapStateToProps = state => { - return { - data: {} - }; -}; +const mapStateToProps = state => ({ data: {} }) -const mapDispatchToProps = (dispatch, ownProps) => ({ - dispatch -}); +const mapDispatchToProps = (dispatch, ownProps) => ({ dispatch }) -export default connect(mapStateToProps, mapDispatchToProps, null)(LayoutContainer); +export default connect(mapStateToProps, mapDispatchToProps)(LayoutContainer) diff --git a/client/coral-admin/src/containers/ModerationQueue.js b/client/coral-admin/src/containers/ModerationQueue.js index ba388b83f..8de522930 100644 --- a/client/coral-admin/src/containers/ModerationQueue.js +++ b/client/coral-admin/src/containers/ModerationQueue.js @@ -18,9 +18,7 @@ class ModerationQueue extends React.Component { constructor (props) { super(props) - - console.log('ModerationQueue', props) - + this.state = { activeTab: 'pending', singleView: false, modalOpen: false } } From 4b7b8336ad9153007d674520e537a78d1e251b16 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 19:42:58 -0300 Subject: [PATCH 15/20] Env vars --- client/coral-admin/src/containers/ModerationQueue.js | 2 +- client/coral-admin/webpack.config.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/coral-admin/src/containers/ModerationQueue.js b/client/coral-admin/src/containers/ModerationQueue.js index 8de522930..f35a69b02 100644 --- a/client/coral-admin/src/containers/ModerationQueue.js +++ b/client/coral-admin/src/containers/ModerationQueue.js @@ -18,7 +18,7 @@ class ModerationQueue extends React.Component { constructor (props) { super(props) - + this.state = { activeTab: 'pending', singleView: false, modalOpen: false } } diff --git a/client/coral-admin/webpack.config.js b/client/coral-admin/webpack.config.js index 8aa87e0b3..7e74fc08c 100644 --- a/client/coral-admin/webpack.config.js +++ b/client/coral-admin/webpack.config.js @@ -19,8 +19,8 @@ module.exports = Object.assign({}, devConfig, { precss, new webpack.DefinePlugin({ 'process.env': { - 'NODE_ENV': JSON.stringify('production'), - 'VERSION': JSON.stringify(require("./package.json").version) + 'NODE_ENV': `"${`production`}"`, + 'VERSION': `"${require("./package.json").version})"` } }) ] From 8fd7a46d372583dbd5a699b68fd261bed5c6a1ab Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 8 Nov 2016 19:52:37 -0300 Subject: [PATCH 16/20] removed log --- client/coral-admin/src/containers/ModerationQueue.js | 1 - 1 file changed, 1 deletion(-) diff --git a/client/coral-admin/src/containers/ModerationQueue.js b/client/coral-admin/src/containers/ModerationQueue.js index f35a69b02..d051e5639 100644 --- a/client/coral-admin/src/containers/ModerationQueue.js +++ b/client/coral-admin/src/containers/ModerationQueue.js @@ -57,7 +57,6 @@ class ModerationQueue extends React.Component { render () { const { comments } = this.props const { activeTab, singleView, modalOpen } = this.state - console.log('moderation queue', styles) return (
From a1fd4d32baf1612d1db933563a954a9bbdb33d26 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Tue, 8 Nov 2016 15:53:26 -0700 Subject: [PATCH 17/20] Added error middleware --- .eslintrc.json | 1 + app.js | 53 +++++++++++++++++++++++++++++++++++++++---- routes/admin/index.js | 9 ++++++++ views/error.ejs | 20 ++++++++++++++++ 4 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 routes/admin/index.js create mode 100644 views/error.ejs diff --git a/.eslintrc.json b/.eslintrc.json index 5df3444a6..23bdea410 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -55,6 +55,7 @@ "no-var": [2], "no-lonely-if": [2], "curly": [2], + "no-unused-vars": ["error", { "argsIgnorePattern": "next" }], "no-multiple-empty-lines": [ "error", {"max": 1} diff --git a/app.js b/app.js index d4041c93a..29817c970 100644 --- a/app.js +++ b/app.js @@ -11,14 +11,57 @@ app.use(bodyParser.json()); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); -// API Routes. +// Routes. app.use('/api/v1', require('./routes/api')); +app.use('/client', express.static(path.join(__dirname, 'dist'))); +app.use('/admin', require('./routes/admin')); -// Static Routes. -app.use('/client/', express.static(path.join(__dirname, 'dist'))); +//============================================================================== +// ERROR HANDLING +//============================================================================== -app.get('/admin*', (req, res) => { - res.render('admin', {basePath: '/client/coral-admin'}); +const ErrNotFound = new Error('Not Found'); +ErrNotFound.status = 404; + +// Catch 404 and forward to error handler. +app.use((req, res, next) => { + next(ErrNotFound); +}); + +// General error handler. Respond with the message and error if we have it while +// returning a status code that makes sense. +if (app.get('env') === 'development') { + app.use('/api', (err, req, res, next) => { + res.status(err.status || 500); + res.json({ + message: err.message, + error: err + }); + }); + + app.use('/', (err, req, res, next) => { + res.status(err.status || 500); + res.render('error', { + message: err.message, + error: err + }); + }); +} + +app.use('/api', (err, req, res, next) => { + res.status(err.status || 500); + res.json({ + message: err.message, + error: {} + }); +}); + +app.use('/', (err, req, res, next) => { + res.status(err.status || 500); + res.render('error', { + message: err.message, + error: {} + }); }); module.exports = app; diff --git a/routes/admin/index.js b/routes/admin/index.js new file mode 100644 index 000000000..86fcb018f --- /dev/null +++ b/routes/admin/index.js @@ -0,0 +1,9 @@ +const express = require('express'); + +const router = express.Router(); + +router.get('*', (req, res) => { + res.render('admin', {basePath: '/client/coral-admin'}); +}); + +module.exports = router; diff --git a/views/error.ejs b/views/error.ejs new file mode 100644 index 000000000..18d70b831 --- /dev/null +++ b/views/error.ejs @@ -0,0 +1,20 @@ + + + + + + + Error + + + + +
+ +
<%= message %>
+ +
<%= error.stack %>
+ +
+ + From 7d5eae2e2f198f0c4ab5ebc5e97070fdc44b4a4e Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Tue, 8 Nov 2016 16:21:50 -0700 Subject: [PATCH 18/20] Added embed stream preview --- routes/admin/index.js | 4 ++++ views/embed-stream.ejs | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 views/embed-stream.ejs diff --git a/routes/admin/index.js b/routes/admin/index.js index 86fcb018f..52957f54a 100644 --- a/routes/admin/index.js +++ b/routes/admin/index.js @@ -2,6 +2,10 @@ const express = require('express'); const router = express.Router(); +router.get('/embed/stream/preview', (req, res) => { + res.render('embed-stream', {basePath: '/client/embed/stream'}); +}); + router.get('*', (req, res) => { res.render('admin', {basePath: '/client/coral-admin'}); }); diff --git a/views/embed-stream.ejs b/views/embed-stream.ejs new file mode 100644 index 000000000..47bda6bee --- /dev/null +++ b/views/embed-stream.ejs @@ -0,0 +1,23 @@ + + + + + + Talk - Coral Admin + + + + + + +
+ + + From 72d01539fa5b1056639f94a7a48d8a8c026cb898 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 9 Nov 2016 10:16:07 -0300 Subject: [PATCH 19/20] Adding version and env --- webpack.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index d28ca9d14..434da160d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -7,7 +7,8 @@ devConfig.devtool = null; devConfig.plugins = devConfig.plugins.concat([ new webpack.DefinePlugin({ 'process.env': { - 'NODE_ENV': JSON.stringify('production') + 'NODE_ENV': `"${'production'}"`, + 'VERSION': `"${require('./package.json')}"` } }), new webpack.optimize.UglifyJsPlugin({ From e638d2785bd1b16338f1e9f1edc08fed29f968a6 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Wed, 9 Nov 2016 07:53:34 -0700 Subject: [PATCH 20/20] Some dep fixes which will hopefully resolve the CI issues --- package.json | 27 +++++++++++---------------- postcss.config.js | 7 +++++++ webpack.config.dev.js | 9 +++++++-- 3 files changed, 25 insertions(+), 18 deletions(-) create mode 100644 postcss.config.js diff --git a/package.json b/package.json index 02bd7bbe7..979475b5b 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ }, "homepage": "https://github.com/coralproject/talk#readme", "dependencies": { - "autoprefixer": "^6.5.2", "body-parser": "^1.15.2", "debug": "^2.2.0", "ejs": "^2.5.2", @@ -53,21 +52,20 @@ "uuid": "^2.0.3" }, "devDependencies": { - "autoprefixer": "6.5.0", - "babel-core": "^6.14.0", - "babel-jest": "^15.0.0", - "babel-loader": "^6.2.5", - "babel-plugin-transform-async-to-generator": "^6.8.0", + "autoprefixer": "^6.5.0", + "babel-core": "^6.18.2", + "babel-loader": "^6.2.7", + "babel-plugin-transform-async-to-generator": "^6.16.0", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-object-assign": "^6.8.0", "babel-plugin-transform-react-jsx": "^6.8.0", - "babel-polyfill": "^6.13.0", - "babel-preset-es2015": "6.13.0", + "babel-polyfill": "^6.16.0", + "babel-preset-es2015": "^6.18.0", "babel-preset-es2015-minimal": "^2.1.0", "babel-preset-stage-0": "^6.16.0", "chai": "^3.5.0", "chai-http": "^3.0.0", - "copy-webpack-plugin": "^3.0.1", + "copy-webpack-plugin": "^4.0.0", "css-loader": "^0.25.0", "eslint": "^3.9.1", "exports-loader": "^0.6.3", @@ -79,8 +77,9 @@ "material-design-lite": "^1.2.1", "mocha": "^3.1.2", "mocha-junit-reporter": "^1.12.1", - "postcss-loader": "^0.13.0", - "postcss-modules": "0.5.2", + "postcss-loader": "^1.1.0", + "postcss-modules": "^0.5.2", + "postcss-smart-import": "^0.5.1", "pre-git": "^3.10.0", "precss": "^1.4.0", "pym.js": "^1.1.1", @@ -95,11 +94,7 @@ "style-loader": "^0.13.1", "supertest": "^2.0.1", "timeago.js": "^2.0.3", - "webpack": "^1.13.2", - "webpack-dashboard": "^0.2.0", - "webpack-dev-middleware": "^1.8.3", - "webpack-hot-middleware": "^2.12.2", - "webpack-module-hot-accept": "^1.0.4", + "webpack": "^1.13.3", "whatwg-fetch": "^1.0.0" }, "engines": { diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 000000000..79fae36cb --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,7 @@ +module.exports = { + plugins: [ + require('postcss-smart-import')({ /* ...options */ }), + require('precss')({ /* ...options */ }), + require('autoprefixer')({ /* ...options */ }) + ] +}; diff --git a/webpack.config.dev.js b/webpack.config.dev.js index 73662d409..e2c92b396 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -52,7 +52,11 @@ module.exports = { exclude: /node_modules/ }, { - loaders: ['style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss-loader'], + loaders: [ + 'style-loader', + 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', + 'postcss-loader' + ], test: /.css$/, }, { @@ -86,5 +90,6 @@ module.exports = { ...buildTargets.map(target => path.join(__dirname, 'client', target, 'src')), ...buildEmbeds.map(embed => path.join(__dirname, 'client', `coral-embed-${embed}`, 'src')) ] - } + }, + postcss: require('./postcss.config.js') };