made a reference book

This commit is contained in:
Daria Golova
2022-07-01 17:16:09 +03:00
parent 85897a8efe
commit 9703371f28
2 changed files with 35 additions and 7 deletions

View File

@@ -66,7 +66,7 @@ const Profile = observer (() => {
} }
const sendValues = () => { const sendValues = () => {
if (!userDataStore.data.some((element) => element.property === currentValues.property) && (currentValues.seed.toString().length === 20)) { if (!userDataStore.decryptedData.some((element) => element.property === currentValues.property) && (currentValues.seed.toString().length === 20)) {
setAddPanelOpen(false); setAddPanelOpen(false);
setButtonPanelOpen(true); setButtonPanelOpen(true);
setCurrentValues(defaultValues); setCurrentValues(defaultValues);
@@ -131,7 +131,7 @@ const Profile = observer (() => {
</ul> </ul>
</div> </div>
{/* Table */} {/* Table */}
<ProfileTable selectedItems={handleSelectedItems} userData={userDataStore.data}/> <ProfileTable selectedItems={handleSelectedItems} userData={userDataStore.decryptedData}/>
</div> </div>
{/* Left sidebar */} {/* Left sidebar */}
<div> <div>
@@ -231,7 +231,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.data.filter(({ label }) => selectedItems.includes(label)).map(item => ( {userDataStore.decryptedData.filter(({ label }) => selectedItems.includes(label)).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>

View File

@@ -2,9 +2,37 @@ import { cryptography } from "@liskhq/lisk-client";
import { makeAutoObservable, reaction } from "mobx"; import { makeAutoObservable, reaction } from "mobx";
import { registrationStore } from './store'; import { registrationStore } from './store';
const labelMap = {
first_name: 'First name',
second_name: 'Second name',
gender: "Gender",
birthdate: "Birthdate",
place_of_birth: "Place of birth",
nationality: "Nationality",
national_id: "National id",
national_doctype: "National doctype",
national_doc_id: "National doc id",
national_doc_issue_date: "National doc issue date",
national_doc_expiry_date: "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 UserDataStore{ class UserDataStore{
_data = [] _data = [];
constructor() { constructor() {
makeAutoObservable(this); makeAutoObservable(this);
@@ -13,10 +41,10 @@ class UserDataStore{
}) })
} }
get data(){ get decryptedData(){
return this._data.map((elem) => ({ return this._data.map((elem) => ({
...elem, ...elem,
label: elem.label.charAt(0).toUpperCase()+elem.label.slice(1).split('_').join(' '), 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]
})) }))
} }