29 Commits
DID-5 ... DID-8

Author SHA1 Message Date
DwCay
9820692cd9 Добавлен адресс аккаунта совершившего транзакцию 2022-07-13 15:39:20 +03:00
DwCay
5eb4ee16c0 Удален ValidationLogStore 2022-07-13 14:31:27 +03:00
DwCay
bc364d1b85 Исправлен нейминг в store и transactionsStore. Возвращены иконки юзеров на страницу ValidationLog 2022-07-13 14:30:11 +03:00
DwCay
8489bc375c Интеграция страницы ValidationLog с сервером 2022-07-12 19:21:39 +03:00
DuCay
7ad29e8fe0 Merge pull request #34 from franze6/DID-6
Refactoring method saveDataRegistration in store
2022-07-11 11:16:42 +03:00
DwCay
0fb5764a70 Refactoring method saveDataRegistration in store 2022-07-11 11:15:53 +03:00
DuCay
5ebc965a2a Merge pull request #33 from franze6/DID-6
Refactoring in Onboarding steps
2022-07-08 21:24:21 +03:00
DuCay
138047fa10 Merge branch 'master' into DID-6 2022-07-08 21:24:04 +03:00
DwCay
a271da7bf9 Refactoring in Onboarding steps 2022-07-08 21:20:09 +03:00
Kirill Andrusyak
79784cbcee Merge pull request #32 from franze6/DID-7
Создана форма изменения параметров профиля, добавлен функционал для изменения и добавления параметров
2022-07-08 16:32:18 +03:00
Daria Golova
596c44aac3 changed strange IIFE function 2022-07-07 10:19:31 +03:00
Daria Golova
5d17137815 made sending data 2022-07-06 20:22:48 +03:00
Daria Golova
18bf373508 changed the names of the methods 2022-07-06 19:38:09 +03:00
Daria Golova
944c9989e9 fix seed 2022-07-06 19:33:27 +03:00
Daria Golova
202989f374 agreed on form to change and add 2022-07-06 19:33:27 +03:00
Daria Golova
f21d10f830 added prop key, made update form 2022-07-06 19:33:27 +03:00
DuCay
c8604a56ac Merge pull request #31 from franze6/DID-6
Changing data in store to array
2022-07-06 19:27:56 +03:00
DwCay
2d0ae35cc8 Changing data in store to array 2022-07-06 19:27:26 +03:00
DuCay
76f942b90f Merge pull request #30 from franze6/DID-6
Change methods in store
2022-07-06 18:52:22 +03:00
DwCay
f0e0d9479d Change methods in store 2022-07-06 18:51:57 +03:00
DuCay
3403289e0a Merge pull request #29 from franze6/DID-6
New naming for store
2022-07-06 12:59:44 +03:00
DwCay
25fddec6e8 New naming for store 2022-07-06 12:58:53 +03:00
DuCay
1d0cb45024 Merge pull request #28 from franze6/DID-6
Fix naming in store
2022-07-06 12:46:06 +03:00
DwCay
222850dfd9 Fix naming in store 2022-07-06 12:44:53 +03:00
Kirill Andrusyak
8f225752cf Merge pull request #27 from franze6/DID-6
Add method for delete property account
2022-07-06 12:28:46 +03:00
kandrusyak
038657751a add deploy files 2022-07-05 15:18:36 +03:00
kandrusyak
29d7d6fdb8 change endpoint url 2022-07-05 15:12:22 +03:00
DwCay
e44dfee284 Add method for delete property account 2022-07-04 18:02:34 +03:00
Kirill Andrusyak
0f455f126d Merge pull request #26 from franze6/DID-5
Интеграция таблицы страницы Profile с сервером
2022-07-04 10:10:03 +03:00
16 changed files with 410 additions and 341 deletions

15
Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
FROM node:16-alpine AS builder
WORKDIR /front
COPY . .
RUN npm install
RUN npm run build
FROM nginx:1.21.6-alpine as runner
COPY ./deploy/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /front/build /var/www/html
EXPOSE 8080

33
deploy/nginx.conf Normal file
View File

@@ -0,0 +1,33 @@
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
gzip_static on;
server {
listen 8080;
server_name localhost;
charset utf-8;
location / {
root /var/www/html;
try_files $uri /index.html;
etag on;
expires max;
add_header Cache-Control public;
location = /index.html {
expires 0;
add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate";
}
}
}
}

View File

