fix some bugs
This commit is contained in:
@@ -46,21 +46,14 @@ function App() {
|
||||
<>
|
||||
<Routes>
|
||||
<Route exact path="/" element={<Onboarding1 />} />
|
||||
<Route path="/dashboard" element={<Dashboard />} />
|
||||
<Route path="/dashboard/analytics" element={<Analytics />} />
|
||||
<Route path="/dashboard/fintech" element={<Fintech />} />
|
||||
<Route path="/digitalId/profile-id" element={<ProfileId />} />
|
||||
<Route path="/digitalId/validate" element={<Validate />} />
|
||||
<Route path="/digitalId/validation-log" element={<ValidationLog />} />
|
||||
<Route path="/digitalId/verify" element={<Verify />} />
|
||||
<Route path="/messages" element={<Messages />} />
|
||||
<Route path="/onboarding-2" element={<Onboarding2 />} />
|
||||
<Route path="/onboarding-3" element={<Onboarding3 />} />
|
||||
<Route path="/onboarding-4" element={<Onboarding4 />} />
|
||||
<Route path="/component/button" element={<ButtonPage />} />
|
||||
<Route path="/shared-data" element={<SharedData />} />
|
||||
<Route path="/component/badge" element={<BadgePage />} />
|
||||
<Route path="/component/accordion" element={<AccordionPage />} />
|
||||
<Route path="/reset-password" element={<ResetPassword />} />
|
||||
<Route path="/signIn" element={<SignIn />} />
|
||||
</Routes>
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from 'react';
|
||||
import {observer} from "mobx-react-lite";
|
||||
import { Link } from 'react-router-dom';
|
||||
import Transition from '../utils/Transition';
|
||||
import {registrationStore} from "../store/store";
|
||||
import {store} from "../store/store";
|
||||
import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg";
|
||||
import UserAvatar from '../images/user-avatar-32.png';
|
||||
|
||||
@@ -36,6 +36,11 @@ import UserAvatar from '../images/user-avatar-32.png';
|
||||
return () => document.removeEventListener('keydown', keyHandler);
|
||||
});
|
||||
|
||||
const logOut = () => {
|
||||
sessionStorage.removeItem('passPhrase')
|
||||
store.fetchPassPhrase()
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="relative inline-flex">
|
||||
<button
|
||||
@@ -45,9 +50,9 @@ import UserAvatar from '../images/user-avatar-32.png';
|
||||
onClick={() => setDropdownOpen(!dropdownOpen)}
|
||||
aria-expanded={dropdownOpen}
|
||||
>
|
||||
<img className="w-8 h-8 rounded-full" src={generateSvgAvatar(registrationStore.pubKey) || UserAvatar} width="32" height="32" alt="User" />
|
||||
<img className="w-8 h-8 rounded-full" src={generateSvgAvatar(store.pubKey) || UserAvatar} width="32" height="32" alt="User" />
|
||||
<div className="flex items-center truncate">
|
||||
<span className="truncate ml-2 text-sm font-medium group-hover:text-slate-800">Acme Inc.</span>
|
||||
<span className="truncate ml-2 text-sm font-medium group-hover:text-slate-800">{store.accountName}</span>
|
||||
<svg className="w-3 h-3 shrink-0 ml-1 fill-current text-slate-400" viewBox="0 0 12 12">
|
||||
<path d="M5.9 11.4L.5 6l1.4-1.4 4 4 4-4L11.3 6z" />
|
||||
</svg>
|
||||
@@ -86,8 +91,8 @@ import UserAvatar from '../images/user-avatar-32.png';
|
||||
<li>
|
||||
<Link
|
||||
className="font-medium text-sm text-indigo-500 hover:text-indigo-600 flex items-center py-1 px-3"
|
||||
to="/dashboard"
|
||||
onClick={() => setDropdownOpen(!dropdownOpen)}
|
||||
to="/"
|
||||
onClick={() => logOut()}
|
||||
>
|
||||
Sign Out
|
||||
</Link>
|
||||
|
||||
@@ -4,14 +4,18 @@ import OnboardingImage from '../images/onboarding-image.jpg';
|
||||
import OnboardingDecoration from '../images/auth-decoration.png';
|
||||
import Logo from "../images/logo.png";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { registrationStore } from "../store/store";
|
||||
import { store } from "../store/store";
|
||||
import { Navigate } from "react-router-dom";
|
||||
|
||||
const Onboarding1 = observer(() => {
|
||||
|
||||
useEffect(()=>{
|
||||
registrationStore.generatePassPhrase()
|
||||
useEffect(() => {
|
||||
store.clearDataRegistration()
|
||||
}, [])
|
||||
|
||||
if(store.passPhrase)
|
||||
return <Navigate to="/digitalId/profile-id" replace={true} />
|
||||
|
||||
return (
|
||||
<main className="bg-white">
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import React, {useState} from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import React, {useEffect, useMemo, useState} from 'react';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { registrationStore } from "../store/store";
|
||||
import { store } from "../store/store";
|
||||
import OnboardingImage from '../images/onboarding-image.jpg';
|
||||
import OnboardingDecoration from '../images/auth-decoration.png';
|
||||
import Logo from "../images/logo.png";
|
||||
|
||||
const Onboarding2 = observer(() => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [dataRegistration, setDataRegistration] = useState(
|
||||
{
|
||||
firstname: '',
|
||||
@@ -15,7 +17,8 @@ const Onboarding2 = observer(() => {
|
||||
birthdate: '',
|
||||
}
|
||||
);
|
||||
const [fillingForm, setFillingForm] = useState(false);
|
||||
|
||||
const fillingForm = useMemo(() => !Object.keys(dataRegistration).find(item => !dataRegistration[item]), [dataRegistration])
|
||||
|
||||
const saveValueChange = (event) => {
|
||||
const newValue=event.target.value;
|
||||
@@ -25,22 +28,26 @@ const Onboarding2 = observer(() => {
|
||||
})
|
||||
};
|
||||
|
||||
const checkFillingForm = () => {
|
||||
if (!Object.keys(dataRegistration).find(item => !dataRegistration[item])) {
|
||||
setFillingForm(true);
|
||||
const saveStoreRegistration = () => {
|
||||
if (fillingForm) {
|
||||
store.saveDataRegistration(Object.keys(dataRegistration).map(item => ({
|
||||
key: `${item}`,
|
||||
value: dataRegistration[item],
|
||||
})
|
||||
))
|
||||
navigate("/onboarding-3", { replace: true });
|
||||
}
|
||||
};
|
||||
|
||||
const saveStoreRegistration = () => {
|
||||
if (fillingForm) {
|
||||
registrationStore.saveDataRegistration(Object.keys(dataRegistration).map(item => {
|
||||
return{
|
||||
key: `${item}`,
|
||||
value: dataRegistration[item],
|
||||
}
|
||||
}))
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
if(store.accountData.length === 0)
|
||||
return;
|
||||
setDataRegistration(store.accountData.reduce((acc, item) => ({
|
||||
...acc,
|
||||
[item.key]: item.value
|
||||
}), {}))
|
||||
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<main className="bg-white">
|
||||
@@ -97,15 +104,15 @@ const Onboarding2 = observer(() => {
|
||||
<div className="space-y-4 mb-8">
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="first_name">First name <span className="text-rose-500">*</span></label>
|
||||
<input onBlur={checkFillingForm} id="firstname" onChange={(event)=>saveValueChange(event)} className="form-input w-full" type="text" />
|
||||
<input id="firstname" onChange={(event)=>saveValueChange(event)} className="form-input w-full" type="text" value={dataRegistration.firstname} />
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="second_name">Last name <span className="text-rose-500">*</span></label>
|
||||
<input onBlur={checkFillingForm} id="secondname" onChange={(event)=>saveValueChange(event)} className="form-input w-full" type="text" />
|
||||
<input id="secondname" onChange={(event)=>saveValueChange(event)} className="form-input w-full" type="text" value={dataRegistration.secondname} />
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="gender">Gender <span className="text-rose-500">*</span></label>
|
||||
<select onBlur={checkFillingForm} id="gender" onChange={(event)=>saveValueChange(event)} className="form-select w-full">
|
||||
<select id="gender" onChange={(event)=>saveValueChange(event)} className="form-select w-full" value={dataRegistration.gender}>
|
||||
<option className="hidden"></option>
|
||||
<option>male</option>
|
||||
<option>female</option>
|
||||
@@ -113,7 +120,7 @@ const Onboarding2 = observer(() => {
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="birthdate">Date of birth <span className="text-rose-500">*</span></label>
|
||||
<input onBlur={checkFillingForm} id="birthdate" onChange={(event)=>saveValueChange(event)} className="form-input w-full" type="date" autoComplete="on" />
|
||||
<input id="birthdate" onChange={(event)=>saveValueChange(event)} className="form-input w-full" type="date" autoComplete="on" value={dataRegistration.birthdate} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center justify-between mt-6">
|
||||
@@ -123,17 +130,10 @@ const Onboarding2 = observer(() => {
|
||||
<span className="text-sm ml-2">Email me about product news.</span>
|
||||
</label>
|
||||
</div>
|
||||
<button onClick={saveStoreRegistration} className="btn bg-indigo-500 hover:bg-indigo-600 text-white ml-3 whitespace-nowrap">
|
||||
<Link id="signup" to={fillingForm && "/onboarding-3"} >Sign Up</Link>
|
||||
<button onClick={saveStoreRegistration} className="btn bg-indigo-500 hover:bg-indigo-600 text-white ml-3 whitespace-nowrap">Sign Up
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/* Footer */}
|
||||
<div className="pt-5 mt-6 border-t border-slate-200">
|
||||
<div className="text-sm">
|
||||
Have an account? <Link className="font-medium text-indigo-500 hover:text-indigo-600" to="/signIn">Sign In</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,28 +1,32 @@
|
||||
import React from 'react';
|
||||
import React, {useEffect} from 'react';
|
||||
import {observer} from "mobx-react-lite";
|
||||
import { Link } from 'react-router-dom';
|
||||
import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg";
|
||||
import Logo from "../images/logo.png";
|
||||
import {registrationStore} from "../store/store";
|
||||
import {store} from "../store/store";
|
||||
|
||||
const Onboarding3 = observer(()=>{
|
||||
function generatePassPhrase() {
|
||||
registrationStore.generatePassPhrase();
|
||||
|
||||
useEffect(()=>{
|
||||
store.generatePassPhrase();
|
||||
}, [])
|
||||
|
||||
const generatePassPhrase = () => {
|
||||
store.generatePassPhrase();
|
||||
};
|
||||
|
||||
function savePassPhraseInStore (copiedPhrase) {
|
||||
const savePassPhraseInStore = copiedPhrase => {
|
||||
if (copiedPhrase.split(' ').length === 12) {
|
||||
registrationStore.savePastPassPhrase(copiedPhrase.trim());
|
||||
store.savePastPassPhrase(copiedPhrase.trim());
|
||||
}
|
||||
};
|
||||
|
||||
function pastePassPhrase() {
|
||||
const pastePassPhrase = () => {
|
||||
navigator.clipboard.readText().then(res => savePassPhraseInStore(res));
|
||||
};
|
||||
|
||||
function convertPassPhraseToArray() {
|
||||
return registrationStore.passPhrase.split(' ').map((item, index) => ({str:item, id:index}));
|
||||
};
|
||||
const convertPassPhraseToArray = () => store.passPhrase.split(' ').
|
||||
map((item, index) => ({str: item, id: index}));
|
||||
|
||||
return (
|
||||
<main className="bg-white">
|
||||
@@ -118,7 +122,7 @@ const Onboarding3 = observer(()=>{
|
||||
{/* Image */}
|
||||
<div className="flex flex-col items-center h-full w-full hidden md:block absolute top-0 bottom-0 right-0 md:w-1/2" aria-hidden="true">
|
||||
<div className="flex mt-40 flex-col items-center gap-2.5">
|
||||
<img className="object-cover object-center" src={generateSvgAvatar(registrationStore.pubKey)} width="493px" height="493px" alt="Onboarding" />
|
||||
<img className="object-cover object-center" src={generateSvgAvatar(store.pubKey)} width="493px" height="493px" alt="Onboarding" />
|
||||
<span className="text-sm">Your generated Digital ID</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ 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/store";
|
||||
import { store } from "../store/store";
|
||||
|
||||
const Onboarding4 = observer(() => {
|
||||
|
||||
@@ -11,8 +11,9 @@ const Onboarding4 = observer(() => {
|
||||
|
||||
function createAccount() {
|
||||
if(checkBoxesSelected.length === 2) {
|
||||
registrationStore.pushAccountData();
|
||||
sessionStorage.setItem('passPhrase', registrationStore.passPhrase);
|
||||
store.pushAccountData();
|
||||
sessionStorage.setItem('passPhrase', store.passPhrase);
|
||||
store.clearDataRegistration();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,7 +25,7 @@ const Onboarding4 = observer(() => {
|
||||
}
|
||||
};
|
||||
|
||||
const firstNameAccount = registrationStore.accountData.length && registrationStore.accountData.find(item => item.key === "firstname").value;
|
||||
const firstNameAccount = store.accountData.length && store.accountData.find(item => item.key === "firstname").value;
|
||||
|
||||
return (
|
||||
<main className="bg-white">
|
||||
@@ -83,7 +84,7 @@ const Onboarding4 = observer(() => {
|
||||
</svg>
|
||||
<h1 className="text-3xl text-slate-800 font-bold mb-8">{firstNameAccount ? `Nice to meet you, ${firstNameAccount} 🙌` : 'Please, go back step 2'}</h1>
|
||||
<button onClick={createAccount} className="btn px-6 bg-indigo-500 hover:bg-indigo-600 text-white">
|
||||
<Link id="link-dashboard" to={checkBoxesSelected.length===2 && "/dashboard"}>Go To Profile -></Link>
|
||||
<Link id="link-dashboard" to={checkBoxesSelected.length===2 && "/digitalId/profile-id"}>Go To Profile -></Link>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -112,7 +113,7 @@ const Onboarding4 = observer(() => {
|
||||
{/* Image */}
|
||||
<div className="flex flex-col items-center h-full w-full hidden md:block absolute top-0 bottom-0 right-0 md:w-1/2" aria-hidden="true">
|
||||
<div className="flex mt-40 flex-col items-center gap-2.5">
|
||||
<img className="object-cover object-center" src={generateSvgAvatar(registrationStore.pubKey)} width="493px" height="493px" alt="Onboarding" />
|
||||
<img className="object-cover object-center" src={generateSvgAvatar(store.pubKey)} width="493px" height="493px" alt="Onboarding" />
|
||||
<span className="text-sm">Your generated Digital ID</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ import {observer} from "mobx-react-lite";
|
||||
import { Link } from 'react-router-dom';
|
||||
import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg";
|
||||
import Logo from "../images/logo.png";
|
||||
import {registrationStore} from "../store/store";
|
||||
import {store} from "../store/store";
|
||||
|
||||
const SignIn = observer(()=>{
|
||||
|
||||
@@ -12,11 +12,11 @@ const SignIn = observer(()=>{
|
||||
|
||||
function savePassPhrase (copiedPhrase) {
|
||||
if (copiedPhrase.split(' ').length === 12) {
|
||||
registrationStore.savePastPassPhrase(copiedPhrase.trim());
|
||||
setPassPhrase(registrationStore.passPhrase);
|
||||
store.savePastPassPhrase(copiedPhrase.trim());
|
||||
setPassPhrase(store.passPhrase);
|
||||
setAddedPassPhrase(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function convertPassPhraseToArray() {
|
||||
return passPhrase.split(' ').map((item, index) => ({str:item, id:index}));
|
||||
@@ -24,7 +24,7 @@ const SignIn = observer(()=>{
|
||||
|
||||
function pastePassPhrase() {
|
||||
navigator.clipboard.readText().then(res => savePassPhrase(res));
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="bg-white">
|
||||
@@ -41,7 +41,7 @@ const SignIn = observer(()=>{
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between h-16 px-4 sm:px-6 lg:px-8">
|
||||
{/* Logo */}
|
||||
<Link className="block" to="/dashboard">
|
||||
<Link className="block" to="/">
|
||||
<img alt='logo' src={Logo} width="89" height="32"/>
|
||||
</Link>
|
||||
<div className="text-sm">
|
||||
@@ -75,7 +75,7 @@ const SignIn = observer(()=>{
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<button className="btn bg-indigo-500 hover:bg-indigo-600 text-white ml-auto">
|
||||
<Link to={addedPassPhrase && "/dashboard"}>Go To Profile -></Link>
|
||||
<Link to={addedPassPhrase && "/digitalId/profile-id"}>Go To Profile -></Link>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -90,7 +90,7 @@ const SignIn = observer(()=>{
|
||||
<div className="flex flex-col items-center h-full w-full hidden md:block absolute top-0 bottom-0 right-0 md:w-1/2" aria-hidden="true">
|
||||
<div className="flex mt-40 flex-col items-center gap-2.5">
|
||||
<div className={`${addedPassPhrase || 'opacity-0'} w-[493px] h-[493px]`}>
|
||||
<img className="object-cover object-center" alt="" src={generateSvgAvatar(registrationStore.pubKey)}/>
|
||||
<img className="object-cover object-center" alt="" src={generateSvgAvatar(store.pubKey)}/>
|
||||
</div>
|
||||
<span className="text-sm">Your Digital ID</span>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { registrationStore } from "../../store/store";
|
||||
import { store } from "../../store/store";
|
||||
import Sidebar from '../../partials/Sidebar';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import Header from '../../partials/Header';
|
||||
@@ -78,7 +78,7 @@ const Profile = observer (() => {
|
||||
|
||||
const handleSelectedItems = (selectedItems) => {
|
||||
setSelectedItems([...selectedItems]);
|
||||
setUpdatedValues(registrationStore.decryptedAccountData.filter(({ key }) => selectedItems.includes(key))
|
||||
setUpdatedValues(store.decryptedAccountData.filter(({ key }) => selectedItems.includes(key))
|
||||
.map(elem => (
|
||||
(!elem.seed) ? {
|
||||
...elem,
|
||||
@@ -106,7 +106,7 @@ const Profile = observer (() => {
|
||||
};
|
||||
|
||||
const sendAddedData = () => {
|
||||
const checkingAddedData = !registrationStore.decryptedAccountData
|
||||
const checkingAddedData = !store.decryptedAccountData
|
||||
.some((element) => element.label === addedValues.label) && (addedValues.seed.length === 20);
|
||||
if (checkingAddedData) {
|
||||
setAddPanelOpen(false);
|
||||
@@ -124,13 +124,13 @@ const Profile = observer (() => {
|
||||
};
|
||||
|
||||
const deleteDataParameters = () => {
|
||||
const changeData = registrationStore.decryptedAccountData.filter(item=>!selectedItems.includes(item.key))
|
||||
registrationStore.pushAccountData(changeData);
|
||||
const changeData = store.decryptedAccountData.filter(item=>!selectedItems.includes(item.key))
|
||||
store.pushAccountData(changeData);
|
||||
};
|
||||
|
||||
const changeInitialArray = () => {
|
||||
let newArr = [];
|
||||
registrationStore.decryptedAccountData.map(elem => {
|
||||
store.decryptedAccountData.map(elem => {
|
||||
updatedValues.forEach(item => {
|
||||
if (elem.label === item.label) {
|
||||
newArr.push({
|
||||
@@ -149,12 +149,12 @@ const Profile = observer (() => {
|
||||
|
||||
const changeDataParameters = () => {
|
||||
const updatedData = changeInitialArray();
|
||||
registrationStore.pushAccountData(updatedData);
|
||||
store.pushAccountData(updatedData);
|
||||
};
|
||||
|
||||
const addDataParameters = () => {
|
||||
addedValues.key = addedValues.label.toLowerCase().split(' ').join('');
|
||||
registrationStore.pushAccountData(registrationStore.decryptedAccountData.concat(addedValues));
|
||||
store.pushAccountData(store.decryptedAccountData.concat(addedValues));
|
||||
};
|
||||
|
||||
const cancelAddPanel = () => {
|
||||
@@ -164,7 +164,7 @@ const Profile = observer (() => {
|
||||
};
|
||||
|
||||
const cancelUpdatePanel = () => {
|
||||
setUpdatedValues(registrationStore.decryptedAccountData.filter(({ key }) => selectedItems.includes(key))
|
||||
setUpdatedValues(store.decryptedAccountData.filter(({ key }) => selectedItems.includes(key))
|
||||
.map(elem => (
|
||||
(!elem.seed) ? {
|
||||
...elem,
|
||||
@@ -235,7 +235,7 @@ const Profile = observer (() => {
|
||||
</div>
|
||||
{/* Table */}
|
||||
<div className='w-[828px]'>
|
||||
<ProfileTable isCheck={isCheck} handleClick={handleClick} userData={registrationStore.decryptedAccountData}/>
|
||||
<ProfileTable isCheck={isCheck} handleClick={handleClick} userData={store.decryptedAccountData}/>
|
||||
</div>
|
||||
</div>
|
||||
{/* Left sidebar */}
|
||||
@@ -407,7 +407,7 @@ const Profile = observer (() => {
|
||||
<div className={`${!removePanelOpen && 'hidden'} bg-white px-5 pt-4 pb-[190px] shadow-lg rounded-sm border border-slate-200 lg:w-72 xl:w-80 mb-12`}>
|
||||
<h2 className="grow text-base font-semibold text-slate-800 truncate mb-2">Summary</h2>
|
||||
<div className="flex flex-col">
|
||||
{registrationStore.decryptedAccountData.filter(({ key }) => selectedItems.includes(key)).map(item => (
|
||||
{store.decryptedAccountData.filter(({ key }) => selectedItems.includes(key)).map(item => (
|
||||
<span key={item.label} className="text-sm font-normal text-slate-600 py-3 border-b border-slate-200">{item.label}</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import ValidateTable from "../../partials/validate/ValidateTable";
|
||||
import ValidatePanel from "../../partials/validate/ValidatePanel";
|
||||
import ValidateRoadMap from "../../partials/validationLog/ValidateRoadMap";
|
||||
import {Link} from "react-router-dom";
|
||||
import {registrationStore} from "../../store/store";
|
||||
import {store} from "../../store/store";
|
||||
|
||||
const Validate = observer(() => {
|
||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||
@@ -57,7 +57,7 @@ const Validate = observer(() => {
|
||||
<div className="pb-8 border-b border-zinc-200 mt-[50px]">
|
||||
<h1 className="text-2xl md:text-3xl text-slate-800 font-bold">Digital ID validation log ✨</h1>
|
||||
</div>
|
||||
{registrationStore.transactionsInfo.map(item => {
|
||||
{store.transactionsInfo.map(item => {
|
||||
return <ValidateRoadMap season={item} key={item.id}/>
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ import ValidateRoadMap from "../../partials/validationLog/ValidateRoadMap";
|
||||
import {observer} from "mobx-react-lite";
|
||||
import Sidebar from '../../partials/Sidebar';
|
||||
import Header from '../../partials/Header';
|
||||
import {registrationStore} from "../../store/store";
|
||||
import {store} from "../../store/store";
|
||||
|
||||
const ValidationLog = observer(() => {
|
||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||
@@ -27,7 +27,7 @@ const ValidationLog = observer(() => {
|
||||
<div className="max-w-3xl m-auto mt-6">
|
||||
<div className="xl:-translate-x-16 max-w-fit">
|
||||
{/* PostsID */}
|
||||
{registrationStore.transactionsInfo.map(item => {
|
||||
{store.transactionsInfo.map(item => {
|
||||
return <ValidateRoadMap season={item} key={item.id}/>
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import Sidebar from '../../partials/Sidebar';
|
||||
import Header from '../../partials/Header';
|
||||
import {registrationStore} from "../../store/store";
|
||||
import {store} from "../../store/store";
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
const Verify = observer(() => {
|
||||
@@ -42,7 +42,7 @@ const Verify = observer(() => {
|
||||
</div>
|
||||
{/* Block */}
|
||||
<div className="flex flex-col gap-y-4">
|
||||
{registrationStore.sharedData.map((item, index) => (
|
||||
{store.sharedData.map((item, index) => (
|
||||
<div key={index} className="w-[1095px] pl-5 pr-[13px] pb-8 bg-white border border-slate-200 rounded shadow-[0_4px_6px_-1px_rgba(5,23,42,0.08)]">
|
||||
{/* Header */}
|
||||
<div className="flex justify-end items-center h-[42px]">
|
||||
|
||||
@@ -81,7 +81,7 @@ function Sidebar({
|
||||
</svg>
|
||||
</button>
|
||||
{/* Logo */}
|
||||
<NavLink end to="/dashboard" className="block">
|
||||
<NavLink end to="/digitalId/profile-id" className="block">
|
||||
<img alt='logo' src={Logo} width="89" height="32"/>
|
||||
</NavLink>
|
||||
</div>
|
||||
@@ -97,101 +97,6 @@ function Sidebar({
|
||||
<span className="lg:hidden lg:sidebar-expanded:block 2xl:block">Pages</span>
|
||||
</h3>
|
||||
<ul className="mt-3">
|
||||
{/* Dashboard */}
|
||||
<SidebarLinkGroup activecondition={pathname === '/' || pathname.includes('dashboard')}>
|
||||
{(handleClick, open) => {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<a
|
||||
href="#0"
|
||||
className={`block text-slate-200 hover:text-white truncate transition duration-150 ${
|
||||
(pathname === '/' || pathname.includes('dashboard')) && 'hover:text-slate-200'
|
||||
}`}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
sidebarExpanded ? handleClick() : setSidebarExpanded(true);
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center">
|
||||
<svg className="shrink-0 h-6 w-6" viewBox="0 0 24 24">
|
||||
<path
|
||||
className={`fill-current text-slate-400 ${
|
||||
(pathname === '/' || pathname.includes('dashboard')) && '!text-indigo-500'
|
||||
}`}
|
||||
d="M12 0C5.383 0 0 5.383 0 12s5.383 12 12 12 12-5.383 12-12S18.617 0 12 0z"
|
||||
/>
|
||||
<path
|
||||
className={`fill-current text-slate-600 ${(pathname === '/' || pathname.includes('dashboard')) && 'text-indigo-600'}`}
|
||||
d="M12 3c-4.963 0-9 4.037-9 9s4.037 9 9 9 9-4.037 9-9-4.037-9-9-9z"
|
||||
/>
|
||||
<path
|
||||
className={`fill-current text-slate-400 ${(pathname === '/' || pathname.includes('dashboard')) && 'text-indigo-200'}`}
|
||||
d="M12 15c-1.654 0-3-1.346-3-3 0-.462.113-.894.3-1.285L6 6l4.714 3.301A2.973 2.973 0 0112 9c1.654 0 3 1.346 3 3s-1.346 3-3 3z"
|
||||
/>
|
||||
</svg>
|
||||
<span className="text-sm font-medium ml-3 lg:opacity-0 lg:sidebar-expanded:opacity-100 2xl:opacity-100 duration-200">
|
||||
Dashboard
|
||||
</span>
|
||||
</div>
|
||||
{/* Icon */}
|
||||
<div className="flex shrink-0 ml-2">
|
||||
<svg
|
||||
className={`w-3 h-3 shrink-0 ml-1 fill-current text-slate-400 ${open && 'transform rotate-180'}`}
|
||||
viewBox="0 0 12 12"
|
||||
>
|
||||
<path d="M5.9 11.4L.5 6l1.4-1.4 4 4 4-4L11.3 6z" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<div className="lg:hidden lg:sidebar-expanded:block 2xl:block">
|
||||
<ul className={`pl-9 mt-1 ${!open && 'hidden'}`}>
|
||||
<li className="mb-1 last:mb-0">
|
||||
<NavLink
|
||||
end
|
||||
to="/dashboard"
|
||||
className={({ isActive }) =>
|
||||
'block text-slate-400 hover:text-slate-200 transition duration-150 truncate ' + (isActive ? '!text-indigo-500' : '')
|
||||
}
|
||||
>
|
||||
<span className="text-sm font-medium lg:opacity-0 lg:sidebar-expanded:opacity-100 2xl:opacity-100 duration-200">
|
||||
Main
|
||||
</span>
|
||||
</NavLink>
|
||||
</li>
|
||||
<li className="mb-1 last:mb-0">
|
||||
<NavLink
|
||||
end
|
||||
to="/dashboard/analytics"
|
||||
className={({ isActive }) =>
|
||||
'block text-slate-400 hover:text-slate-200 transition duration-150 truncate ' + (isActive ? '!text-indigo-500' : '')
|
||||
}
|
||||
>
|
||||
<span className="text-sm font-medium lg:opacity-0 lg:sidebar-expanded:opacity-100 2xl:opacity-100 duration-200">
|
||||
Analytics
|
||||
</span>
|
||||
</NavLink>
|
||||
</li>
|
||||
<li className="mb-1 last:mb-0">
|
||||
<NavLink
|
||||
end
|
||||
to="/dashboard/fintech"
|
||||
className={({ isActive }) =>
|
||||
'block text-slate-400 hover:text-slate-200 transition duration-150 truncate ' + (isActive ? '!text-indigo-500' : '')
|
||||
}
|
||||
>
|
||||
<span className="text-sm font-medium lg:opacity-0 lg:sidebar-expanded:opacity-100 2xl:opacity-100 duration-200">
|
||||
Fintech
|
||||
</span>
|
||||
</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</React.Fragment>
|
||||
);
|
||||
}}
|
||||
</SidebarLinkGroup>
|
||||
{/* digitalId */}
|
||||
<SidebarLinkGroup activecondition={pathname.includes('digitalId')}>
|
||||
{(handleClick, open) => {
|
||||
@@ -302,38 +207,6 @@ function Sidebar({
|
||||
);
|
||||
}}
|
||||
</SidebarLinkGroup>
|
||||
{/* Messages */}
|
||||
<li className={`px-3 py-2 rounded-sm mb-0.5 last:mb-0 ${pathname.includes('messages') && 'bg-slate-900'}`}>
|
||||
<NavLink
|
||||
end
|
||||
to="/messages"
|
||||
className={`block text-slate-200 hover:text-white truncate transition duration-150 ${
|
||||
pathname.includes('messages') && 'hover:text-slate-200'
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="grow flex items-center">
|
||||
<svg className="shrink-0 h-6 w-6" viewBox="0 0 24 24">
|
||||
<path
|
||||
className={`fill-current text-slate-600 ${pathname.includes('messages') && 'text-indigo-500'}`}
|
||||
d="M14.5 7c4.695 0 8.5 3.184 8.5 7.111 0 1.597-.638 3.067-1.7 4.253V23l-4.108-2.148a10 10 0 01-2.692.37c-4.695 0-8.5-3.184-8.5-7.11C6 10.183 9.805 7 14.5 7z"
|
||||
/>
|
||||
<path
|
||||
className={`fill-current text-slate-400 ${pathname.includes('messages') && 'text-indigo-300'}`}
|
||||
d="M11 1C5.477 1 1 4.582 1 9c0 1.797.75 3.45 2 4.785V19l4.833-2.416C8.829 16.85 9.892 17 11 17c5.523 0 10-3.582 10-8s-4.477-8-10-8z"
|
||||
/>
|
||||
</svg>
|
||||
<span className="text-sm font-medium ml-3 lg:opacity-0 lg:sidebar-expanded:opacity-100 2xl:opacity-100 duration-200">
|
||||
Messages
|
||||
</span>
|
||||
</div>
|
||||
{/* Badge */}
|
||||
<div className="flex flex-shrink-0 ml-2">
|
||||
<span className="inline-flex items-center justify-center h-5 text-xs font-medium text-white bg-indigo-500 px-2 rounded">4</span>
|
||||
</div>
|
||||
</div>
|
||||
</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, {useState, useEffect} from 'react';
|
||||
import ProfileTableItem from './ProfileTableItem';
|
||||
import ProfileIcon from '../../images/profile-icon.svg';
|
||||
|
||||
function ProfileTable({
|
||||
function ProfileTable({
|
||||
userData,
|
||||
handleClick,
|
||||
isCheck,
|
||||
@@ -23,7 +23,7 @@ function ProfileTable({
|
||||
|
||||
const generalData = userData.filter(elem => data.general.includes(elem.label));
|
||||
const nationalityData = userData.filter(elem => data.nationality.includes(elem.label));
|
||||
const sosialData = userData.filter(elem => data.social.includes(elem.label));
|
||||
const socialData = userData.filter(elem => data.social.includes(elem.label));
|
||||
const otherData = userData.filter((elem) =>
|
||||
!data.general.includes(elem.label) && !data.nationality.includes(elem.label) && !data.social.includes(elem.label));
|
||||
|
||||
@@ -82,12 +82,12 @@ function ProfileTable({
|
||||
</div>
|
||||
</div>
|
||||
{/* Social */}
|
||||
<div className={`${sosialData.length > 0 || 'hidden'}`}>
|
||||
<div className={`${socialData.length > 0 || 'hidden'}`}>
|
||||
<h2 className="grow text-base font-semibold text-slate-800 truncate mb-2.5 mt-8">Social 🖋️</h2>
|
||||
<div className="overflow-x-auto w-[828px]">
|
||||
<table className="w-[828px] table-auto w-full">
|
||||
<tbody className="text-sm divide-slate-200 divide-y ">
|
||||
{sosialData.map(data => {
|
||||
{socialData.map(data => {
|
||||
return (
|
||||
<ProfileTableItem
|
||||
key={data.label}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {registrationStore} from '../store/store';
|
||||
import {store} from '../store/store';
|
||||
|
||||
function prepareUrl(url) {
|
||||
if (url.startsWith('http')) return url;
|
||||
@@ -63,7 +63,7 @@ function get(url, headers, attempts = 1) {
|
||||
}
|
||||
|
||||
function getAuth(url, headers, attempts = 1) {
|
||||
return handleRequest('GET', url, headers, attempts, registrationStore.tokenKey);
|
||||
return handleRequest('GET', url, headers, attempts, store.tokenKey);
|
||||
}
|
||||
|
||||
function del(url, headers, attempts = 1) {
|
||||
@@ -71,7 +71,7 @@ function del(url, headers, attempts = 1) {
|
||||
}
|
||||
|
||||
function delAuth(url, headers, attempts = 1) {
|
||||
return handleRequest('DELETE', url, headers, attempts, registrationStore.tokenKey);
|
||||
return handleRequest('DELETE', url, headers, attempts, store.tokenKey);
|
||||
}
|
||||
|
||||
function post(url, headers, body, attempts = 1) {
|
||||
@@ -79,7 +79,7 @@ function post(url, headers, body, attempts = 1) {
|
||||
}
|
||||
|
||||
function postAuth(url, headers, body, attempts = 1) {
|
||||
return handleRequest('POST', url, headers, attempts, registrationStore.tokenKey, body);
|
||||
return handleRequest('POST', url, headers, attempts, store.tokenKey, body);
|
||||
}
|
||||
|
||||
function put(url, headers, body, attempts = 1) {
|
||||
@@ -87,7 +87,7 @@ function put(url, headers, body, attempts = 1) {
|
||||
}
|
||||
|
||||
function putAuth(url, headers, body, attempts = 1) {
|
||||
return handleRequest('PUT', url, headers, attempts, registrationStore.tokenKey, body);
|
||||
return handleRequest('PUT', url, headers, attempts, store.tokenKey, body);
|
||||
}
|
||||
|
||||
export const fetchWrapper = {
|
||||
|
||||
@@ -14,7 +14,7 @@ const usersImages = [User08,User06,User05,User09];
|
||||
class Store {
|
||||
_accountData = []
|
||||
|
||||
_passPhrase
|
||||
_passPhrase = ''
|
||||
|
||||
_nodeInfo = {}
|
||||
|
||||
@@ -87,7 +87,7 @@ class Store {
|
||||
};
|
||||
|
||||
fetchPassPhrase() {
|
||||
this._passPhrase = sessionStorage.getItem('passPhrase')
|
||||
this._passPhrase = sessionStorage.getItem('passPhrase') || ''
|
||||
}
|
||||
|
||||
fetchSharedData() {
|
||||
@@ -112,6 +112,10 @@ class Store {
|
||||
this._accountData = data;
|
||||
};
|
||||
|
||||
clearDataRegistration() {
|
||||
this._accountData = [];
|
||||
};
|
||||
|
||||
fetchNodeInfo() {
|
||||
getNodeInfo()
|
||||
.then((info)=>this.fetchNodeInfoSuccess(info))
|
||||
@@ -175,7 +179,7 @@ class Store {
|
||||
return this._accountData.map((elem) => ({
|
||||
...elem,
|
||||
key: elem.label,
|
||||
label: labelMap[elem.label],
|
||||
label: labelMap[elem.label] || elem.label,
|
||||
value: cryptography.decryptMessageWithPassphrase(elem.value, elem.value_nonce, this.passPhrase, this.pubKey).split(':')[1]
|
||||
}))
|
||||
}
|
||||
@@ -192,6 +196,18 @@ class Store {
|
||||
})
|
||||
}
|
||||
|
||||
get firstName() {
|
||||
return this.decryptedAccountData.find(item => item.key === 'firstname')?.value
|
||||
}
|
||||
|
||||
get lastName() {
|
||||
return this.decryptedAccountData.find(item => item.key === 'secondname')?.value
|
||||
}
|
||||
|
||||
get accountName() {
|
||||
return this.firstName || this.lastName || this.pubKey
|
||||
}
|
||||
|
||||
get keysArray() {
|
||||
return this._keysArray;
|
||||
}
|
||||
@@ -228,6 +244,6 @@ class Store {
|
||||
const sign = cryptography.signDataWithPassphrase(Buffer.from(stringToSign, 'hex'), this.passPhrase).toString('hex')
|
||||
return this.pubKey + ':' +sign
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const registrationStore = new Store();
|
||||
export const store = new Store();
|
||||
|
||||
Reference in New Issue
Block a user