Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
911c13cb87 | ||
|
|
1e9830c8d4 | ||
|
|
a8a6355daa | ||
|
|
444c94690b | ||
|
|
67133c5414 | ||
|
|
f58a94bf24 | ||
|
|
9820692cd9 | ||
|
|
2eeb39abc9 | ||
|
|
5eb4ee16c0 | ||
|
|
bc364d1b85 | ||
|
|
8489bc375c | ||
|
|
b9f795c0e4 |
@@ -1,70 +1,18 @@
|
||||
import React, { useState } from 'react';
|
||||
import {observer} from "mobx-react-lite";
|
||||
|
||||
import {transactionsStore} from "../../store/transactionsStore";
|
||||
import Sidebar from '../../partials/Sidebar';
|
||||
import Header from '../../partials/Header';
|
||||
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 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 [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 (
|
||||
<div className="flex h-screen overflow-hidden">
|
||||
{/* Sidebar */}
|
||||
@@ -110,7 +58,7 @@ function Validate () {
|
||||
<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>
|
||||
{validateItems.map(item => {
|
||||
{transactionsStore.transactionsData.map(item => {
|
||||
return <ValidateRoadMap season={item} key={item.id}/>
|
||||
})}
|
||||
</div>
|
||||
@@ -120,6 +68,6 @@ function Validate () {
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
export default Validate;
|
||||
|
||||
@@ -1,115 +1,14 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, {useState} from 'react';
|
||||
|
||||
import ValidateRoadMap from "../../partials/validationlog/ValidateRoadMap";
|
||||
import {transactionsStore} from "../../store/transactionsStore";
|
||||
import {observer} from "mobx-react-lite";
|
||||
import Sidebar from '../../partials/Sidebar';
|
||||
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 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 (
|
||||
<div className="flex h-screen overflow-hidden">
|
||||
{/* Sidebar */}
|
||||
@@ -129,61 +28,9 @@ function ValidationLog () {
|
||||
<div className="max-w-3xl m-auto mt-6">
|
||||
<div className="xl:-translate-x-16 max-w-fit">
|
||||
{/* PostsID */}
|
||||
{logItems.map(item => {
|
||||
return <ValidateRoadMap season={item} key={item.id} />
|
||||
{transactionsStore.transactionsData.map(item=>{
|
||||
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>
|
||||
@@ -191,6 +38,6 @@ function ValidationLog () {
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
export default ValidationLog;
|
||||
|
||||
@@ -1,83 +1,13 @@
|
||||
import React, { useState } from 'react';
|
||||
import Sidebar from '../../partials/Sidebar';
|
||||
import Header from '../../partials/Header';
|
||||
import { sharedDataStore } from '../../store/sharedDataStore';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
const Verify = (() => {
|
||||
const Verify = observer(() => {
|
||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||
const [descriptionOpen, setDescriptionOpen] = useState(false);
|
||||
|
||||
const verifiedData = [
|
||||
{
|
||||
"date": "31.05.2022 10:48",
|
||||
"fields": [
|
||||
{
|
||||
"name": "Residence",
|
||||
"value": "United Kindom",
|
||||
"hash1": "7234ABC3423423523457234ABC34234",
|
||||
"hash2": "7234ABC3423423523457234ABC34234"
|
||||
},
|
||||
{
|
||||
"name": "Document ID",
|
||||
"value": "A1321313",
|
||||
"hash1": "7234ABC3423423523457234ABC34234",
|
||||
"hash2": "7234ABC3423423523457234ABC34234"
|
||||
},
|
||||
{
|
||||
"name": 'Document ID',
|
||||
"value": 'A3451313',
|
||||
"hash1": '9584ABC3423423523457234ABC34234',
|
||||
"hash2": '9584ABC3423423523457234ABC34234'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"date": "31.05.2022 10:48",
|
||||
"fields": [
|
||||
{
|
||||
"name": 'Residence',
|
||||
"value": 'Holland',
|
||||
"hash1": '1024ABC3423423523457234ABC34234',
|
||||
"hash2": '1024ABC3423423523457234ABC34234'
|
||||
},
|
||||
{
|
||||
"name": 'Document ID',
|
||||
"value": 'B3451313',
|
||||
"hash1": '7893ABC3423423523457234ABC34234',
|
||||
"hash2": '7893ABC3423423523457234ABC34234'
|
||||
},
|
||||
{
|
||||
"name": 'Document ID',
|
||||
"value": 'A3451313',
|
||||
"hash1": '7286ABC3423423523457234ABC34234',
|
||||
"hash2": '7286ABC3423423523457234ABC34234'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
"date": "31.05.2022 10:48",
|
||||
"fields": [
|
||||
{
|
||||
"name": 'Residence',
|
||||
"value": 'China',
|
||||
"hash1": '0000ABC3423423523457234ABC34234',
|
||||
"hash2": '0000ABC3423423523457234ABC34234'
|
||||
},
|
||||
{
|
||||
"name": 'Document ID',
|
||||
"value": 'C3451313',
|
||||
"hash1": '1230ABC3423423523457234ABC34234',
|
||||
"hash2": '1230ABC3423423523457234ABC34234'
|
||||
},
|
||||
{
|
||||
"name": 'Document ID',
|
||||
"value": 'D3451313',
|
||||
"hash1": '4483ABC3423423523457234ABC34234',
|
||||
"hash2": '4483ABC3423423523457234ABC34234'
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="flex h-screen overflow-hidden">
|
||||
{/* Sidebar */}
|
||||
@@ -112,13 +42,10 @@ const Verify = (() => {
|
||||
</div>
|
||||
{/* Block */}
|
||||
<div className="flex flex-col gap-y-4">
|
||||
{verifiedData.map((item, index) => (
|
||||
{sharedDataStore.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-between items-center h-[42px]">
|
||||
<span className="font-normal text-descriptionSize text-slate-500" >
|
||||
Yesterday at {item.date.slice(-5)} AM
|
||||
</span>
|
||||
<div className="flex justify-end items-center h-[42px]">
|
||||
{/* Buttons */}
|
||||
<div className="flex gap-x-[6px]">
|
||||
<div className="flex items-center">
|
||||
@@ -133,7 +60,6 @@ const Verify = (() => {
|
||||
<button
|
||||
className={`text-slate-400 hover:text-slate-500 transform ${descriptionOpen && 'rotate-180'}`}
|
||||
aria-expanded={descriptionOpen}
|
||||
onClick={() => setDescriptionOpen(!descriptionOpen)}
|
||||
>
|
||||
<svg className="w-8 h-8 fill-current" viewBox="0 0 32 32">
|
||||
<path d="M16 20l-5.4-5.4 1.4-1.4 4 4 4-4 1.4 1.4z" />
|
||||
@@ -144,15 +70,13 @@ const Verify = (() => {
|
||||
</div>
|
||||
{/* Content */}
|
||||
<div className='flex flex-col gap-y-[9px]'>
|
||||
{item.fields.map((elem, index) => (
|
||||
{item.data.map((elem, index) => (
|
||||
<div key={index} className='flex gap-y-2'>
|
||||
<div className='flex flex-col'>
|
||||
<div className='flex flex-row items-center'>
|
||||
<span className='font-semibold text-slate-800 text-base w-[204px]'>{elem.value}</span>
|
||||
<span className='font-semibold text-descriptionSize text-slate-600 underline w-80'>{elem.hash1}</span>
|
||||
<span className='font-semibold text-descriptionSize text-slate-600 underline w-80'>{elem.hash2}</span>
|
||||
<span className='font-inter font-semibold text-slate-800 text-base w-[204px]'>{elem.label}</span>
|
||||
<span className='font-inter truncate font-semibold text-descriptionSize text-slate-600 underline w-[770px]'>{elem.value}</span>
|
||||
</div>
|
||||
<span className='font-normal text-xxs'>{elem.name}</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -9,15 +9,15 @@ function ValidateRoadMap({ season }) {
|
||||
<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">{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 className="grow pb-6 border-b border-slate-200">
|
||||
<div className="grow pb-6">
|
||||
<header>
|
||||
<div className="flex flex-nowrap items-center space-x-2 mb-6">
|
||||
{/* Avatars */}
|
||||
<div className="flex shrink-0 -space-x-3 -ml-px">
|
||||
{season.usersImges.map(pic => {
|
||||
return <ValidationUsersImg key={pic.imgId} image={pic}/>
|
||||
{season.users_images.map(pic => {
|
||||
return <ValidationUsersImg image={pic} key={pic.image}/>
|
||||
})}
|
||||
</div>
|
||||
<div className="text-slate-400">·</div>
|
||||
@@ -26,8 +26,8 @@ function ValidateRoadMap({ season }) {
|
||||
{/* List */}
|
||||
<ul className="-my-2">
|
||||
{/* List item(s) */}
|
||||
{season.items.map((item, index) => {
|
||||
return <ValidationSeasonItem key={item.id} length={season.items.length} item={item} index={index}/>
|
||||
{season.transaction.map((item, index) => {
|
||||
return <ValidationSeasonItem key={item.label} length={season.transaction.length} item={item} index={index}/>
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -5,21 +5,21 @@ function ValidationSeasonItem({ length, item, index }) {
|
||||
<li className="relative pt-2 pb-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>}
|
||||
<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">
|
||||
{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>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<a className="cursor-pointer pl-9 font-normal text-sm text-indigo-500 hover:text-indigo-600">Explore -></a>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React from "react";
|
||||
|
||||
function ValidationUsersImg({ image }) {
|
||||
|
||||
return (
|
||||
<a className="block" href="#0">
|
||||
<img className="rounded-full border-2 border-slate-100 box-content" src={image.img} width={`${image.size}`} alt={image.img} height={`${image.size}`}/>
|
||||
<a className="block">
|
||||
<img className="rounded-full border-2 border-slate-100 box-content" src={image.image} width={`${image.size}`} alt={image.image} height={`${image.size}`}/>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
66
src/store/sharedDataStore.js
Normal file
66
src/store/sharedDataStore.js
Normal file
@@ -0,0 +1,66 @@
|
||||
import { makeAutoObservable, reaction } from "mobx";
|
||||
import { fetchWrapper } from "../shared/fetchWrapper";
|
||||
import { registrationStore } from './store';
|
||||
|
||||
const labelMap = {
|
||||
firstname: 'First name',
|
||||
secondname: 'Second name',
|
||||
gender: "Gender",
|
||||
birthdate: "Birthdate",
|
||||
placeofbirth: "Place of birth",
|
||||
nationality: "Nationality",
|
||||
nationalid: "National ID",
|
||||
nationaldoctype: "National doctype",
|
||||
nationaldocid: "National doc ID",
|
||||
nationaldocissuedate: "National doc issue date",
|
||||
nationaldocexpirydate: "National doc expiry date",
|
||||
telephone: "Telephone",
|
||||
twitter: "Twitter",
|
||||
facebook: "Facebook",
|
||||
instagram: "Instagram",
|
||||
youtube: "Youtube",
|
||||
wechat: "Wechat",
|
||||
tiktok: "Tiktok",
|
||||
linkedin: "Linkedin",
|
||||
vk: "Vk",
|
||||
github: "Github",
|
||||
telegram: "Telegram",
|
||||
qq: "Qq",
|
||||
snapchat: "Snapchat",
|
||||
reddit: "Reddit"
|
||||
};
|
||||
|
||||
class SharedDataStore{
|
||||
_keysArray = [];
|
||||
_sharedData = [];
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
|
||||
reaction(() => ({data: registrationStore.keysArray}), ({data}) => {
|
||||
this._keysArray = data;
|
||||
this.fetchSharedData();
|
||||
})
|
||||
}
|
||||
|
||||
fetchSharedData() {
|
||||
this._keysArray.forEach((elem) => fetchWrapper.get(`http://3.125.47.101/api/data/shared/${elem}`).then((res) => this.changeSharedData(res)))
|
||||
};
|
||||
|
||||
changeSharedData(incomingData) {
|
||||
this._sharedData.push({
|
||||
data: incomingData.data,
|
||||
})
|
||||
}
|
||||
|
||||
get sharedData() {
|
||||
return this._sharedData.map(elem => ({
|
||||
data: elem.data.map(item => ({
|
||||
label: labelMap[item.label],
|
||||
value: item.value,
|
||||
}))
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
export const sharedDataStore = new SharedDataStore();
|
||||
@@ -12,35 +12,75 @@ class Store {
|
||||
|
||||
_userData = {}
|
||||
|
||||
_keysArray = []
|
||||
|
||||
_transactionsInfo = {}
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
|
||||
this.fetchNodeInfo()
|
||||
|
||||
reaction(() => this.tokenKey, () => this.fetchNewAccountData())
|
||||
reaction(() => this.tokenKey, () => this.getData())
|
||||
reaction(() => this.tokenKey, () => this.fetchTransactionsInfo())
|
||||
};
|
||||
|
||||
getData() {
|
||||
this.fetchNewAccountData();
|
||||
this.fetchKeysArray();
|
||||
}
|
||||
|
||||
fetchNewAccountData() {
|
||||
fetchWrapper.getAuth('http://3.125.47.101/api/data/private', {
|
||||
fetchWrapper.getAuth('data/private', {
|
||||
networkIdentifier: this.nodeInfo.networkIdentifier,
|
||||
lastBlockID: this.nodeInfo.lastBlockID
|
||||
}).then((res) => this.userDataFetchChange(res))
|
||||
}
|
||||
|
||||
pushAccountData(data=this.accountData) {
|
||||
fetchWrapper.postAuth('http://3.125.47.101/api/data/private', {
|
||||
fetchWrapper.postAuth('data/private', {
|
||||
networkIdentifier: this.nodeInfo.networkIdentifier,
|
||||
lastBlockID: this.nodeInfo.lastBlockID
|
||||
}, [...this.encryptAccountData(data)])
|
||||
.then(()=>this.fetchNewAccountData())
|
||||
}
|
||||
|
||||
fetchKeysArray() {
|
||||
fetchWrapper.getAuth('data/shared/', {
|
||||
networkIdentifier: this.nodeInfo.networkIdentifier,
|
||||
lastBlockID: this.nodeInfo.lastBlockID
|
||||
}).then((res) => this.keysArrayFetchChange(res))
|
||||
}
|
||||
|
||||
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) {
|
||||
this._userData = res;
|
||||
}
|
||||
|
||||
keysArrayFetchChange(res) {
|
||||
this._keysArray = res.data;
|
||||
}
|
||||
|
||||
get keysArray() {
|
||||
return this._keysArray;
|
||||
}
|
||||
|
||||
get userData() {
|
||||
return this._userData
|
||||
return this._userData;
|
||||
}
|
||||
|
||||
get transactionsInfo() {
|
||||
return this._transactionsInfo
|
||||
}
|
||||
|
||||
savePassPhrase(phrase) {
|
||||
@@ -51,6 +91,10 @@ class Store {
|
||||
this._accountData = data;
|
||||
};
|
||||
|
||||
saveInfoTransactions(transaction) {
|
||||
this._transactionsInfo = transaction
|
||||
}
|
||||
|
||||
fetchNodeInfo() {
|
||||
getNodeInfo()
|
||||
.then((info) => this.fetchNodeInfoSuccess(info))
|
||||
@@ -107,7 +151,6 @@ class Store {
|
||||
const sign = cryptography.signDataWithPassphrase(Buffer.from(stringToSign, 'hex'), this.passPhrase).toString('hex')
|
||||
return this.pubKey + ':' +sign
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const registrationStore = new Store();
|
||||
|
||||
51
src/store/transactionsStore.js
Normal file
51
src/store/transactionsStore.js
Normal 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()
|
||||
@@ -17,7 +17,7 @@ module.exports = {
|
||||
blue: '2px solid rgba(0, 112, 244, 0.5)',
|
||||
},
|
||||
fontFamily: {
|
||||
inter: ['Inter', 'sans-serif'],
|
||||
sans: ['Inter', 'sans-serif'],
|
||||
},
|
||||
fontSize: {
|
||||
descriptionSize: ['0.75rem', { lineHeight: '1.25' }],
|
||||
|
||||
Reference in New Issue
Block a user