diff --git a/src/pages/digitalId/Validate.jsx b/src/pages/digitalId/Validate.jsx index 6596aff..36ead06 100644 --- a/src/pages/digitalId/Validate.jsx +++ b/src/pages/digitalId/Validate.jsx @@ -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 (
{/* Sidebar */} @@ -110,7 +58,7 @@ function Validate () {

Digital ID validation log ✨

- {validateItems.map(item => { + {transactionsStore.transactionsData.map(item => { return })}
@@ -120,6 +68,6 @@ function Validate () { ) -} +}) export default Validate; diff --git a/src/pages/digitalId/ValidationLog.jsx b/src/pages/digitalId/ValidationLog.jsx index 75d24b2..a1190b2 100644 --- a/src/pages/digitalId/ValidationLog.jsx +++ b/src/pages/digitalId/ValidationLog.jsx @@ -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 (
{/* Sidebar */} @@ -129,61 +28,9 @@ function ValidationLog () {
{/* PostsID */} - {logItems.map(item => { - return + {transactionsStore.transactionsData.map(item=>{ + return })} - {/* Post */} -
-
-
-

Even earlier

-
-
-
-
- {/* Avatars */} - -
·
-
-
- {/* List */} -
    - {/* List item */} -
  • -
    - - -

    Product V1 - Early Access

    -
    -
    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
    -
  • - {/* List item */} -
  • -
    - -

    Web3 Compatibility

    -
    -
    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
    -
  • -
-
-
-
@@ -191,6 +38,6 @@ function ValidationLog () { ) -} +}) export default ValidationLog; diff --git a/src/partials/validationlog/ValidateRoadMap.jsx b/src/partials/validationlog/ValidateRoadMap.jsx index bab0627..c086b80 100644 --- a/src/partials/validationlog/ValidateRoadMap.jsx +++ b/src/partials/validationlog/ValidateRoadMap.jsx @@ -9,15 +9,15 @@ function ValidateRoadMap({ season }) {
-

{season.name}

+

{''}

-
+
{/* Avatars */}
- {season.usersImges.map(pic => { - return + {season.users_images.map(pic => { + return })}
·
@@ -26,8 +26,8 @@ function ValidateRoadMap({ season }) { {/* List */}
    {/* List item(s) */} - {season.items.map((item, index) => { - return + {season.transaction.map((item, index) => { + return })}
diff --git a/src/partials/validationlog/ValidationSeasonItem.jsx b/src/partials/validationlog/ValidationSeasonItem.jsx index 430ca56..d8925d7 100644 --- a/src/partials/validationlog/ValidationSeasonItem.jsx +++ b/src/partials/validationlog/ValidationSeasonItem.jsx @@ -5,21 +5,21 @@ function ValidationSeasonItem({ length, item, index }) {
  • {length-1!==index && } -
    -
    {`0x${item.dataSeason}`}
    +
    {item.transaction_id}
    Transactions ID
    -
    {item.dataSeason}
    +
    {item.value}
    Validated data
    Explore -> diff --git a/src/partials/validationlog/ValidationUsersImg.jsx b/src/partials/validationlog/ValidationUsersImg.jsx index 7f6b941..4b29d26 100644 --- a/src/partials/validationlog/ValidationUsersImg.jsx +++ b/src/partials/validationlog/ValidationUsersImg.jsx @@ -1,9 +1,10 @@ import React from "react"; function ValidationUsersImg({ image }) { + return ( - - {image.img} + + {image.image} ); } diff --git a/src/store/store.js b/src/store/store.js index 92d8de7..82b1c69 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -12,12 +12,15 @@ class Store { _userData = {} + _transactionsInfo = {} + constructor() { makeAutoObservable(this); this.fetchNodeInfo() reaction(() => this.tokenKey, () => this.fetchNewAccountData()) + reaction(() => this.tokenKey, () => this.fetchTransactionsInfo()) }; fetchNewAccountData() { @@ -35,6 +38,18 @@ class Store { .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) { this._userData = res; } @@ -43,6 +58,10 @@ class Store { return this._userData } + get transactionsInfo() { + return this._transactionsInfo + } + savePassPhrase(phrase) { this._passPhrase = phrase } @@ -51,6 +70,10 @@ class Store { this._accountData = data; }; + saveInfoTransactions(transaction) { + this._transactionsInfo = transaction + } + fetchNodeInfo() { getNodeInfo() .then((info) => this.fetchNodeInfoSuccess(info)) diff --git a/src/store/transactionsStore.js b/src/store/transactionsStore.js new file mode 100644 index 0000000..e2c6f9a --- /dev/null +++ b/src/store/transactionsStore.js @@ -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()