diff --git a/src/pages/digitalId/Validate.jsx b/src/pages/digitalId/Validate.jsx index 6596aff..5153e85 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 {validationLogStore} from "../../store/validationLogStore"; 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 => { + {validationLogStore.transactionData.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..8a17a68 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 {validationLogStore} from "../../store/validationLogStore"; +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 + {validationLogStore.transactionData.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..fdda6c0 100644 --- a/src/partials/validationlog/ValidateRoadMap.jsx +++ b/src/partials/validationlog/ValidateRoadMap.jsx @@ -1,7 +1,6 @@ import React from "react"; import ValidationSeasonItem from "./ValidationSeasonItem"; -import ValidationUsersImg from "./ValidationUsersImg"; function ValidateRoadMap({ season }) { @@ -9,25 +8,19 @@ function ValidateRoadMap({ season }) {
-

{season.name}

+

{''}

-
+
{/* Avatars */} -
- {season.usersImges.map(pic => { - return - })} -
-
·
{/* List */}
    {/* List item(s) */} - {season.items.map((item, index) => { - return + {season.assets.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/store/store.js b/src/store/store.js index 92d8de7..c959a32 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -12,12 +12,15 @@ class Store { _userData = {} + _transactionInfo = {} + constructor() { makeAutoObservable(this); this.fetchNodeInfo() reaction(() => this.tokenKey, () => this.fetchNewAccountData()) + reaction(() => this.tokenKey, () => this.fetchTransactionInfo()) }; fetchNewAccountData() { @@ -35,6 +38,14 @@ class Store { .then(()=>this.fetchNewAccountData()) } + fetchTransactionInfo() { + fetchWrapper.getAuth(`http://3.125.47.101/api/account/transactions/b444b7ff3118cf2a30cbd54cfcdb8fd5d805017a?moduleID=1001&assetID=11`, { + networkIdentifier: this.nodeInfo.networkIdentifier, + lastBlockID: this.nodeInfo.lastBlockID + }) + .then((res)=>this.saveInfoTransaction(res)) + } + userDataFetchChange(res) { this._userData = res; } @@ -43,6 +54,10 @@ class Store { return this._userData } + get transactionInfo() { + return this._transactionInfo + } + savePassPhrase(phrase) { this._passPhrase = phrase } @@ -51,6 +66,10 @@ class Store { this._accountData = data; }; + saveInfoTransaction(transaction) { + this._transactionInfo = transaction + } + fetchNodeInfo() { getNodeInfo() .then((info) => this.fetchNodeInfoSuccess(info)) diff --git a/src/store/validationLogStore.js b/src/store/validationLogStore.js new file mode 100644 index 0000000..0cb820e --- /dev/null +++ b/src/store/validationLogStore.js @@ -0,0 +1,39 @@ +import {makeAutoObservable, reaction} from "mobx"; +import {registrationStore} from "./store"; + +const labelMap = { + firstname: 'First name', + secondname: 'Second name', + gender: "Gender", + birthdate: "Birthdate" +}; + +class ValidationLogStore { + _transactionData = []; + + constructor() { + makeAutoObservable(this) + + reaction(() => ({data: registrationStore.transactionInfo}), ({data}) => { + this._transactionData = data.data; + }) + } + + get transactionData() { + return this._transactionData.map(item=>{ + return { + id: item.id, + assets: item.asset.features.map(asset=>{ + return { + transaction_id: item.id, + address: item.asset.recipientAddress, + value: asset.value, + label: labelMap[asset.label], + } + }) + } + }) + } +} + +export const validationLogStore = new ValidationLogStore()