@@ -1,4 +1,4 @@
import React, {useEffect} from 'react'; import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import OnboardingImage from '../images/onboarding-image.jpg'; import OnboardingImage from '../images/onboarding-image.jpg';
@@ -11,9 +11,6 @@ import {registrationStore} from "../store/store";
const Onboarding1 = observer(()=>{ const Onboarding1 = observer(()=>{
let phrase = passphrase.Mnemonic.generateMnemonic() let phrase = passphrase.Mnemonic.generateMnemonic()
registrationStore.savePassPhrase(phrase) registrationStore.savePassPhrase(phrase)
useEffect(()=>{
},[])
return ( return (
<main className="bg-white"> <main className="bg-white">

View File

@@ -1,4 +1,4 @@
import React, {useEffect, useState} from 'react'; import React, {useState} from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { registrationStore } from "../store/store"; import { registrationStore } from "../store/store";
@@ -24,31 +24,22 @@ const Onboarding2 = observer(()=>{
...dataRegistration, ...dataRegistration,
[event.target.id]: newValue [event.target.id]: newValue
}) })
if(!Object.keys(dataRegistration).find(item=>!dataRegistration[item])) {
setFillingForm(true)
}
} }
const saveStoreRegistration = ()=>{ const saveStoreRegistration = ()=>{
Object.keys(dataRegistration).forEach(item=>{ if(fillingForm) {
let element=document.getElementById(item) registrationStore.saveDataRegistration(Object.keys(dataRegistration).map(item=>{
if(dataRegistration[item]) { return{
element.style.borderColor="" key: `${item}`,
} else { value: dataRegistration[item]
element.style.borderColor="red" }
} }))
})
if(Object.keys(dataRegistration).find(item=>!dataRegistration[item])) {
return
} else {
setFillingForm(true)
} }
registrationStore.saveDataRegistration(dataRegistration)
} }
useEffect(()=>{
if(fillingForm===true) {
document.getElementById("signup").click()
}
},[fillingForm])
return ( return (
<main className="bg-white"> <main className="bg-white">

View File

@@ -6,19 +6,18 @@ import {registrationStore} from "../store/store";
import { passphrase } from "@liskhq/lisk-client"; import { passphrase } from "@liskhq/lisk-client";
function Onboarding3() { function Onboarding3() {
const [passPhrase, setPassPhrase] = useState(registrationStore.passPhrase.replace(/\s+/g, ' ').split(' ').map((item, index) => ({str:item, id:index }))) const [passPhrase, setPassPhrase] = useState(convertPhraseToArray(registrationStore.passPhrase))
function generatePassPhrase() { function generatePassPhrase() {
let phrase = passphrase.Mnemonic.generateMnemonic() let phrase = passphrase.Mnemonic.generateMnemonic()
registrationStore.savePassPhrase(phrase) registrationStore.savePassPhrase(phrase)
let newPassPhrase = registrationStore.passPhrase.split(' ').map((item, index) => ({str:item, id:index })) setPassPhrase(convertPhraseToArray(registrationStore.passPhrase))
setPassPhrase(newPassPhrase)
} }
function savePassPhraseInStore (copiedPhrase) { function savePassPhraseInStore (copiedPhrase) {
let phrasePaste = copiedPhrase.trim().replace(/\s+/g, ' ').split(' ') let phrasePaste = convertPhraseToArray(copiedPhrase.trim())
if(phrasePaste.length===12) { if(phrasePaste.length===12) {
registrationStore.savePassPhrase(copiedPhrase) registrationStore.savePassPhrase(copiedPhrase.trim())
setPassPhrase(phrasePaste.map((item, index) => ({str:item, id:index }))) setPassPhrase(phrasePaste)
} else { } else {
return false return false
} }
@@ -28,6 +27,10 @@ function Onboarding3() {
navigator.clipboard.readText().then(res=>savePassPhraseInStore(res)) navigator.clipboard.readText().then(res=>savePassPhraseInStore(res))
} }
function convertPhraseToArray(phrase) {
return phrase.split(' ').map((item, index) => ({str:item, id:index }))
}
return ( return (
<main className="bg-white"> <main className="bg-white">

View File

@@ -1,4 +1,4 @@
import React, {useEffect, useState} from 'react'; import React, {useState} from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg"; import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg";
import Logo from "../images/logo.png"; import Logo from "../images/logo.png";
@@ -7,24 +7,23 @@ import { registrationStore } from "../store/store";
const Onboarding4 = observer(()=>{ const Onboarding4 = observer(()=>{
const [checkBoxesSelected, setCheckBoxesSelected] = useState(false) const [checkBoxesSelected, setCheckBoxesSelected] = useState([])
function createAccount () { function createAccount () {
let checkBoxes=[...document.getElementsByClassName("form-checkbox")] if(checkBoxesSelected.length===2) {
if(checkBoxes.find(item=>item.checked===false)) { registrationStore.pushAccountData()
return
} else {
registrationStore.fetchCreateNewAccount()
setCheckBoxesSelected(true)
} }
} }
useEffect(()=>{ function saveCheckBoxesValues(e) {
if(checkBoxesSelected===true) { const { id, checked } = e.target
document.getElementById("link-dashboard").click() setCheckBoxesSelected([...checkBoxesSelected, id])
if (!checked) {
setCheckBoxesSelected(checkBoxesSelected.filter(item=>item!==id))
} }
},[checkBoxesSelected]) }
const firstNameAccount = registrationStore.accountData.length && registrationStore.accountData.find(item=>item.key==="first_name").value
return ( return (
<main className="bg-white"> <main className="bg-white">
@@ -81,20 +80,20 @@ const Onboarding4 = observer(()=>{
<circle className="text-emerald-100" cx="32" cy="32" r="32" /> <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" /> <path className="text-emerald-500" d="m28.5 41-8-8 3-3 5 5 12-12 3 3z" />
</svg> </svg>
<h1 className="text-3xl text-slate-800 font-bold mb-8">{registrationStore.accountData.first_name ? `Nice to meet you, ${registrationStore.accountData.first_name} 🙌` : 'Please, go back step 2'}</h1> <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"> <button onClick={()=>createAccount()} 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> <Link id="link-dashboard" to={checkBoxesSelected.length===2 && "/dashboard"}>Go To Profile -&gt;</Link>
</button> </button>
</div> </div>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="mr-1"> <div className="mr-1">
<label className="flex items-center"> <label className="flex items-center">
<input type="checkbox" className="form-checkbox" /> <input id="checkbox-1" onChange={(e)=>saveCheckBoxesValues(e)} type="checkbox" className="form-checkbox" />
<span className="text-sm ml-2">I understand that Idntty cannot recover pass phrase</span> <span className="text-sm ml-2">I understand that Idntty cannot recover pass phrase</span>
</label> </label>
<label className="flex items-center"> <label className="flex items-center">
<input type="checkbox" className="form-checkbox" /> <input id="checkbox-2" onChange={(e)=>saveCheckBoxesValues(e)} type="checkbox" className="form-checkbox" />
<div className="text-sm ml-2"> <div className="text-sm ml-2">
I <Link className="text-indigo-500 hover:text-indigo-600 underline" to="/">store my pharse</Link> very carefuly I <Link className="text-indigo-500 hover:text-indigo-600 underline" to="/">store my pharse</Link> very carefuly
</div> </div>

View File

@@ -1,5 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { userDataStore } from '../../store/userDataStore'; import { userDataStore } from '../../store/userDataStore';
import { registrationStore } from "../../store/store";
import Sidebar from '../../partials/Sidebar'; import Sidebar from '../../partials/Sidebar';
import { observer } from 'mobx-react-lite'; import { observer } from 'mobx-react-lite';
import Header from '../../partials/Header'; import Header from '../../partials/Header';
@@ -13,48 +14,76 @@ const Profile = observer (() => {
const [changePanelOpen, setChangePanelOpen] = useState(false); const [changePanelOpen, setChangePanelOpen] = useState(false);
const [toggle, setToggle] = useState(true); const [toggle, setToggle] = useState(true);
const [addPanelOpen, setAddPanelOpen] = useState(false); const [addPanelOpen, setAddPanelOpen] = useState(false);
const [updatePanelOpen, setUpdatePanelOpen] = useState(false);
const [selectedItems, setSelectedItems] = useState([]); const [selectedItems, setSelectedItems] = useState([]);
const defaultValues = { const defaultValues = {
property: '', label: '',
value: '', value: '',
seed: Math.floor(Math.random() * 90000000000000000000) seed: Math.floor(Math.random() * 90000000000000000000)
}; };
const initialPropertyValues = ['First name', 'Second name', 'Birthdate', 'Gender', 'Residence', 'Document type', 'Document ID', 'Issue date', 'Expiry date']; const initialPropertyValues = ['First name', 'Second name', 'Birthdate', 'Gender', 'National doctype', 'National doc id', 'National doc issue date', 'National doc expiry date'];
const [propertyValues, setPropertyValues] = useState([]); const [propertyValues, setPropertyValues] = useState([]);
const [currentValues, setCurrentValues] = useState(defaultValues); const [updatedValues, setUpdatedValues] = useState([defaultValues]);
const [addedValues, setAddedValues] = useState(defaultValues);
const openHint = () => { const openHint = () => {
if (!currentValues.property) { if (!addedValues.label) {
setPropertyValues(initialPropertyValues); setPropertyValues(initialPropertyValues);
} }
} }
const changeCurrentValues = (value, field) => { const changeAddedValues = (value, field) => {
setCurrentValues((prevState)=> ({ setAddedValues((prevState) => (
field !== 'seed' ? {
...prevState, ...prevState,
[field]: value.charAt(0).toUpperCase()+value.slice(1), [field]: value
} : {
...prevState,
[field]: +value,
})) }))
} };
const changeUpdatedValues = (value, field, key) => {
setUpdatedValues((prevState) =>
prevState.map((elem) => (
(elem.key === key && field !== 'seed') ? {
...elem,
[field]: value,
} :
(elem.key === key) ? {
...elem,
[field]: +value,
} : elem
))
)
};
const closeHint = (element) => { const closeHint = (element) => {
changeCurrentValues(element, 'property'); changeAddedValues(element, 'label');
setPropertyValues([]); setPropertyValues([]);
} }
const handleSelectedItems = (selectedItems) => { const handleSelectedItems = (selectedItems) => {
setSelectedItems([...selectedItems]); setSelectedItems([...selectedItems]);
setUpdatedValues(userDataStore.decryptedData.filter(({ key }) => selectedItems.includes(key))
.map(elem => (
(!elem.seed) ? {
...elem,
seed: Math.floor(Math.random() * 90000000000000000000)
}: elem)));
if (selectedItems.length > 0) { if (selectedItems.length > 0) {
setButtonPanelOpen(false); setButtonPanelOpen(false);
setAddPanelOpen(false); setAddPanelOpen(false);
setChangePanelOpen(true); setChangePanelOpen(true);
} }
if (removePanelOpen === true) { if (removePanelOpen === true || updatePanelOpen === true) {
setChangePanelOpen(false); setChangePanelOpen(false);
} }
if (selectedItems.length === 0) { if (selectedItems.length === 0) {
setRemovePanelOpen(false); setRemovePanelOpen(false);
setUpdatePanelOpen(false);
setButtonPanelOpen(true); setButtonPanelOpen(true);
setChangePanelOpen(false); setChangePanelOpen(false);
} }
@@ -65,32 +94,84 @@ const Profile = observer (() => {
setButtonPanelOpen(false); setButtonPanelOpen(false);
} }
const sendValues = () => { const sendAddedData = () => {
if (!userDataStore.decryptedData.some((element) => element.property === currentValues.property) && (currentValues.seed.toString().length === 20)) { if (!userDataStore.decryptedData.some((element) => element.label === addedValues.label) && (addedValues.seed.toString().length === 20)) {
setAddPanelOpen(false); setAddPanelOpen(false);
setButtonPanelOpen(true); setButtonPanelOpen(true);
setCurrentValues(defaultValues); setAddedValues(defaultValues);
addDataParameters();
} }
} }
const sendUpdatedData = () => {
setUpdatePanelOpen(false);
changeDataParameters();
setChangePanelOpen(true);
}
const deleteDataParameters = () => {
const changeData = userDataStore.decryptedData.filter(item=>!selectedItems.includes(item.key))
registrationStore.pushAccountData(changeData);
}
const changeInitialArray = () => {
let newArr = [];
userDataStore.decryptedData.map(elem => {
updatedValues.forEach(item => {
if (elem.label === item.label) {
newArr.push({
...elem,
'value': item.value,
'seed': item.seed,
})
}
})
if (!newArr.find(element => element.label === elem.label)) {
newArr.push(elem);
}
})
return newArr;
}
const changeDataParameters = () => {
const updatedData = changeInitialArray();
registrationStore.pushAccountData(updatedData);
}
const addDataParameters = () => {
addedValues.key = addedValues.label.toLowerCase().split(' ').join('_');
registrationStore.pushAccountData(userDataStore.decryptedData.concat(addedValues));
}
const cancelAddPanel = () => { const cancelAddPanel = () => {
setCurrentValues(defaultValues); setAddedValues(defaultValues);
setAddPanelOpen(false); setAddPanelOpen(false);
setButtonPanelOpen(true); setButtonPanelOpen(true);
} }
const cancelUpdatePanel = () => {
setUpdatePanelOpen(false);
setChangePanelOpen(true);
}
const openRemovePanel = () => { const openRemovePanel = () => {
setRemovePanelOpen(true); setRemovePanelOpen(true);
setChangePanelOpen(false); setChangePanelOpen(false);
} }
const applyRemovePanel = () => { const openUpdatePanel = () => {
setUpdatePanelOpen(true);
setChangePanelOpen(false);
}
const applyDataDeletion = () => {
setRemovePanelOpen(false); setRemovePanelOpen(false);
setButtonPanelOpen(true); setButtonPanelOpen(true);
deleteDataParameters()
} }
const handleInput = (text, field) => { const handleInput = (text, field) => {
changeCurrentValues(text, field); changeAddedValues(text, field);
setPropertyValues(initialPropertyValues); setPropertyValues(initialPropertyValues);
if (text) { if (text) {
let reg = new RegExp(`^${text}`, 'img'); let reg = new RegExp(`^${text}`, 'img');
@@ -157,12 +238,12 @@ const Profile = observer (() => {
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Property <span className="text-rose-500">*</span></label> <label className="block text-sm font-medium mb-1" htmlFor="mandatory">Property <span className="text-rose-500">*</span></label>
<input <input
autoComplete='off' autoComplete='off'
id="property" id="label"
className="form-input w-full" className="form-input w-full"
type="text" type="text"
required required
onInput={(e) => handleInput(e.target.value, 'property')} onInput={(e) => handleInput(e.target.value, 'label')}
value={currentValues.property} value={addedValues.label}
onClick={openHint} onClick={openHint}
/> />
<div className={`flex flex-col gap-y-2 py-2 pl-2 border border-t-0 border-slate-200 rounded ${(propertyValues.length > 0) || 'hidden'}`}> <div className={`flex flex-col gap-y-2 py-2 pl-2 border border-t-0 border-slate-200 rounded ${(propertyValues.length > 0) || 'hidden'}`}>
@@ -182,8 +263,8 @@ const Profile = observer (() => {
type="text" type="text"
required required
onClick={() => setPropertyValues([])} onClick={() => setPropertyValues([])}
onChange={(e) => changeCurrentValues(e.target.value, 'value')} onChange={(e) => changeAddedValues(e.target.value, 'value')}
value={currentValues.value} value={addedValues.value}
/> />
</div> </div>
<div> <div>
@@ -192,11 +273,11 @@ const Profile = observer (() => {
autoComplete='off' autoComplete='off'
id="seed" id="seed"
className="form-input w-full" className="form-input w-full"
type="text" type="number"
required required
onClick={() => setPropertyValues([])} onClick={() => setPropertyValues([])}
onChange={(e) => changeCurrentValues(e.target.value, 'seed')} onChange={(e) => changeAddedValues(e.target.value, 'seed')}
value={currentValues.seed} value={addedValues.seed}
/> />
</div> </div>
</div> </div>
@@ -221,7 +302,79 @@ const Profile = observer (() => {
</button> </button>
<button <button
className="btn-sm bg-indigo-500 hover:bg-indigo-600 text-white" className="btn-sm bg-indigo-500 hover:bg-indigo-600 text-white"
onClick={sendValues} onClick={sendAddedData}
>
Send
</button>
</div>
</div>
{/* Update panel */}
<div className={`${!updatePanelOpen && 'hidden'} bg-white p-5 shadow-lg rounded-sm border border-slate-200 lg:w-72 xl:w-80 mb-11`}>
{updatedValues.map((item, index) => (
<div key={index} className="flex flex-col gap-y-3">
<div>
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Property <span className="text-rose-500">*</span></label>
<input
id={`${item.key}:label`}
className="form-input w-full"
type="text"
required
onChange={(e) => changeUpdatedValues(e.target.value, 'label', item.key)}
value={item.label}
disabled='disabled'
/>
</div>
<div>
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Value <span className="text-rose-500">*</span></label>
<input
autoComplete='off'
id={`${item.key}:value`}
className="form-input w-full"
type="text"
required
onChange={(e) => changeUpdatedValues(e.target.value, 'value', item.key)}
value={item.value}
/>
</div>
<div>
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Seed <span className="text-rose-500">*</span></label>
<input
autoComplete='off'
id={`${item.key}:seed`}
className="form-input w-full"
type="number"
required
onChange={(e) => changeUpdatedValues(e.target.value, 'seed', item.key)}
value={item.seed}
/>
</div>
{(updatedValues[index+1]) ? (
<div className="mt-2 mb-3.5 items-center border-b border-slate-200"></div>
) : null}
</div>
))}
<div className="flex flex-row justify-between pt-[16px] pb-[23px] items-center border-b border-slate-200">
<span className="block text-sm font-medium">Store data on blockchain</span>
<div className="flex items-center">
<div className="form-switch">
<input type="checkbox" id="blockcheined" className="sr-only" checked={toggle} onChange={() => setToggle(!toggle)} />
<label className="bg-slate-400" htmlFor="switch-1">
<span className="bg-white shadow-sm" aria-hidden="true"></span>
</label>
</div>
</div>
</div>
{/* Buttons */}
<div className="flex flex-row justify-end gap-x-2 pt-[18px] pb-[14px] items-end">
<button
className="btn-sm bg-white border-slate-200 hover:bg-slate-50 text-slate-600"
onClick={cancelUpdatePanel}
>
Cansel
</button>
<button
className="btn-sm bg-indigo-500 hover:bg-indigo-600 text-white"
onClick={sendUpdatedData}
> >
Send Send
</button> </button>
@@ -231,7 +384,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`}> <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> <h2 className="grow text-base font-semibold text-slate-800 truncate mb-2">Summary</h2>
<div className="flex flex-col"> <div className="flex flex-col">
{userDataStore.decryptedData.filter(({ label }) => selectedItems.includes(label)).map(item => ( {userDataStore.decryptedData.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> <span key={item.label} className="text-sm font-normal text-slate-600 py-3 border-b border-slate-200">{item.label}</span>
))} ))}
</div> </div>
@@ -249,7 +402,7 @@ const Profile = observer (() => {
<div className="flex flex-row justify-end gap-x-2 pt-[20px] pb-[16px] items-end"> <div className="flex flex-row justify-end gap-x-2 pt-[20px] pb-[16px] items-end">
<button <button
className="btn w-full bg-indigo-500 hover:bg-indigo-600 text-white px-[100px] justify-start" className="btn w-full bg-indigo-500 hover:bg-indigo-600 text-white px-[100px] justify-start"
onClick={applyRemovePanel} onClick={applyDataDeletion}
> >
<svg className="w-4 h-4 fill-current shrink-0" viewBox="0 0 16 16"> <svg className="w-4 h-4 fill-current shrink-0" viewBox="0 0 16 16">
<path d="m2.457 8.516.969-.99 2.516 2.481 5.324-5.304.985.989-6.309 6.284z" /> <path d="m2.457 8.516.969-.99 2.516 2.481 5.324-5.304.985.989-6.309 6.284z" />
@@ -312,7 +465,10 @@ const Profile = observer (() => {
</svg> </svg>
<span className="ml-2">Remove</span> <span className="ml-2">Remove</span>
</button> </button>
<button className="btn w-full border-slate-200 hover:border-slate-300 text-slate-600 px-[100px] justify-start"> <button
className="btn w-full border-slate-200 hover:border-slate-300 text-slate-600 px-[100px] justify-start"
onClick={openUpdatePanel}
>
<svg className="w-4 h-4 fill-rose-500 shrink-0" viewBox="0 0 16 16"> <svg className="w-4 h-4 fill-rose-500 shrink-0" viewBox="0 0 16 16">
<path d="M14.682 2.318A4.485 4.485 0 0 0 11.5 1 4.377 4.377 0 0 0 8 2.707 4.383 4.383 0 0 0 4.5 1a4.5 4.5 0 0 0-3.182 7.682L8 15l6.682-6.318a4.5 4.5 0 0 0 0-6.364Zm-1.4 4.933L8 12.247l-5.285-5A2.5 2.5 0 0 1 4.5 3c1.437 0 2.312.681 3.5 2.625C9.187 3.681 10.062 3 11.5 3a2.5 2.5 0 0 1 1.785 4.251h-.003Z" /> <path d="M14.682 2.318A4.485 4.485 0 0 0 11.5 1 4.377 4.377 0 0 0 8 2.707 4.383 4.383 0 0 0 4.5 1a4.5 4.5 0 0 0-3.182 7.682L8 15l6.682-6.318a4.5 4.5 0 0 0 0-6.364Zm-1.4 4.933L8 12.247l-5.285-5A2.5 2.5 0 0 1 4.5 3c1.437 0 2.312.681 3.5 2.625C9.187 3.681 10.062 3 11.5 3a2.5 2.5 0 0 1 1.785 4.251h-.003Z" />
</svg> </svg>
@@ -335,4 +491,4 @@ const Profile = observer (() => {
) )
}) })
export default Profile export default Profile

View File

@@ -1,70 +1,18 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import {observer} from "mobx-react-lite";
import {transactionsStore} from "../../store/transactionsStore";
import Sidebar from '../../partials/Sidebar'; import Sidebar from '../../partials/Sidebar';
import Header from '../../partials/Header'; import Header from '../../partials/Header';
import ValidateTable from "../../partials/validate/ValidateTable"; import ValidateTable from "../../partials/validate/ValidateTable";
import ValidatePanel from "../../partials/validate/ValidatePanel"; import ValidatePanel from "../../partials/validate/ValidatePanel";
import ValidateRoadMap from "../../partials/validationlog/ValidateRoadMap"; import ValidateRoadMap from "../../partials/validationlog/ValidateRoadMap";
import {Link} from "react-router-dom"; import {Link} from "react-router-dom";
import User06 from "../../images/user-28-06.jpg";
import User08 from "../../images/user-28-08.jpg";
import User09 from "../../images/user-28-09.jpg";
import User05 from "../../images/user-28-05.jpg";
function Validate () { const Validate = observer(()=>{
const [sidebarOpen, setSidebarOpen] = useState(false); const [sidebarOpen, setSidebarOpen] = useState(false);
const [validatePanelOpen, setValidatePanelOpen] = useState(true); const [validatePanelOpen, setValidatePanelOpen] = useState(true);
const validateItems = [
{
id: '40',
name: 'Today',
data: '7234ABC342342352345',
usersImges: [
{
size: 24,
img: User06,
imgId: "343"
},
{
size: 24,
img: User08,
imgId: "345"
},
{
size: 24,
img: User09,
imgId: "321"
},
{
size: 24,
img: User05,
imgId: "387"
},
],
items: [
{
dataSeason: '7234ABC342342352345',
id: '555',
text: 'Second name for',
checked: true
},
{
dataSeason: '7234ABC342342352345',
id: '534',
text: 'Gender name for',
checked: true
},
{
dataSeason: '7234ABC342342352345',
id: '567',
text: 'Document ID name for',
checked: true
},
]
},
];
return ( return (
<div className="flex h-screen overflow-hidden"> <div className="flex h-screen overflow-hidden">
{/* Sidebar */} {/* Sidebar */}
@@ -110,7 +58,7 @@ function Validate () {
<div className="pb-8 border-b border-zinc-200 mt-[50px]"> <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> <h1 className="text-2xl md:text-3xl text-slate-800 font-bold">Digital ID validation log </h1>
</div> </div>
{validateItems.map(item => { {transactionsStore.transactionsData.map(item => {
return <ValidateRoadMap season={item} key={item.id}/> return <ValidateRoadMap season={item} key={item.id}/>
})} })}
</div> </div>
@@ -120,6 +68,6 @@ function Validate () {
</div> </div>
</div> </div>
) )
} })
export default Validate; export default Validate;

View File

@@ -1,115 +1,14 @@
import React, { useState } from 'react'; import React, {useState} from 'react';
import ValidateRoadMap from "../../partials/validationlog/ValidateRoadMap"; import ValidateRoadMap from "../../partials/validationlog/ValidateRoadMap";
import {transactionsStore} from "../../store/transactionsStore";
import {observer} from "mobx-react-lite";
import Sidebar from '../../partials/Sidebar'; import Sidebar from '../../partials/Sidebar';
import Header from '../../partials/Header'; import Header from '../../partials/Header';
import User05 from "../../images/user-28-05.jpg";
import User08 from "../../images/user-28-08.jpg";
import User09 from "../../images/user-28-09.jpg";
import User06 from "../../images/user-28-06.jpg";
import User03 from "../../images/user-28-03.jpg";
import User01 from "../../images/user-28-01.jpg";
function ValidationLog () { const ValidationLog = observer(()=>{
const [sidebarOpen, setSidebarOpen] = useState(false); const [sidebarOpen, setSidebarOpen] = useState(false);
const logItems = [
{
id: '20',
name: 'Today',
data: '7234ABC342342352345',
usersImges: [
{
size: 24,
img: User06,
imgId: "249"
},
{
size: 24,
img: User08,
imgId: "212"
},
{
size: 24,
img: User09,
imgId: "217"
},
{
size: 24,
img: User05,
imgId: "276"
},
],
items: [
{
dataSeason: '7234ABC342342352345',
id: '434',
text: 'Second name',
checked: true
},
{
dataSeason: '7234ABC342342352345',
id: '476',
text: 'First name by',
checked: true
},
{
dataSeason: '7234ABC342342352345',
id: '422',
text: 'Document name by',
checked: true
},
]
},
{
id: '30',
name: 'Last Week',
data: '7234ABC342342352345',
usersImges: [
{
size: 24,
img: User06,
imgId: "145"
},
{
size: 24,
img: User08,
imgId: "182"
},
{
size: 24,
img: User09,
imgId: "154"
},
{
size: 24,
img: User05,
imgId: "114"
},
],
items: [
{
dataSeason: '7234ABC342342352345',
id: '654',
text: 'Gender name by',
checked: true
},
{
dataSeason: '7234ABC342342352345',
id: '617',
text: 'Second name Updated',
checked: false
},
{
dataSeason: '7234ABC342342352345',
id: '643',
text: 'Gender name by',
checked: true
},
]
},
]
return ( return (
<div className="flex h-screen overflow-hidden"> <div className="flex h-screen overflow-hidden">
{/* Sidebar */} {/* Sidebar */}
@@ -129,61 +28,9 @@ function ValidationLog () {
<div className="max-w-3xl m-auto mt-6"> <div className="max-w-3xl m-auto mt-6">
<div className="xl:-translate-x-16 max-w-fit"> <div className="xl:-translate-x-16 max-w-fit">
{/* PostsID */} {/* PostsID */}
{logItems.map(item => { {transactionsStore.transactionsData.map(item=>{
return <ValidateRoadMap season={item} key={item.id} /> return <ValidateRoadMap season={item} key={item.id}/>
})} })}
{/* Post */}
<article className="pt-3">
<div className="xl:flex">
<div className="w-32 shrink-0">
<h2 className="text-xl leading-snug font-bold text-slate-800 xl:leading-7 mb-4 xl:mb-0">Even earlier</h2>
</div>
<div className="grow pb-6 border-b border-slate-200">
<header>
<div className="flex flex-nowrap items-center space-x-2 mb-6">
{/* Avatars */}
<div className="flex shrink-0 -space-x-3 -ml-px">
<a className="block" href="#0">
<img className="rounded-full border-2 border-white box-content" src={User03} width="28" height="28" alt="User 03" />
</a>
<a className="block" href="#0">
<img className="rounded-full border-2 border-white box-content" src={User01} width="28" height="28" alt="User 01" />
</a>
</div>
<div className="text-slate-400">·</div>
</div>
</header>
{/* List */}
<ul className="-my-2">
{/* List item */}
<li className="relative py-2">
<div className="flex items-center mb-1">
<div className="absolute left-0 h-full w-0.5 bg-slate-200 self-start ml-2.5 -translate-x-1/2 translate-y-3" aria-hidden="true"></div>
<div className="absolute left-0 rounded-full bg-white" aria-hidden="true">
<svg className="w-5 h-5 fill-current text-slate-400" viewBox="0 0 20 20">
<path d="M10 18a8 8 0 100-16 8 8 0 000 16zm0 2C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10z" />
</svg>
</div>
<h3 className="text-lg font-bold text-slate-800 pl-9">Product V1 - Early Access</h3>
</div>
<div className="pl-9">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</div>
</li>
{/* List item */}
<li className="relative py-2">
<div className="flex items-center mb-1">
<div className="absolute left-0 rounded-full bg-white" aria-hidden="true">
<svg className="w-5 h-5 fill-current text-slate-400" viewBox="0 0 20 20">
<path d="M10 18a8 8 0 100-16 8 8 0 000 16zm0 2C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10z" />
</svg>
</div>
<h3 className="text-lg font-bold text-slate-800 pl-9">Web3 Compatibility</h3>
</div>
<div className="pl-9">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</div>
</li>
</ul>
</div>
</div>
</article>
</div> </div>
</div> </div>
</div> </div>
@@ -191,6 +38,6 @@ function ValidationLog () {
</div> </div>
</div> </div>
) )
} })
export default ValidationLog; export default ValidationLog;

View File

@@ -31,14 +31,14 @@ function ProfileTable({
const data = { const data = {
general:["First name","Second name", "Gender", "Birthdate", "Place of birth"], general:["First name","Second name", "Gender", "Birthdate", "Place of birth"],
nationality:["Nationality", "National id", "National doctype", "National doc id", "National doc issue date", "National doc expiry date"], nationality:["Nationality", "National ID", "National doctype", "National doc ID", "National doc issue date", "National doc expiry date"],
social:["Telephone", "Twitter", "Facebook", "Instagram", "Youtube", "Wechat", "Tiktok", "Linkedin", "Vk", "Github", "Telegram", "Qq", "Snapchat", "Reddit"] social:["Telephone", "Twitter", "Facebook", "Instagram", "Youtube", "Wechat", "Tiktok", "Linkedin", "Vk", "Github", "Telegram", "Qq", "Snapchat", "Reddit"]
} }
const generalData = userData.filter(elem => data.general.includes(elem.label)), const generalData = userData.filter(elem => data.general.includes(elem.label)),
nationalityData = userData.filter(elem => data.nationality.includes(elem.label)), nationalityData = userData.filter(elem => data.nationality.includes(elem.label)),
sosialData = userData.filter(elem => data.nationality.includes(elem.label)), sosialData = userData.filter(elem => data.social.includes(elem.label)),
otherData = userData.filter((elem) => otherData = userData.filter((elem) =>
!data.general.includes(elem.label) && !data.nationality.includes(elem.label) && !data.social.includes(elem.label)); !data.general.includes(elem.label) && !data.nationality.includes(elem.label) && !data.social.includes(elem.label));
return ( return (
@@ -53,7 +53,7 @@ function ProfileTable({
return ( return (
<ProfileTableItem <ProfileTableItem
key={data.label} key={data.label}
id={data.label} id={data.key}
image={defaultData.image} image={defaultData.image}
value={data.value.charAt(0).toUpperCase()+data.value.slice(1)} value={data.value.charAt(0).toUpperCase()+data.value.slice(1)}
property={data.label} property={data.label}
@@ -61,7 +61,7 @@ function ProfileTable({
transactions={defaultData.transactions} transactions={defaultData.transactions}
avatars={defaultData.avatars} avatars={defaultData.avatars}
handleClick={handleClick} handleClick={handleClick}
isChecked={isCheck.includes(data.label)} isChecked={isCheck.includes(data.key)}
/> />
) )
})} })}
@@ -79,7 +79,7 @@ function ProfileTable({
return ( return (
<ProfileTableItem <ProfileTableItem
key={data.label} key={data.label}
id={data.label} id={data.key}
image={defaultData.image} image={defaultData.image}
value={data.value.charAt(0).toUpperCase()+data.value.slice(1)} value={data.value.charAt(0).toUpperCase()+data.value.slice(1)}
property={data.label} property={data.label}
@@ -87,7 +87,7 @@ function ProfileTable({
transactions={defaultData.transactions} transactions={defaultData.transactions}
avatars={defaultData.avatars} avatars={defaultData.avatars}
handleClick={handleClick} handleClick={handleClick}
isChecked={isCheck.includes(data.label)} isChecked={isCheck.includes(data.key)}
/> />
) )
})} })}
@@ -105,7 +105,7 @@ function ProfileTable({
return ( return (
<ProfileTableItem <ProfileTableItem
key={data.label} key={data.label}
id={data.label} id={data.key}
image={defaultData.image} image={defaultData.image}
value={data.value.charAt(0).toUpperCase()+data.value.slice(1)} value={data.value.charAt(0).toUpperCase()+data.value.slice(1)}
property={data.label} property={data.label}
@@ -113,9 +113,9 @@ function ProfileTable({
transactions={defaultData.transactions} transactions={defaultData.transactions}
avatars={defaultData.avatars} avatars={defaultData.avatars}
handleClick={handleClick} handleClick={handleClick}
isChecked={isCheck.includes(data.label)} isChecked={isCheck.includes(data.key)}
/> />
) )
})} })}
</tbody> </tbody>
</table> </table>
@@ -130,8 +130,8 @@ function ProfileTable({
{otherData.map(data => { {otherData.map(data => {
return ( return (
<ProfileTableItem <ProfileTableItem
key={data.label} key={data.key}
id={data.label} id={data.key}
image={defaultData.image} image={defaultData.image}
value={data.value} value={data.value}
property={data.label} property={data.label}
@@ -139,7 +139,7 @@ function ProfileTable({
transactions={defaultData.transactions} transactions={defaultData.transactions}
avatars={defaultData.avatars} avatars={defaultData.avatars}
handleClick={handleClick} handleClick={handleClick}
isChecked={isCheck.includes(data.label)} isChecked={isCheck.includes(data.key)}
/> />
) )
})} })}

View File

@@ -9,15 +9,15 @@ function ValidateRoadMap({ season }) {
<article className="pt-3"> <article className="pt-3">
<div className="xl:flex"> <div className="xl:flex">
<div className="w-32 shrink-0"> <div className="w-32 shrink-0">
<h2 className="text-xl leading-snug font-bold text-slate-800 xl:leading-7 mb-4 xl:mb-0">{season.name}</h2> <h2 className="text-xl leading-snug font-bold text-slate-800 xl:leading-7 mb-4 xl:mb-0">{''}</h2>
</div> </div>
<div className="grow pb-6 border-b border-slate-200"> <div className="grow pb-6">
<header> <header>
<div className="flex flex-nowrap items-center space-x-2 mb-6"> <div className="flex flex-nowrap items-center space-x-2 mb-6">
{/* Avatars */} {/* Avatars */}
<div className="flex shrink-0 -space-x-3 -ml-px"> <div className="flex shrink-0 -space-x-3 -ml-px">
{season.usersImges.map(pic => { {season.users_images.map(pic => {
return <ValidationUsersImg key={pic.imgId} image={pic}/> return <ValidationUsersImg image={pic} key={pic.image}/>
})} })}
</div> </div>
<div className="text-slate-400">·</div> <div className="text-slate-400">·</div>
@@ -26,8 +26,8 @@ function ValidateRoadMap({ season }) {
{/* List */} {/* List */}
<ul className="-my-2"> <ul className="-my-2">
{/* List item(s) */} {/* List item(s) */}
{season.items.map((item, index) => { {season.transaction.map((item, index) => {
return <ValidationSeasonItem key={item.id} length={season.items.length} item={item} index={index}/> return <ValidationSeasonItem key={item.label} length={season.transaction.length} item={item} index={index}/>
})} })}
</ul> </ul>
</div> </div>

View File

@@ -5,21 +5,21 @@ function ValidationSeasonItem({ length, item, index }) {
<li className="relative pt-2 pb-2.5"> <li className="relative pt-2 pb-2.5">
<div className="flex items-center mb-2.5"> <div className="flex items-center mb-2.5">
{length-1!==index && <div className="absolute left-0 h-full w-0.5 bg-slate-200 self-start ml-2.5 -translate-x-1/2 translate-y-3" aria-hidden="true"></div>} {length-1!==index && <div className="absolute left-0 h-full w-0.5 bg-slate-200 self-start ml-2.5 -translate-x-1/2 translate-y-3" aria-hidden="true"></div>}
<div className={`absolute left-0 rounded-full ${item.checked ? "bg-indigo-500" : "bg-[#FF0000]"}`} aria-hidden="true"> <div className="absolute left-0 rounded-full bg-indigo-500" aria-hidden="true">
<svg className="w-5 h-5 fill-current text-white" viewBox="0 0 20 20"> <svg className="w-5 h-5 fill-current text-white" viewBox="0 0 20 20">
{item.checked && <path d="M14.4 8.4L13 7l-4 4-2-2-1.4 1.4L9 13.8z"/>} <path d="M14.4 8.4L13 7l-4 4-2-2-1.4 1.4L9 13.8z"/>
</svg> </svg>
</div> </div>
<h3 className="text-lg font-bold text-slate-800 pl-9"> <h3 className="text-lg font-bold text-slate-800 pl-9">
{item.text} {item.checked && <a className="cursor-pointer font-bold text-indigo-500 hover:text-indigo-600 underline hover:no-underline" >{`0x${item.dataSeason}`}</a>} {`${item.label} by`} <a className="cursor-pointer font-bold text-indigo-500 hover:text-indigo-600 underline hover:no-underline" >{item.address}</a>
</h3> </h3>
</div> </div>
<div className="block text-slate-800 w-fit pl-9"> <div className="block text-slate-800 w-fit pl-9">
<div className="text-base font-semibold underline mb-[-10px]">{`0x${item.dataSeason}`}</div> <div className="text-base font-semibold underline mb-[-10px]">{item.transaction_id}</div>
<span className="font-normal text-slate-600 text-[10px]">Transactions ID</span> <span className="font-normal text-slate-600 text-[10px]">Transactions ID</span>
</div> </div>
<div className="mb-3.5 block text-slate-800 w-fit pl-9"> <div className="mb-3.5 block text-slate-800 w-fit pl-9">
<div className="text-base font-semibold underline mb-[-10px]">{item.dataSeason}</div> <div className="text-base font-semibold underline mb-[-10px]">{item.value}</div>
<span className="font-normal text-slate-600 text-[10px]">Validated data</span> <span className="font-normal text-slate-600 text-[10px]">Validated data</span>
</div> </div>
<a className="cursor-pointer pl-9 font-normal text-sm text-indigo-500 hover:text-indigo-600">Explore -&gt;</a> <a className="cursor-pointer pl-9 font-normal text-sm text-indigo-500 hover:text-indigo-600">Explore -&gt;</a>

View File

@@ -1,9 +1,10 @@
import React from "react"; import React from "react";
function ValidationUsersImg({ image }) { function ValidationUsersImg({ image }) {
return ( return (
<a className="block" href="#0"> <a className="block">
<img className="rounded-full border-2 border-slate-100 box-content" src={image.img} width={`${image.size}`} alt={image.img} height={`${image.size}`}/> <img className="rounded-full border-2 border-slate-100 box-content" src={image.image} width={`${image.size}`} alt={image.image} height={`${image.size}`}/>
</a> </a>
); );
} }

View File

@@ -4,7 +4,7 @@ import {getNodeInfo} from '../api/node';
import {fetchWrapper} from '../shared/fetchWrapper'; import {fetchWrapper} from '../shared/fetchWrapper';
class Store { class Store {
_accountData = {} _accountData = []
_passPhrase='rocket north inform swift improve fringe sweet crew client canyon bean autumn' _passPhrase='rocket north inform swift improve fringe sweet crew client canyon bean autumn'
@@ -12,28 +12,56 @@ class Store {
_userData = {} _userData = {}
_transactionsInfo = {}
constructor() { constructor() {
makeAutoObservable(this); makeAutoObservable(this);
this.fetchNodeInfo() this.fetchNodeInfo()
reaction(() => this.tokenKey, () => fetchWrapper.getAuth('http://3.125.47.101/api/data/account', { reaction(() => this.tokenKey, () => this.fetchNewAccountData())
networkIdentifier: this.nodeInfo.networkIdentifier, reaction(() => this.tokenKey, () => this.fetchTransactionsInfo())
lastBlockID: this.nodeInfo.lastBlockID
}).then((res) => this.userDataFetchChange(res)))
}; };
fetchCreateNewAccount() { fetchNewAccountData() {
fetchWrapper.postAuth('http://3.125.47.101/api/data/account', { fetchWrapper.getAuth('http://3.125.47.101/api/data/private', {
networkIdentifier: this.nodeInfo.networkIdentifier, networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID lastBlockID: this.nodeInfo.lastBlockID
}, [...this.encryptAccountData]).catch(()=>{}) }).then((res) => this.userDataFetchChange(res))
}; }
pushAccountData(data=this.accountData) {
fetchWrapper.postAuth('http://3.125.47.101/api/data/private', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}, [...this.encryptAccountData(data)])
.then(()=>this.fetchNewAccountData())
}
fetchTransactionsInfo() {
fetchWrapper.getAuth(`http://3.125.47.101/api/account/transactions/${this.accountMadeTransaction}?moduleID=1001&assetID=11`, {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
})
.then((res)=>this.saveInfoTransactions(res))
}
get accountMadeTransaction() {
return "b444b7ff3118cf2a30cbd54cfcdb8fd5d805017a"
}
userDataFetchChange(res) { userDataFetchChange(res) {
this._userData = res; this._userData = res;
} }
get userData() {
return this._userData
}
get transactionsInfo() {
return this._transactionsInfo
}
savePassPhrase(phrase) { savePassPhrase(phrase) {
this._passPhrase = phrase this._passPhrase = phrase
} }
@@ -42,6 +70,10 @@ class Store {
this._accountData = data; this._accountData = data;
}; };
saveInfoTransactions(transaction) {
this._transactionsInfo = transaction
}
fetchNodeInfo() { fetchNodeInfo() {
getNodeInfo() getNodeInfo()
.then((info) => this.fetchNodeInfoSuccess(info)) .then((info) => this.fetchNodeInfoSuccess(info))
@@ -56,10 +88,6 @@ class Store {
console.log(err) console.log(err)
} }
get userData() {
return this._userData;
}
get passPhrase() { get passPhrase() {
return 'rocket north inform swift improve fringe sweet crew client canyon bean autumn' return 'rocket north inform swift improve fringe sweet crew client canyon bean autumn'
} }
@@ -68,11 +96,11 @@ class Store {
return this._accountData return this._accountData
}; };
get encryptAccountData() { encryptAccountData(data) {
return Object.keys(this.accountData).map((label) => { return data.map((item) => {
let value = cryptography.encryptMessageWithPassphrase(cryptography.getRandomBytes(32).toString('hex') + ":" + this.accountData[label], this.passPhrase, this.pubKey); let value = cryptography.encryptMessageWithPassphrase(cryptography.getRandomBytes(32).toString('hex') + ":" + item.value, this.passPhrase, this.pubKey);
return { return {
"label": label, "label": item.key,
"value": value.encryptedMessage, "value": value.encryptedMessage,
"value_nonce": value.nonce, "value_nonce": value.nonce,
} }

View File

@@ -0,0 +1,51 @@
import {makeAutoObservable, reaction} from "mobx";
import {registrationStore} from "./store";
import User05 from "../../src/images/user-28-05.jpg";
import User08 from "../../src/images/user-28-08.jpg";
import User09 from "../../src/images/user-28-09.jpg";
import User06 from "../../src/images/user-28-06.jpg";
const labelMap = {
firstname: 'First name',
secondname: 'Second name',
gender: "Gender",
birthdate: "Birthdate"
};
const usersImages = [User08,User06,User05,User09];
class TransactionsStore {
_transactionsData = [];
constructor() {
makeAutoObservable(this)
reaction(() => ({data: registrationStore.transactionsInfo}), ({data}) => {
this._transactionsData = data.data;
})
}
get transactionsData() {
return this._transactionsData.map(item=>{
return {
id: item.id,
users_images: usersImages.map(image=>{
return {
image: image,
size: 24
}
}),
transaction: item.asset.features.map(asset=>{
return {
transaction_id: item.id,
address: registrationStore.accountMadeTransaction,
value: asset.value,
label: labelMap[asset.label],
}
})
}
})
}
}
export const transactionsStore = new TransactionsStore()

View File

@@ -9,9 +9,9 @@ const labelMap = {
birthdate: "Birthdate", birthdate: "Birthdate",
place_of_birth: "Place of birth", place_of_birth: "Place of birth",
nationality: "Nationality", nationality: "Nationality",
national_id: "National id", national_id: "National ID",
national_doctype: "National doctype", national_doctype: "National doctype",
national_doc_id: "National doc id", national_doc_id: "National doc ID",
national_doc_issue_date: "National doc issue date", national_doc_issue_date: "National doc issue date",
national_doc_expiry_date: "National doc expiry date", national_doc_expiry_date: "National doc expiry date",
telephone: "Telephone", telephone: "Telephone",
@@ -40,14 +40,14 @@ class UserDataStore{
this._data = data.data; this._data = data.data;
}) })
} }
get decryptedData(){ get decryptedData(){
return this._data.map((elem) => ({ return this._data.map((elem) => ({
...elem, ...elem,
key: elem.label,
label: labelMap[elem.label], label: labelMap[elem.label],
value: cryptography.decryptMessageWithPassphrase(elem.value, elem.value_nonce, registrationStore.passPhrase, registrationStore.pubKey).split(':')[1] value: cryptography.decryptMessageWithPassphrase(elem.value, elem.value_nonce, registrationStore.passPhrase, registrationStore.pubKey).split(':')[1]
})) }))
} }
} }
export const userDataStore = new UserDataStore(); export const userDataStore = new UserDataStore();