diff --git a/src/components/arena/controllers/word-arena.jsx b/src/components/arena/controllers/word-arena.jsx
index 40ae10a5..65b4e170 100644
--- a/src/components/arena/controllers/word-arena.jsx
+++ b/src/components/arena/controllers/word-arena.jsx
@@ -28,7 +28,6 @@ export default class TypingArena extends React.Component {
letter,
state: 'untyped',
}))
-
// When userInput string is empty this is skipped resulting in default values
userInput.split('').forEach((letter, idx) => {
if (idx >= letters.length) {
diff --git a/src/components/common/ui/googeButton.jsx b/src/components/common/ui/googeButton.jsx
new file mode 100644
index 00000000..c5aec8b1
--- /dev/null
+++ b/src/components/common/ui/googeButton.jsx
@@ -0,0 +1,13 @@
+import React from 'react'
+import styles from './ui.module.css'
+import GoogleLogo from '../../../images/g.png'
+export default function GoogleButton({ onClick, textLabel }) {
+ return (
+
+
+
+
+
{textLabel}
+
+ )
+}
diff --git a/src/components/common/ui/ui.module.css b/src/components/common/ui/ui.module.css
index 96344572..59ac0add 100644
--- a/src/components/common/ui/ui.module.css
+++ b/src/components/common/ui/ui.module.css
@@ -71,3 +71,41 @@
transform: translate(24px, 0);
}
}
+
+/* googlebutton */
+.customBtn {
+ margin: 10px auto;
+ background: white;
+ color: #444;
+ width: 190px;
+ border-radius: 5px;
+ border: thin solid #888;
+ box-shadow: 1px 1px 1px grey;
+ white-space: nowrap;
+}
+.customBtn:hover {
+ cursor: pointer;
+}
+span.icon {
+ /* background: url('/identity/sign-in/g-normal.png') transparent 5px 50% no-repeat; */
+ display: inline-block;
+ vertical-align: middle;
+ width: 42px;
+ height: 42px;
+}
+
+.googleLogo {
+ width: 80%;
+ position: relative;
+ top: 9%;
+}
+
+span.buttonText {
+ display: inline-block;
+ vertical-align: middle;
+ padding-left: 7px;
+ padding-right: 42px;
+ font-size: 14px;
+ font-weight: bold;
+ /* Use the Roboto font that is loaded in the */
+}
diff --git a/src/components/dashboard/components/card.module.css b/src/components/dashboard/components/card.module.css
index 1c2889e1..bae75b3f 100644
--- a/src/components/dashboard/components/card.module.css
+++ b/src/components/dashboard/components/card.module.css
@@ -20,14 +20,18 @@
}
.card h2 {
- margin-left: 40px;
- padding-top: 25px;
+ padding-top: 5px;
+ margin: 20px auto 10px 40px;
font-weight: lighter;
+ /* color: #8c8c8c; */
+ font-size: 1.4vw;
+ word-break: break-all;
}
.card p {
- margin-left: 40px;
+ margin: 0 auto 0 30px;
font-weight: lighter;
color: #8c8c8c;
- font-size: 24px;
+ font-size: 1.4vw;
+ word-break: break-all;
}
diff --git a/src/components/dashboard/components/labels.jsx b/src/components/dashboard/components/labels.jsx
index 9c5bafcd..0510cbb2 100644
--- a/src/components/dashboard/components/labels.jsx
+++ b/src/components/dashboard/components/labels.jsx
@@ -1,21 +1,44 @@
import React from 'react'
import styles from './labels.module.css'
-export default function Labels({ data, orientation }) {
- return (
-
- {data.map((label, i) => (
-
-
-
{label.title}
+export default class Labels extends React.Component {
+ state = {
+ selectedOption: 'Wpm',
+ }
+
+ toggleRadioCheck = (e) => {
+ var option = e.target.value
+ this.setState({
+ selectedOption: option,
+ })
+ }
+ render() {
+ return (
+
- )
+
+ )
+ }
}
diff --git a/src/components/dashboard/components/paragraphsCard.jsx b/src/components/dashboard/components/paragraphsCard.jsx
index cc540329..cd5ca1b7 100644
--- a/src/components/dashboard/components/paragraphsCard.jsx
+++ b/src/components/dashboard/components/paragraphsCard.jsx
@@ -1,11 +1,9 @@
import React from 'react'
import NestedDonutChart from '../../common/charts/nestedDonutChart'
-import Labels from './labels'
import Dropdown from './dropdown'
import styles from './paragraphsCard.module.css'
-const labelOrientation = 'vertical',
- dropdownData = ['All Time', 'Weekly', 'Monthly'],
+const dropdownData = ['All Time', 'Weekly', 'Monthly'],
labelData = [
{
title: 'Total',
@@ -30,7 +28,21 @@ export default function ParagraphsCard() {
-
+
+ {labelData.map((label, i) => (
+
+ ))}
+
)
diff --git a/src/components/dashboard/components/paragraphsCard.module.css b/src/components/dashboard/components/paragraphsCard.module.css
index 81c7c2a9..ca95a50f 100644
--- a/src/components/dashboard/components/paragraphsCard.module.css
+++ b/src/components/dashboard/components/paragraphsCard.module.css
@@ -29,3 +29,24 @@
flex-direction: row;
margin: 1.5rem 0;
}
+.labels {
+ display: flex;
+ flex-direction: row;
+}
+
+.labelContainer {
+ display: flex;
+ align-items: center;
+ padding: 10px;
+}
+
+.label {
+ width: 10px;
+ height: 10px;
+ background: #ffab00;
+ border-radius: 50%;
+}
+
+.labelText {
+ margin-left: 10px;
+}
diff --git a/src/components/dashboard/components/progressCard.jsx b/src/components/dashboard/components/progressCard.jsx
index 70bffe3c..09a361a1 100644
--- a/src/components/dashboard/components/progressCard.jsx
+++ b/src/components/dashboard/components/progressCard.jsx
@@ -5,18 +5,17 @@ import Button from './button'
import Dropdown from './dropdown'
import Labels from './labels'
-const labelOrientation = 'horizontal',
- dropdownOptions = ['All', 'Practise', 'Arena'],
- labelData = [
- {
- title: 'WPM',
- color: '#F0A500',
- },
- {
- title: 'Accuracy',
- color: '#EC486F',
- },
- ]
+const dropdownOptions = ['All', 'Practise', 'Arena']
+// labelData = [
+// {
+// title: 'WPM',
+// color: '#F0A500',
+// },
+// {
+// title: 'Accuracy',
+// color: '#EC486F',
+// },
+// ]
export default class ProgressCard extends Component {
state = {
@@ -61,7 +60,7 @@ export default class ProgressCard extends Component {
-
+
diff --git a/src/components/loginSignup/login.jsx b/src/components/loginSignup/login.jsx
index 044adb6b..8bf20ba6 100644
--- a/src/components/loginSignup/login.jsx
+++ b/src/components/loginSignup/login.jsx
@@ -4,10 +4,10 @@ import { navigate } from '@reach/router'
import { setAuthToken } from '../../helpers/storage'
import Para from './bgpara'
import Logo from '../../images/Keyboard.png'
+import GoogleButton from '../common/ui/googeButton'
import ButtonWithLoader from '../common/ui/button-with-loader'
import './loginsignup.css'
import { gapi } from 'gapi-script'
-// import authenticate from './gapi'
export default class Login extends Component {
state = {
@@ -21,10 +21,6 @@ export default class Login extends Component {
userId: '',
}
- // componentDidMount() {
- // this.onSignIn()
- // }
-
handleInput = (stateName) => (e) => {
e.preventDefault()
this.setState({
@@ -119,8 +115,6 @@ export default class Login extends Component {
// Sign the user in, and then retrieve their ID.
auth2.signIn().then((googleUser) => {
- console.log('chcek')
- console.log(googleUser)
this.displayGoogelUser(googleUser)
})
})
@@ -128,15 +122,16 @@ export default class Login extends Component {
displayGoogelUser = async (googleUser) => {
if (googleUser) {
- var profile = googleUser.getBasicProfile()
- console.log('ID: ' + profile.getId()) // Don't send this directly to your server!
- console.log('Full Name: ' + profile.getName())
- console.log('Given Name: ' + profile.getGivenName())
- console.log('Family Name: ' + profile.getFamilyName())
- console.log('Image URL: ' + profile.getImageUrl())
- console.log('Email: ' + profile.getEmail())
+ // var profile = googleUser.getBasicProfile()
+ //do not remove this comment will use it for ref
+ // console.log('ID: ' + profile.getId()) // Don't send this directly to your server!
+ // console.log('Full Name: ' + profile.getName())
+ // console.log('Given Name: ' + profile.getGivenName())
+ // console.log('Family Name: ' + profile.getFamilyName())
+ // console.log('Image URL: ' + profile.getImageUrl())
+ // console.log('Email: ' + profile.getEmail())
var id_token = googleUser.getAuthResponse().id_token
- console.log(id_token)
+
let obj = {
token: id_token,
}
@@ -207,11 +202,11 @@ export default class Login extends Component {
onClick={this.submitForm}>
Login
-
-
-
+
+
Or
+
New Here?
@@ -219,7 +214,6 @@ export default class Login extends Component {
Signup
-
diff --git a/src/components/loginSignup/loginsignup.css b/src/components/loginSignup/loginsignup.css
index 966222e7..1ea81f53 100644
--- a/src/components/loginSignup/loginsignup.css
+++ b/src/components/loginSignup/loginsignup.css
@@ -108,7 +108,7 @@
border-color: red;
border-style: dashed;
}
-.txtboxRed {
+.txtboxRed {
border-color: red;
border-style: dashed;
}
@@ -168,6 +168,43 @@
text-decoration-color: '#f0a500';
}
+#customBtn {
+ margin: 10px auto;
+ background: white;
+ color: #444;
+ width: 190px;
+ border-radius: 5px;
+ border: thin solid #888;
+ box-shadow: 1px 1px 1px grey;
+ white-space: nowrap;
+}
+#customBtn:hover {
+ cursor: pointer;
+}
+span.icon {
+ /* background: url('/identity/sign-in/g-normal.png') transparent 5px 50% no-repeat; */
+ display: inline-block;
+ vertical-align: middle;
+ width: 42px;
+ height: 42px;
+}
+
+.googleLogo {
+ width: 80%;
+ position: relative;
+ top: 9%;
+}
+
+span.buttonText {
+ display: inline-block;
+ vertical-align: middle;
+ padding-left: 7px;
+ padding-right: 42px;
+ font-size: 14px;
+ font-weight: bold;
+ /* Use the Roboto font that is loaded in the */
+}
+
/* .signupBtn {
font-family: 'DM Sans', sans-serif !important;
font-style: normal;
diff --git a/src/components/loginSignup/signup.jsx b/src/components/loginSignup/signup.jsx
index 09171662..f4e4b484 100644
--- a/src/components/loginSignup/signup.jsx
+++ b/src/components/loginSignup/signup.jsx
@@ -6,9 +6,12 @@ import './loginsignup.css'
import Logo from '../../images/Keyboard.png'
import Para from './bgpara'
import { gapi } from 'gapi-script'
+import ButtonWithLoader from '../common/ui/button-with-loader'
+import GoogleButton from '../common/ui/googeButton'
export default class Login extends React.Component {
state = {
+ isLoading: false,
username: '',
email: '',
password: '',
@@ -18,6 +21,8 @@ export default class Login extends React.Component {
email: '',
},
manualSignup: true,
+ errorResponse: '',
+ showGoogleButton: true,
}
user_id = null
@@ -79,10 +84,16 @@ export default class Login extends React.Component {
email: email,
password: pwd,
}
+ this.setState({
+ isLoading: true,
+ })
try {
const response = await signup(postData)
setAuthToken(response.data.token)
+ this.setState({
+ isLoading: false,
+ })
navigate('/')
} catch (error) {
console.log(error.response)
@@ -127,8 +138,6 @@ export default class Login extends React.Component {
// Sign the user in, and then retrieve their ID.
auth2.signIn().then((googleUser) => {
- console.log('chcek')
- console.log(googleUser)
this.displayGoogelUser(googleUser)
})
})
@@ -137,12 +146,7 @@ export default class Login extends React.Component {
displayGoogelUser = async (googleUser) => {
if (googleUser) {
var profile = googleUser.getBasicProfile()
- console.log('ID: ' + profile.getId()) // Don't send this directly to your server!
- console.log('Full Name: ' + profile.getName())
- console.log('Given Name: ' + profile.getGivenName())
- console.log('Family Name: ' + profile.getFamilyName())
- console.log('Image URL: ' + profile.getImageUrl())
- console.log('Email: ' + profile.getEmail())
+
var id_token = googleUser.getAuthResponse().id_token
if (id_token) {
this.setState({
@@ -151,6 +155,7 @@ export default class Login extends React.Component {
errors: {
username: 'Please fill unique username',
},
+ showGoogleButton: false,
})
this.user_id = id_token
}
@@ -171,12 +176,23 @@ export default class Login extends React.Component {
username: name,
token: this.user_id,
}
+ this.setState({
+ isLoading: true,
+ })
try {
const response = await googleLoginSignup(obj)
setAuthToken(response.data.token)
+ this.setState({
+ isLoading: false,
+ })
navigate('/')
} catch (e) {
- console.log(e.response.data.error)
+ const errorMsg = e.response.data.error
+ this.setState({
+ errorResponse: errorMsg,
+ isLoading: false,
+ showGoogleButton: true,
+ })
}
}
}
@@ -194,7 +210,7 @@ export default class Login extends React.Component {
Sign Up
diff --git a/src/images/g.png b/src/images/g.png
new file mode 100644
index 00000000..69c20b97
Binary files /dev/null and b/src/images/g.png differ