Add registration store

This commit is contained in:
DwCay
2022-06-14 13:13:58 +03:00
parent 541c5988e9
commit da04efbf80
5 changed files with 150 additions and 19 deletions

View File

@@ -1,9 +1,29 @@
import React, {useEffect} from 'react';
import React, {useEffect, useState} from 'react';
import { Link } from 'react-router-dom';
import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg";
import Logo from "../images/logo.png";
import {observer} from "mobx-react-lite";
import { registrationStore } from "../store/registrationStore";
function Onboarding4() {
const Onboarding4 = observer(()=>{
const [checkBoxesSelected, setCheckBoxesSelected] = useState(false)
function validateCheckBox () {
let checkBoxes=[...document.getElementsByClassName("form-checkbox")]
if(checkBoxes.find(item=>item.checked===false)) {
return
} else {
setCheckBoxesSelected(true)
}
}
useEffect(()=>{
if(checkBoxesSelected===true) {
document.getElementById("link-dashboard").click()
}
},[checkBoxesSelected])
useEffect(()=>{
return ()=>{
@@ -66,9 +86,9 @@ function Onboarding4() {
<circle className="text-emerald-100" cx="32" cy="32" r="32" />
<path className="text-emerald-500" d="m28.5 41-8-8 3-3 5 5 12-12 3 3z" />
</svg>
<h1 className="text-3xl text-slate-800 font-bold mb-8">Nice to meet you, Ivan 🙌</h1>
<button className="btn px-6 bg-indigo-500 hover:bg-indigo-600 text-white">
<Link to="/dashboard">Go To Profile -&gt;</Link>
<h1 className="text-3xl text-slate-800 font-bold mb-8">{`Nice to meet you, ${registrationStore.accountData().first_name} 🙌`}</h1>
<button onClick={()=>validateCheckBox()} className="btn px-6 bg-indigo-500 hover:bg-indigo-600 text-white">
<Link id="link-dashboard" to={checkBoxesSelected && "/dashboard"}>Go To Profile -&gt;</Link>
</button>
</div>
@@ -106,6 +126,6 @@ function Onboarding4() {
</main>
);
}
});
export default Onboarding4;