diff --git a/packages/concordia-app/.eslintrc.js b/packages/concordia-app/.eslintrc.js index bd3cafc..96481bd 100644 --- a/packages/concordia-app/.eslintrc.js +++ b/packages/concordia-app/.eslintrc.js @@ -43,7 +43,12 @@ module.exports = { 'no-unused-vars': 'warn', 'no-console': 'warn', 'no-shadow': 'warn', - "no-multi-str": "warn" + "no-multi-str": "warn", + "jsx-a11y/label-has-associated-control": [ 2, { + "labelAttributes": ["label"], + "controlComponents": ["Input"], + "depth": 3, + }], }, 'settings': { 'import/resolver': { diff --git a/packages/concordia-app/package.json b/packages/concordia-app/package.json index b9208e0..d214d90 100644 --- a/packages/concordia-app/package.json +++ b/packages/concordia-app/package.json @@ -32,6 +32,7 @@ "i18next-browser-languagedetector": "^6.0.1", "i18next-http-backend": "^1.0.21", "level": "~6.0.1", + "lodash": "^4.17.20", "orbit-db-identity-provider": "~0.3.1", "prop-types": "~15.7.2", "react": "~16.13.1", diff --git a/packages/concordia-app/public/locales/en/translation.json b/packages/concordia-app/public/locales/en/translation.json index f612744..e288c36 100644 --- a/packages/concordia-app/public/locales/en/translation.json +++ b/packages/concordia-app/public/locales/en/translation.json @@ -1,4 +1,13 @@ { - "topbar.button.signup": "Sign Up", - "signup.form.button.submit": "Sign Up" + "register.card.header": "Sign Up", + "register.form.button.back": "Back", + "register.form.button.guest": "Continue as guest", + "register.form.button.submit": "Sign Up", + "register.form.error.message.header": "Form contains errors", + "register.form.error.username.taken.message": "The username {{username}} is already taken.", + "register.form.header.already.member.message": "There is already an account for this address.\nIf you want to create another account please change your address.", + "register.form.username.field.label": "Username", + "register.form.username.field.placeholder": "Username", + "register.p.account.address": "Account address:", + "topbar.button.register": "Sign Up" } \ No newline at end of file diff --git a/packages/concordia-app/src/assets/css/app.css b/packages/concordia-app/src/assets/css/app.css index 07fe37e..4e01f90 100644 --- a/packages/concordia-app/src/assets/css/app.css +++ b/packages/concordia-app/src/assets/css/app.css @@ -1,3 +1,7 @@ body { margin: 1em !important; } + +.i18next-newlines { + white-space: pre-line !important; +} \ No newline at end of file diff --git a/packages/concordia-app/src/components/SignUpForm.jsx b/packages/concordia-app/src/components/SignUpForm.jsx deleted file mode 100644 index 5d7d45a..0000000 --- a/packages/concordia-app/src/components/SignUpForm.jsx +++ /dev/null @@ -1,144 +0,0 @@ -import React, { Component } from 'react'; -import { - Button, Form, Menu, Message, Modal, -} from 'semantic-ui-react'; -import { withTranslation } from 'react-i18next'; -import { connect } from 'react-redux'; -import AppContext from './AppContext'; - -const contractName = 'Forum'; -const checkUsernameTakenMethod = 'isUserNameTaken'; -const signUpMethod = 'signUp'; - -class SignUpForm extends Component { - constructor(props, context) { - super(props, context); - - // For quick access - this.contract = this.context.drizzle.contracts[contractName]; - - this.handleInputChange = this.handleInputChange.bind(this); - this.handleSubmit = this.handleSubmit.bind(this); - this.completeAction = this.completeAction.bind(this); - - this.checkedUsernames = []; - - this.state = { - usernameInput: '', - error: false, - errorHeader: '', - errorMessage: '', - signingUp: false, - }; - } - - componentDidUpdate() { - // TODO - } - - handleSubmit() { - const { usernameInput, error } = this.state; - - if (usernameInput === '') { - this.setState({ - error: true, - errorHeader: 'Data Incomplete', - errorMessage: 'You need to provide a username', - }); - } else if (!error) { - // TODO - // // Makes sure current input username has been checked for availability - // if (this.checkedUsernames.some((e) => e.usernameChecked === usernameInput)) { - // this.completeAction(); - // } - this.completeAction(); - } - } - - handleInputChange(e, { name, value }) { - this.setState({ - [name]: value, - error: false, - }); - if (value !== '') { - if (this.checkedUsernames.length > 0) { - if (this.checkedUsernames.some((e) => e.usernameChecked === value)) { - return; - } - } - - this.contract.methods[checkUsernameTakenMethod].cacheCall( - value, - ); - } - } - - completeAction() { - const { usernameInput } = this.state; - const { user, account } = this.props; - - if (user.hasSignedUp) { - this.contract.methods.signUp.cacheSend(usernameInput); - } else { - this.setState({ - signingUp: true, - }); - this.contract.methods[signUpMethod].cacheSend( - ...[usernameInput], { from: account }, - ); - } - this.setState({ - usernameInput: '', - }); - } - - render() { - const { - error, usernameInput, errorHeader, errorMessage, signingUp, - } = this.state; - const { t } = this.props; - - return ( - this.handleSubmit(e)} - trigger={( - - )} - > - Sign Up - - - - - - - -