diff --git a/generators/app/index.js b/generators/app/index.js index 45911fc9..9467bfee 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -1,12 +1,10 @@ -var chalk = require("chalk"); -var pkg = require("../../package.json"); -var _ = require("lodash"); -var proptypes = require("prop-types"); -var mkdirp = require("mkdirp"); +var chalk = require('chalk'); +var pkg = require('../../package.json'); +var _ = require('lodash'); +var proptypes = require('prop-types'); +var mkdirp = require('mkdirp'); -// var reduxBeacon = require("redux-beacon"); TODO OBLIGATORIO - -var Generator = require("yeoman-generator"); +var Generator = require('yeoman-generator'); class GeneratorReact extends Generator { constructor(args, opts) { @@ -15,21 +13,21 @@ class GeneratorReact extends Generator { welcome() { var kickoffWelcome = - chalk.blue("\n ██╗ ██╗██╗ ██████╗██╗ ██╗ ") + - chalk.white("██████╗ ███████╗███████╗") + - chalk.blue("\n ██║ ██╔╝██║██╔════╝██║ ██╔╝") + - chalk.white("██╔═══██╗██╔════╝██╔════╝") + - chalk.blue("\n █████╔╝ ██║██║ █████╔╝ ") + - chalk.white("██║ ██║█████╗ █████╗") + - chalk.blue("\n ██╔═██╗ ██║██║ ██╔═██╗ ") + - chalk.white("██║ ██║██╔══╝ ██╔══╝") + - chalk.blue("\n ██║ ██╗██║╚██████╗██║ ██╗") + - chalk.white("╚██████╔╝██║ ██║") + - chalk.blue("\n ╚═╝ ╚═╝╚═╝ ╚═════╝╚═╝ ╚═╝ ") + - chalk.white("╚═════╝ ╚═╝ ╚═╝") + - "\n\n " + - chalk.blue.bold("Welcome Woloxer to the React kickoff") + - "\n\n "; + chalk.blue('\n ██╗ ██╗██╗ ██████╗██╗ ██╗ ') + + chalk.white('██████╗ ███████╗███████╗') + + chalk.blue('\n ██║ ██╔╝██║██╔════╝██║ ██╔╝') + + chalk.white('██╔═══██╗██╔════╝██╔════╝') + + chalk.blue('\n █████╔╝ ██║██║ █████╔╝ ') + + chalk.white('██║ ██║█████╗ █████╗') + + chalk.blue('\n ██╔═██╗ ██║██║ ██╔═██╗ ') + + chalk.white('██║ ██║██╔══╝ ██╔══╝') + + chalk.blue('\n ██║ ██╗██║╚██████╗██║ ██╗') + + chalk.white('╚██████╔╝██║ ██║') + + chalk.blue('\n ╚═╝ ╚═╝╚═╝ ╚═════╝╚═╝ ╚═╝ ') + + chalk.white('╚═════╝ ╚═╝ ╚═╝') + + '\n\n ' + + chalk.blue.bold('Welcome Woloxer to the React kickoff') + + '\n\n '; this.log(kickoffWelcome); } @@ -37,102 +35,45 @@ class GeneratorReact extends Generator { askFor() { var prompts = [ { - type: "input", - name: "projectName", - message: "Your Project name", - default: "Your project name", + type: 'input', + name: 'projectName', + message: 'Your Project name', + default: 'Example', store: true, + required: true, validate: val => String(val).match(/^[$A-Z_][0-9A-Z_$]*$/i) ? true : `${val} is not a valid name for a project. Please use a valid identifier name (alphanumeric).` }, { - type: "input", - name: "projectDescription", - message: "Description", - default: "Project description", + type: 'input', + name: 'projectDescription', + message: 'Description', + default: 'Description', store: true, + required: true, validate: val => String(val).match(/^[$A-Z_][0-9A-Z_$]*$/i) ? true : `${val} is not a valid description for a project. Please use a valid description (alphanumeric).` }, { - type: "input", - name: "repoUrl", - message: "What is the git repo url for this project?", - store: true - }, - { - type: "confirm", - name: "radium", - message: "Would you like to enable Radium?" - }, - { - type: "confirm", - name: "mobileDetect", - message: "Would you like to enable mobile-detect?" - }, - { - type: "confirm", - name: "moment", - message: "Would you like to enable moment?" - }, - { - type: "confirm", - name: "nukaCarousel", - message: "Would you like to enable nuka-carousel?" - }, - { - type: "confirm", - name: "numeral", - message: "Would you like to enable numeral?" - }, - { - type: "confirm", - name: "postcss", - message: "Would you like to enable postcss?" - }, - { - type: "confirm", - name: "reactAlert", - message: "Would you like to enable react-alert?" - }, - { - type: "confirm", - name: "reactModal", - message: "Would you like to enable react-modal?" - }, - { - type: "confirm", - name: "reactGoogleMaps", - message: "Would you like to enable react-google-maps?" - }, - { - type: "confirm", - name: "reactResponsive", - message: "Would you like to enable react-responsive?" - }, - { - type: "confirm", - name: "reactScroll", - message: "Would you like to enable react-scroll?" - }, - { - type: "confirm", - name: "reactShare", - message: "Would you like to enable react-share?" - }, - { - type: "confirm", - name: "reactVirtualized", - message: "Would you like to enable react-virtualized?" + type: 'input', + name: 'repoUrl', + message: 'What is the git repo url for this project?', + store: true, + required: true }, { - type: "confirm", - name: "recharts", - message: "Would you like to enable recharts?" + type: 'list', + name: 'typeOfBootstrap', + message: 'What type of bootstrap do you want?', + default: 'empty', + choices: [ + 'empty (react, redux, react-dom, redux-form, redux-beacon, redux-thunk, seamless-immutable, react-redux, react-router, react-router-dom, react-router-redux, apisauce, postcss, history, prop-types, lodash, i18next, reselect,)', + 'complete (radium, mobile-detect, moment, nuka-carousel, numeral, react-alert, react-modal, react-responsive, react-scroll, react-share, react-virtualized, recharts, react-google-maps)' + ] } ]; @@ -142,331 +83,262 @@ class GeneratorReact extends Generator { this[key] = answers[key]; } - this.includeRadium = answers.radium; - this.includeMobileDetect = answers.mobileDetect; - this.includeMoment = answers.moment; - this.includeNukaCarousel = answers.nukaCarousel; - this.includeNumeral = answers.numeral; - this.includeReactAlert = answers.reactAlert; - this.includeReactModal = answers.reactModal; - this.includeReactGoogleMaps = answers.reactGoogleMaps; - this.includeReactResponsive = answers.reactResponsive; - this.includeReactScroll = answers.reactScroll; - this.includeReactShare = answers.reactShare; - this.includeReactVirtualized = answers.reactVirtualized; - this.includeRecharts = answers.recharts; + this.includeAll = answers.typeOfBootstrap; }.bind(this) ); } addFiles() { this.fs.copyTpl( - this.templatePath("_package.json"), - this.destinationPath("package.json"), + this.templatePath('_package.json'), + this.destinationPath('package.json'), { projectName: this.projectName, projectNameSlugified: _.kebabCase(this.projectName), projectDescription: this.projectDescription, repoUrl: this.repoUrl, - includeRadium: this.includeRadium, - includeInext: this.includeInext, - includeMobileDetect: this.includeMobileDetect, - includeMoment: this.includeMoment, - includeNukaCarousel: this.includeNukaCarousel, - includeNumeral: this.includeNumeral, - includeReactAlert: this.includeReactAlert, - includeReactModal: this.includeReactModal, - includeReactGoogleMaps: this.includeReactGoogleMaps, - includeReactResponsive: this.includeReactResponsive, - includeReactScroll: this.includeReactScroll, - includeReactShare: this.includeReactShare, - includeReactVirtualized: this.includeReactVirtualized, - includeRecharts: this.includeRecharts + includeAll: this.includeAll } ); this.fs.copy( - this.templatePath("src/index.js"), - this.destinationPath("src/index.js"), + this.templatePath('src/index.js'), + this.destinationPath('src/index.js'), {} ); - mkdirp(this.destinationPath("src/app/assets/")); + mkdirp(this.destinationPath('src/app/assets/')); this.fs.copy( this.templatePath( - "src/app/components/Routes/components/AuthenticatedRoute.js" + 'src/app/components/Routes/components/AuthenticatedRoute.js' ), this.destinationPath( - "src/app/components/Routes/components/AuthenticatedRoute.js" + 'src/app/components/Routes/components/AuthenticatedRoute.js' ), {} ); this.fs.copy( - this.templatePath("src/app/components/Routes/constants.js"), - this.destinationPath("src/app/components/Routes/constants.js"), + this.templatePath('src/app/components/Routes/constants.js'), + this.destinationPath('src/app/components/Routes/constants.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/Routes/index.js"), - this.destinationPath("src/app/components/Routes/index.js"), + this.templatePath('src/app/components/Routes/index.js'), + this.destinationPath('src/app/components/Routes/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/Routes/styles.js"), - this.destinationPath("src/app/components/Routes/styles.js"), + this.templatePath('src/app/components/Routes/styles.js'), + this.destinationPath('src/app/components/Routes/styles.js'), {} ); this.fs.copy( - this.templatePath("src/app/index.js"), - this.destinationPath("src/app/index.js"), + this.templatePath('src/app/index.js'), + this.destinationPath('src/app/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/styles.js"), - this.destinationPath("src/app/styles.js"), + this.templatePath('src/config/api.js'), + this.destinationPath('src/config/api.js'), {} ); this.fs.copy( - this.templatePath("src/config/api.js"), - this.destinationPath("src/config/api.js"), + this.templatePath('src/config/i18n.js'), + this.destinationPath('src/config/i18n.js'), {} ); this.fs.copy( - this.templatePath("src/config/i18n.js"), - this.destinationPath("src/config/i18n.js"), + this.templatePath('src/config/perf.js'), + this.destinationPath('src/config/perf.js'), {} ); this.fs.copy( - this.templatePath("src/config/perf.js"), - this.destinationPath("src/config/perf.js"), + this.templatePath('src/redux'), + this.destinationPath('src/redux'), {} ); this.fs.copy( - this.templatePath("src/redux"), - this.destinationPath("src/redux"), + this.templatePath('src/redux/store.js'), + this.destinationPath('src/redux/store.js'), {} ); this.fs.copy( - this.templatePath("src/redux/store.js"), - this.destinationPath("src/redux/store.js"), + this.templatePath('src/redux/Auth/actions.js'), + this.destinationPath('src/redux/Auth/actions.js'), {} ); this.fs.copy( - this.templatePath("src/redux/Auth/actions.js"), - this.destinationPath("src/redux/Auth/actions.js"), + this.templatePath('src/redux/Auth/reducer.js'), + this.destinationPath('src/redux/Auth/reducer.js'), {} ); this.fs.copy( - this.templatePath("src/redux/Auth/reducer.js"), - this.destinationPath("src/redux/Auth/reducer.js"), + this.templatePath('src/services'), + this.destinationPath('src/services'), {} ); this.fs.copy( - this.templatePath("src/services"), - this.destinationPath("src/services"), + this.templatePath('src/utils'), + this.destinationPath('src/utils'), {} ); this.fs.copy( - this.templatePath("src/utils"), - this.destinationPath("src/utils"), + this.templatePath('src/utils/colors.js'), + this.destinationPath('src/utils/colors.js'), {} ); this.fs.copy( - this.templatePath("src/utils/colors.js"), - this.destinationPath("src/utils/colors.js"), + this.templatePath('src/utils/array.js'), + this.destinationPath('src/utils/array.js'), {} ); this.fs.copy( - this.templatePath("src/utils/array.js"), - this.destinationPath("src/utils/array.js"), + this.templatePath('gitignore'), + this.destinationPath('.gitignore'), {} ); this.fs.copy( - this.templatePath("gitignore"), - this.destinationPath(".gitignore"), - {} - ); - this.fs.copy( - this.templatePath("eslintrc.js"), - this.destinationPath(".eslintrc.js"), + this.templatePath('eslintrc.js'), + this.destinationPath('.eslintrc.js'), {} ); this.fs.copyTpl( - this.templatePath("public/_index.html"), - this.destinationPath("public/index.html"), + this.templatePath('public/_index.html'), + this.destinationPath('public/index.html'), { projectName: this.projectName } ); - if (this.includeNumeral) { + if (this.includeAll) { this.fs.copy( - this.templatePath("src/config/numeral.js"), - this.destinationPath("src/config/numeral.js"), + this.templatePath('src/config/numeral.js'), + this.destinationPath('src/config/numeral.js'), {} ); } - if (this.includeReduxBeacon) { + if (this.includeAll) { this.fs.copy( - this.templatePath("src/services/AnalyticsService.js"), - this.destinationPath("src/services/AnalyticsService.js"), + this.templatePath('src/services/AnalyticsService.js'), + this.destinationPath('src/services/AnalyticsService.js'), {} ); } this.fs.copy( - this.templatePath("src/services/AuthServices.js"), - this.destinationPath("src/services/AuthServices.js"), + this.templatePath('src/services/AuthServices.js'), + this.destinationPath('src/services/AuthServices.js'), {} ); this.fs.copy( - this.templatePath("src/services/LocalStorageService.js"), - this.destinationPath("src/services/LocalStorageService.js"), + this.templatePath('src/services/LocalStorageService.js'), + this.destinationPath('src/services/LocalStorageService.js'), {} ); - if (this.includeRadium) { - this.fs.copy( - this.templatePath("src/app/components/Button/index.js"), - this.destinationPath("src/app/components/Button/index.js"), - {} - ); - this.fs.copy( - this.templatePath("src/app/components/Button/styles.js"), - this.destinationPath("src/app/components/Button/styles.js"), - {} - ); - this.fs.copy( - this.templatePath("src/app/components/Checkbox/index.js"), - this.destinationPath("src/app/components/Checkbox/index.js"), - {} - ); - this.fs.copy( - this.templatePath("src/app/components/Checkbox/styles.js"), - this.destinationPath("src/app/components/Checkbox/styles.js"), - {} - ); - this.fs.copy( - this.templatePath("src/app/components/Label/index.js"), - this.destinationPath("src/app/components/Label/index.js"), - {} - ); - this.fs.copy( - this.templatePath("src/app/components/Label/styles.js"), - this.destinationPath("src/app/components/Label/styles.js"), - {} - ); - this.fs.copy( - this.templatePath("src/app/components/RadioButton/index.js"), - this.destinationPath("src/app/components/RadioButton/index.js"), - {} - ); + if (this.includeAll) { this.fs.copy( - this.templatePath("src/app/components/RadioButton/styles.js"), - this.destinationPath("src/app/components/RadioButton/styles.js"), + this.templatePath('src/app/components/Button/index.js'), + this.destinationPath('src/app/components/Button/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/TextArea/index.js"), - this.destinationPath("src/app/components/TextArea/index.js"), + this.templatePath('src/app/components/Button/styles.js'), + this.destinationPath('src/app/components/Button/styles.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/TextArea/styles.js"), - this.destinationPath("src/app/components/TextArea/styles.js"), + this.templatePath('src/app/components/Checkbox/index.js'), + this.destinationPath('src/app/components/Checkbox/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/TextInput/index.js"), - this.destinationPath("src/app/components/TextInput/index.js"), + this.templatePath('src/app/components/Checkbox/styles.js'), + this.destinationPath('src/app/components/Checkbox/styles.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/TextInput/styles.js"), - this.destinationPath("src/app/components/TextInput/styles.js"), + this.templatePath('src/app/components/Label/index.js'), + this.destinationPath('src/app/components/Label/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/Touchable/index.js"), - this.destinationPath("src/app/components/Touchable/index.js"), + this.templatePath('src/app/components/Label/styles.js'), + this.destinationPath('src/app/components/Label/styles.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/Touchable/styles.js"), - this.destinationPath("src/app/components/Touchable/styles.js"), + this.templatePath('src/app/components/RadioButton/index.js'), + this.destinationPath('src/app/components/RadioButton/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/Spinner/index.js"), - this.destinationPath("src/app/components/Spinner/index.js"), + this.templatePath('src/app/components/RadioButton/styles.js'), + this.destinationPath('src/app/components/RadioButton/styles.js'), {} ); this.fs.copy( - this.templatePath("src/app/components/Spinner/styles.js"), - this.destinationPath("src/app/components/Spinner/styles.js"), + this.templatePath('src/app/components/TextArea/index.js'), + this.destinationPath('src/app/components/TextArea/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/screens/Dashboard/index.js"), - this.destinationPath("src/app/screens/Dashboard/index.js"), + this.templatePath('src/app/components/TextArea/styles.js'), + this.destinationPath('src/app/components/TextArea/styles.js'), {} ); this.fs.copy( - this.templatePath("src/app/screens/Dashboard/styles.js"), - this.destinationPath("src/app/screens/Dashboard/styles.js"), + this.templatePath('src/app/components/TextInput/index.js'), + this.destinationPath('src/app/components/TextInput/index.js'), {} ); this.fs.copy( - this.templatePath("src/constants/fonts.js"), - this.destinationPath("src/constants/fonts.js"), + this.templatePath('src/app/components/TextInput/styles.js'), + this.destinationPath('src/app/components/TextInput/styles.js'), {} ); this.fs.copy( - this.templatePath("src/constants/sizes.js"), - this.destinationPath("src/constants/sizes.js"), + this.templatePath('src/app/components/Touchable/index.js'), + this.destinationPath('src/app/components/Touchable/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/screens/Dashboard/screens/Home/index.js"), - this.destinationPath("src/app/screens/Dashboard/screens/Home/index.js"), + this.templatePath('src/app/components/Touchable/styles.js'), + this.destinationPath('src/app/components/Touchable/styles.js'), {} ); this.fs.copy( - this.templatePath("src/app/screens/Dashboard/screens/Home/layout.js"), - this.destinationPath( - "src/app/screens/Dashboard/screens/Home/layout.js" - ), + this.templatePath('src/app/components/Spinner/index.js'), + this.destinationPath('src/app/components/Spinner/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/screens/Dashboard/screens/Home/styles.js"), - this.destinationPath( - "src/app/screens/Dashboard/screens/Home/styles.js" - ), + this.templatePath('src/app/components/Spinner/styles.js'), + this.destinationPath('src/app/components/Spinner/styles.js'), {} ); this.fs.copy( - this.templatePath("src/app/screens/Login/index.js"), - this.destinationPath("src/app/screens/Login/index.js"), + this.templatePath('src/app/screens/Dashboard/index.js'), + this.destinationPath('src/app/screens/Dashboard/index.js'), {} ); this.fs.copy( - this.templatePath("src/app/screens/Login/layout.js"), - this.destinationPath("src/app/screens/Login/layout.js"), + this.templatePath('src/constants/fonts.js'), + this.destinationPath('src/constants/fonts.js'), {} ); this.fs.copy( - this.templatePath("src/app/screens/Login/strings.js"), - this.destinationPath("src/app/screens/Login/strings.js"), + this.templatePath('src/constants/sizes.js'), + this.destinationPath('src/constants/sizes.js'), {} ); this.fs.copy( - this.templatePath("src/app/screens/Login/styles.js"), - this.destinationPath("src/app/screens/Login/styles.js"), + this.templatePath('src/app/screens/Dashboard/screens/Home/index.js'), + this.destinationPath('src/app/screens/Dashboard/screens/Home/index.js'), {} ); this.fs.copy( - this.templatePath("pull_request_template.md"), - this.destinationPath("pull_request_template.md"), + this.templatePath('pull_request_template.md'), + this.destinationPath('pull_request_template.md'), {} ); } diff --git a/generators/app/templates/_package.json b/generators/app/templates/_package.json index 86aaff7d..9932df52 100644 --- a/generators/app/templates/_package.json +++ b/generators/app/templates/_package.json @@ -8,55 +8,19 @@ "url": "<%= repoUrl %>" }, "dependencies": { - <% if (includeRadium) {%> - "radium": "^0.19.4",<% - } - - if (includeMobileDetect) {%> - "mobile-detect": "^1.3.7",<% - } - - if (includeMoment) {%> - "moment": "^2.18.1",<% - } - - if (includeNukaCarousel) {%> - "nuka-carousel": "^2.3.0",<% - } - - if (includeNumeral) {%> - "numeral": "^2.0.6",<% - } - - if (includeReactAlert) {%> - "react-alert": "^2.3.0",<% - } - - if (includeReactModal) {%> - "react-modal": "^2.3.2",<% - } - - if (includeReactResponsive) {%> - "react-responsive": "^1.3.4",<% - } - - if (includeReactScroll) {%> - "react-scroll": "^1.5.4",<% - } - - if (includeReactShare) {%> - "react-share": "^1.16.0",<% - } - - if (includeReactVirtualized) {%> - "react-virtualized": "^9.9.0",<% - } - - if (includeRecharts) {%> - "recharts": "^1.0.0-alpha.4",<% - } - - if (includeReactGoogleMaps) {%> + <% if (includeAll) {%> + "radium": "^0.19.4", + "mobile-detect": "^1.3.7", + "moment": "^2.18.1", + "nuka-carousel": "^2.3.0", + "numeral": "^2.0.6", + "react-alert": "^2.3.0", + "react-modal": "^2.3.2", + "react-responsive": "^1.3.4", + "react-scroll": "^1.5.4", + "react-share": "^1.16.0", + "react-virtualized": "^9.9.0", + "recharts": "^1.0.0-alpha.4", "react-google-maps": "^7.3.0",<% }%> "reselect": "^3.0.1", @@ -67,7 +31,6 @@ "postcss": "^6.0.11", "prop-types": "^15.5.10", "react": "^15.6.1", - "react-addons-perf": "^15.4.2", "react-dom": "^15.6.1", "react-redux": "^5.0.6", "react-router": "^4.2.0", diff --git a/generators/app/templates/src/app/components/Routes/index.js b/generators/app/templates/src/app/components/Routes/index.js index 1d4f3619..a26d9daf 100644 --- a/generators/app/templates/src/app/components/Routes/index.js +++ b/generators/app/templates/src/app/components/Routes/index.js @@ -3,8 +3,7 @@ import { ConnectedRouter } from "react-router-redux"; import { Switch } from "react-router-dom"; import { history } from "../../../redux/store"; -import Home from "../../screens/Dashboard/screens/Home"; -import Login from "../../screens/Login"; +import Home from "../../screens/Dashboard"; import AuthenticatedRoute from "./components/AuthenticatedRoute"; import * as Routes from "./constants"; @@ -21,12 +20,6 @@ function AppRoutes() { path={Routes.HOME} component={Home} /> - diff --git a/generators/app/templates/src/app/index.js b/generators/app/templates/src/app/index.js index 3882bce5..b7a48b5b 100644 --- a/generators/app/templates/src/app/index.js +++ b/generators/app/templates/src/app/index.js @@ -1,10 +1,9 @@ -import React, { Component } from "react"; -import { connect } from "react-redux"; -import { StyleRoot } from "radium"; +import React, { Component } from 'react'; +import { connect } from 'react-redux'; -import { apiSetup } from "../config/api"; +import { apiSetup } from '../config/api'; -import Routes from "./components/Routes"; +import Routes from './components/Routes'; class App extends Component { componentDidMount() { @@ -12,11 +11,7 @@ class App extends Component { } render() { - return ( - - - - ); + return ; } } diff --git a/generators/app/templates/src/app/screens/Dashboard/index.js b/generators/app/templates/src/app/screens/Dashboard/index.js index bbe717aa..5af27184 100644 --- a/generators/app/templates/src/app/screens/Dashboard/index.js +++ b/generators/app/templates/src/app/screens/Dashboard/index.js @@ -1,31 +1,17 @@ -import React from "react"; -import { connect } from "react-redux"; -import Radium from "radium"; -import { Route, Switch, Redirect } from "react-router-dom"; -import PropTypes from "prop-types"; +import React from 'react'; +import { connect } from 'react-redux'; +import { Route, Switch, Redirect } from 'react-router-dom'; -import * as Routes from "../../components/Routes/constants"; +import * as Routes from '../../components/Routes/constants'; -import Home from "./screens/Home"; -import Login from "../Login"; +import Home from './screens/Home'; -import styles from "./styles"; - -function Dashboard({ loading }) { +function Dashboard() { return ( -
-
- {/* - */} -
- - - - } /> - -
-
-
+ + + } /> + ); } @@ -33,8 +19,4 @@ Dashboard.defaultProps = { loading: false }; -Dashboard.propTypes = { - loading: PropTypes.bool.isRequired -}; - -export default connect()(Radium(Dashboard)); +export default connect()(Dashboard); diff --git a/generators/app/templates/src/app/screens/Dashboard/screens/Home/index.js b/generators/app/templates/src/app/screens/Dashboard/screens/Home/index.js index 2916b29b..72e59840 100644 --- a/generators/app/templates/src/app/screens/Dashboard/screens/Home/index.js +++ b/generators/app/templates/src/app/screens/Dashboard/screens/Home/index.js @@ -1,17 +1,5 @@ -import React, { Component } from "react"; -import { connect } from "react-redux"; +import React from "react"; -import { actionCreators as authActions } from "../../../../../redux/Auth/actions"; -import Home from "./layout"; - -class HomeContainer extends Component { - handleLogout = () => { - this.props.dispatch(authActions.logout()); - }; - - render() { - return ; - } +export default function Home() { + return
; } - -export default connect()(HomeContainer); diff --git a/generators/app/templates/src/app/screens/Dashboard/screens/Home/layout.js b/generators/app/templates/src/app/screens/Dashboard/screens/Home/layout.js deleted file mode 100644 index c0620ffa..00000000 --- a/generators/app/templates/src/app/screens/Dashboard/screens/Home/layout.js +++ /dev/null @@ -1,21 +0,0 @@ -import React from "react"; -import PropTypes from "prop-types"; - -import Button from "../../../../components/Button"; -import Label from "../../../../components/Label"; - -import styles from "./styles"; - -export default function Home({ onLogout }) { - return ( -
- -
- ); -} - -Home.propTypes = { - onLogout: PropTypes.func.isRequired -}; diff --git a/generators/app/templates/src/app/screens/Dashboard/screens/Home/styles.js b/generators/app/templates/src/app/screens/Dashboard/screens/Home/styles.js deleted file mode 100644 index c38ee11c..00000000 --- a/generators/app/templates/src/app/screens/Dashboard/screens/Home/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -import { green } from "../../../../../utils/colors"; - -export default { - container: { - flex: 1, - alignItems: "center", - justifyContent: "center" - }, - mainButton: { - backgroundColor: green, - padding: 10, - borderRadius: 3 - } -}; diff --git a/generators/app/templates/src/app/screens/Dashboard/styles.js b/generators/app/templates/src/app/screens/Dashboard/styles.js deleted file mode 100644 index 7609b4c3..00000000 --- a/generators/app/templates/src/app/screens/Dashboard/styles.js +++ /dev/null @@ -1,23 +0,0 @@ -// TODO Add this if you need it -// import { sidebarSize, topbarSize } from "../../../constants/sizes"; - -export default { - base: { - textAlign: "center", - display: "flex", - height: "100%" - }, - content: { - // TODO Add this if you need it - // height: `calc(100% - ${topbarSize}px)`, - // marginLeft: sidebarSize, - // marginTop: topbarSize, - // width: `calc(100% - ${sidebarSize}px)` - height: "100%", - width: "100%" - }, - baseContent: { - width: "100%", - flex: 4 - } -}; diff --git a/generators/app/templates/src/app/screens/Login/index.js b/generators/app/templates/src/app/screens/Login/index.js deleted file mode 100644 index f1a72c33..00000000 --- a/generators/app/templates/src/app/screens/Login/index.js +++ /dev/null @@ -1,36 +0,0 @@ -import React, { Component } from "react"; -import { connect } from "react-redux"; - -import { actionCreators as authActions } from "../../../redux/Auth/actions"; - -import Login from "./layout"; - -class LoginContainer extends Component { - state = { invalidInput: false }; - handleSubmit = values => { - const invalidateUser = false; // TODO: Add validation logic - const invalidatePass = false; // TODO: Add validation logic - if ( - values.username === "" || - values.password === "" || - invalidateUser || - invalidatePass - ) { - this.setState({ invalidInput: true }); - } else { - this.setState({ invalidInput: false }); - this.props.dispatch(authActions.login()); - } - }; - - render() { - return ( - - ); - } -} - -export default connect()(LoginContainer); diff --git a/generators/app/templates/src/app/screens/Login/layout.js b/generators/app/templates/src/app/screens/Login/layout.js deleted file mode 100644 index f8ba74d8..00000000 --- a/generators/app/templates/src/app/screens/Login/layout.js +++ /dev/null @@ -1,79 +0,0 @@ -import React from "react"; -import { reduxForm, Field } from "redux-form"; -import PropTypes from "prop-types"; - -import Button from "../../components/Button"; -import { transparent } from "../../../utils/colors"; -import Label from "../../components/Label"; -import TextInput from "../../components/TextInput"; -import InputValidations from "../../../utils/inputValidations"; -import { white } from "../../../utils/colors"; - -import * as Strings from "./strings"; -import styles from "./styles"; - -const userValidations = [ - InputValidations.required(`El ${Strings.user} es requerido`), - InputValidations.minLength(7, Strings.userMinLength), - InputValidations.maxLength(11, Strings.userMaxLength), - InputValidations.numericalDigits(Strings.userFormat) -]; - -const passwordValidations = [ - InputValidations.required(`El ${Strings.password} es requerido`), - InputValidations.minLength(8, Strings.passwordMinLength), - InputValidations.maxLength(255, Strings.passwordMaxLength) -]; - -function Login({ handleSubmit, invalidInput }) { - return ( -
-
- -
-
- -
- - -
- - -
-
- ); -} - -Login.propTypes = { - handleSubmit: PropTypes.func.isRequired, - invalidInput: PropTypes.bool.isRequired -}; - -export default reduxForm({ - form: Strings.formName, - initialValues: { username: "", password: "" } -})(Login); diff --git a/generators/app/templates/src/app/screens/Login/strings.js b/generators/app/templates/src/app/screens/Login/strings.js deleted file mode 100644 index ca039a11..00000000 --- a/generators/app/templates/src/app/screens/Login/strings.js +++ /dev/null @@ -1,10 +0,0 @@ -// Labels -exports.user = "Usuario"; -exports.password = "Contraseña"; -exports.forgotPassword = "Olvidé mi contraseña"; -exports.validationMessage = "Contraseña incorrecta"; -exports.submit = "INGRESAR"; -exports.signUp = "REGISTRARSE"; - -// Others -exports.formName = "loginForm"; diff --git a/generators/app/templates/src/app/screens/Login/styles.js b/generators/app/templates/src/app/screens/Login/styles.js deleted file mode 100644 index 28110940..00000000 --- a/generators/app/templates/src/app/screens/Login/styles.js +++ /dev/null @@ -1,27 +0,0 @@ -import { green, blue, transparent } from "../../../utils/colors"; - -export default { - container: { - flex: 1, - alignItems: "center", - justifyContent: "center" - }, - formElementContainer: { - backgroundColor: transparent, - borderBottomColor: blue, - borderBottomWidth: 1 - }, - formElement: { - padding: 3, - margin: 5, - backgroundColor: transparent, - height: 30, - width: 200 - }, - formButton: { - backgroundColor: green, - padding: 10, - borderRadius: 3, - margin: 20 - } -}; diff --git a/generators/app/templates/src/app/styles.js b/generators/app/templates/src/app/styles.js deleted file mode 100644 index fc45f889..00000000 --- a/generators/app/templates/src/app/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from "react"; -import { Style } from "radium"; - -const styles = { - "body, html, #root, [data-reactroot]": { - padding: 0, - margin: 0, - // TODO Add fontFamily - // fontFamily: , - height: "100%" - } -}; - -export default