diff --git a/client/gatsby-config.js b/client/gatsby-config.js index 4311a7fca8..0c376ecc90 100644 --- a/client/gatsby-config.js +++ b/client/gatsby-config.js @@ -11,7 +11,14 @@ module.exports = { 'gatsby-plugin-react-helmet', { resolve: 'gatsby-plugin-create-client-paths', - options: { prefixes: ['/certification/*', '/unsubscribed/*', '/user/*'] } + options: { + prefixes: [ + '/certification/*', + '/unsubscribed/*', + '/user/*', + '/settings/*' + ] + } }, { resolve: 'gatsby-plugin-manifest', diff --git a/client/src/client-only-routes/ShowSettings.js b/client/src/client-only-routes/ShowSettings.js new file mode 100644 index 0000000000..abc6a888cd --- /dev/null +++ b/client/src/client-only-routes/ShowSettings.js @@ -0,0 +1,129 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { bindActionCreators } from 'redux'; +import { connect } from 'react-redux'; +import { createSelector } from 'reselect'; +import { Grid, Button } from '@freecodecamp/react-bootstrap'; + +import { signInLoadingSelector, userSelector } from '../redux'; + +import Layout from '../components/Layout'; +import Spacer from '../components/helpers/Spacer'; +import Loader from '../components/helpers/Loader'; +import { FullWidthRow } from '../components/helpers'; +import About from '../components/settings/About'; + +const propTypes = { + about: PropTypes.string, + location: PropTypes.string, + name: PropTypes.string, + picture: PropTypes.string, + points: PropTypes.number, + showLoading: PropTypes.bool, + theme: PropTypes.string, + username: PropTypes.string +}; + +const mapStateToProps = createSelector( + signInLoadingSelector, + userSelector, + ( + showLoading, + { username = '', about, picture, points, name, location, theme } + ) => ({ + showLoading, + username, + about, + picture, + points, + name, + theme, + location + }) +); + +const mapDispatchToProps = dispatch => bindActionCreators({}, dispatch); + +function ShowSettings(props) { + const { + showLoading, + username, + about, + picture, + points, + theme, + location, + name + } = props; + + if (showLoading) { + return ( + +
+ +
+
+ ); + } + + return ( + + + + + + + + +

{`Account Settings for ${username}`}

+ {/* + + + + + + + + + + + + + + */} +
+
+ ); +} + +ShowSettings.displayName = 'ShowSettings'; +ShowSettings.propTypes = propTypes; + +export default connect( + mapStateToProps, + mapDispatchToProps +)(ShowSettings); diff --git a/client/src/components/helpers/ButtonSpacer.js b/client/src/components/helpers/ButtonSpacer.js index 3e46a8654a..8ac663d857 100644 --- a/client/src/components/helpers/ButtonSpacer.js +++ b/client/src/components/helpers/ButtonSpacer.js @@ -1,7 +1,7 @@ import React from 'react'; function ButtonSpacer() { - return
; + return
; } ButtonSpacer.displayName = 'ButtonSpacer'; diff --git a/client/src/components/helpers/form/BlockSaveButton.js b/client/src/components/helpers/form/BlockSaveButton.js new file mode 100644 index 0000000000..ffb8a50180 --- /dev/null +++ b/client/src/components/helpers/form/BlockSaveButton.js @@ -0,0 +1,24 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Button } from '@freecodecamp/react-bootstrap'; + +function BlockSaveButton({ children, ...restProps }) { + return ( + + ); +} + +BlockSaveButton.displayName = 'BlockSaveButton'; +BlockSaveButton.propTypes = { + children: PropTypes.any +}; + +export default BlockSaveButton; diff --git a/client/src/components/helpers/form/BlockSaveWrapper.js b/client/src/components/helpers/form/BlockSaveWrapper.js new file mode 100644 index 0000000000..2fcb127b00 --- /dev/null +++ b/client/src/components/helpers/form/BlockSaveWrapper.js @@ -0,0 +1,23 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +const propTypes = { + children: PropTypes.node +}; + +const style = { + padding: '0 15px' +}; + +function BlockSaveWrapper({ children, ...restProps }) { + return ( +
+ {children} +
+ ); +} + +BlockSaveWrapper.displayName = 'BlockSaveWrapper'; +BlockSaveWrapper.propTypes = propTypes; + +export default BlockSaveWrapper; diff --git a/client/src/pages/settings.js b/client/src/pages/settings.js new file mode 100644 index 0000000000..ac1ef0b5e8 --- /dev/null +++ b/client/src/pages/settings.js @@ -0,0 +1,18 @@ +import React from 'react'; +import { Router } from '@reach/router'; + +import RedirectHome from '../components/RedirectHome'; +import ShowSettings from '../client-only-routes/ShowSettings'; + +function Settings() { + return ( + + + + + ); +} + +Settings.displayName = 'Settings'; + +export default Settings;