diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..ae23c2e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,18 @@ +{ + "arrowParens": "always", + "useTabs": false, + "tabWidth": 2, + "singleQuote": true, + "endOfLine": "lf", + "jsxBracketSameLine": false, + "trailingComma": "es5", + "overrides": [ + { + "files": "*.json", + "options": { + "singleQuote": false, + "parser": "json" + } + } + ] +} \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx index 588dd67..f3a1ef2 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,35 +1,35 @@ -import React, { useEffect } from "react"; -import { Routes, Route, useLocation } from "react-router-dom"; +import React, { useEffect } from 'react'; +import { Routes, Route, useLocation } from 'react-router-dom'; -import "./css/style.scss"; +import './css/style.scss'; // Import pages -import ProfileId from "./pages/digitalId/ProfileId"; -import ValidationLog from "./pages/digitalId/ValidationLog"; -import Verify from "./pages/digitalId/Verify"; -import Onboarding1 from "./pages/Onboarding1"; -import Onboarding2 from "./pages/Onboarding2"; -import Onboarding3 from "./pages/Onboarding3"; -import Onboarding4 from "./pages/Onboarding4"; -import SharedData from "./pages/SharedData"; -import SignIn from "./pages/SignIn"; -import { LoadingOverlay } from "./components/LoadingOverlay"; -import { store } from "./store/store"; -import { observer } from "mobx-react-lite"; -import Delegates from "./pages/services/Delegates"; -import VPNServers from "./pages/services/VPNServers"; -import VPNPrepare from "./pages/services/VPNPrepare"; +import ProfileId from './pages/digitalId/ProfileId'; +import ValidationLog from './pages/digitalId/ValidationLog'; +import Verify from './pages/digitalId/Verify'; +import Onboarding1 from './pages/Onboarding1'; +import Onboarding2 from './pages/Onboarding2'; +import Onboarding3 from './pages/Onboarding3'; +import Onboarding4 from './pages/Onboarding4'; +import SharedData from './pages/SharedData'; +import SignIn from './pages/SignIn'; +import { LoadingOverlay } from './components/LoadingOverlay'; +import { store } from './store/store'; +import { observer } from 'mobx-react-lite'; +import Delegates from './pages/services/Delegates'; +import VPNServers from './pages/services/VPNServers'; +import VPNPrepare from './pages/services/VPNPrepare'; const App = observer(() => { const location = useLocation(); useEffect(() => { - localStorage.setItem("svgAvatar", ""); + localStorage.setItem('svgAvatar', ''); }, []); useEffect(() => { - document.querySelector("html").style.scrollBehavior = "auto"; + document.querySelector('html').style.scrollBehavior = 'auto'; window.scroll({ top: 0 }); - document.querySelector("html").style.scrollBehavior = ""; + document.querySelector('html').style.scrollBehavior = ''; }, [location.pathname]); // triggered on route change return ( diff --git a/src/api/node.js b/src/api/node.js index 8cd90f5..32cce6c 100644 --- a/src/api/node.js +++ b/src/api/node.js @@ -1,3 +1,3 @@ -import {fetchWrapper} from '../shared/fetchWrapper'; +import { fetchWrapper } from '../shared/fetchWrapper'; -export const getNodeInfo = (headers) => fetchWrapper.get('node/info/', headers) \ No newline at end of file +export const getNodeInfo = (headers) => fetchWrapper.get('node/info/', headers); diff --git a/src/components/DropdownProfile.jsx b/src/components/DropdownProfile.jsx index da94fb9..723e35c 100644 --- a/src/components/DropdownProfile.jsx +++ b/src/components/DropdownProfile.jsx @@ -1,15 +1,12 @@ import React, { useState, useRef, useEffect } from 'react'; -import {observer} from "mobx-react-lite"; +import { observer } from 'mobx-react-lite'; import { Link } from 'react-router-dom'; import Transition from '../utils/Transition'; -import {store} from "../store/store"; -import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg"; +import { store } from '../store/store'; +import { generateSvgAvatar } from '../images/GenerateOnboardingSvg/GenerateSvg'; import UserAvatar from '../images/user-avatar-32.png'; - const DropdownProfile = observer(({ - align -})=>{ - +const DropdownProfile = observer(({ align }) => { const [dropdownOpen, setDropdownOpen] = useState(false); const trigger = useRef(null); @@ -19,7 +16,12 @@ import UserAvatar from '../images/user-avatar-32.png'; useEffect(() => { const clickHandler = ({ target }) => { if (!dropdown.current) return; - if (!dropdownOpen || dropdown.current.contains(target) || trigger.current.contains(target)) return; + if ( + !dropdownOpen || + dropdown.current.contains(target) || + trigger.current.contains(target) + ) + return; setDropdownOpen(false); }; document.addEventListener('click', clickHandler); @@ -37,9 +39,9 @@ import UserAvatar from '../images/user-avatar-32.png'; }); const logOut = () => { - sessionStorage.removeItem('passPhrase') - store.fetchPassPhrase() - } + sessionStorage.removeItem('passPhrase'); + store.fetchPassPhrase(); + }; return (
@@ -50,17 +52,30 @@ import UserAvatar from '../images/user-avatar-32.png'; onClick={() => setDropdownOpen(!dropdownOpen)} aria-expanded={dropdownOpen} > - User + User
- {store.accountName} - + + {store.accountName} + +
setDropdownOpen(false)} >
-
{store.accountName}
+
+ {store.accountName} +
- ) -}) + ); +}); export default DropdownProfile; diff --git a/src/components/DropdownTransaction.jsx b/src/components/DropdownTransaction.jsx index b226706..c15874d 100644 --- a/src/components/DropdownTransaction.jsx +++ b/src/components/DropdownTransaction.jsx @@ -1,5 +1,5 @@ -import React, { useState, useRef, useEffect } from "react"; -import Transition from "../utils/Transition"; +import React, { useState, useRef, useEffect } from 'react'; +import Transition from '../utils/Transition'; function DropdownTransaction({ align, value, onChange }) { const [dropdownOpen, setDropdownOpen] = useState(false); @@ -24,8 +24,8 @@ function DropdownTransaction({ align, value, onChange }) { return; setDropdownOpen(false); }; - document.addEventListener("click", clickHandler); - return () => document.removeEventListener("click", clickHandler); + document.addEventListener('click', clickHandler); + return () => document.removeEventListener('click', clickHandler); }); // close if the esc key is pressed @@ -34,8 +34,8 @@ function DropdownTransaction({ align, value, onChange }) { if (!dropdownOpen || keyCode !== 27) return; setDropdownOpen(false); }; - document.addEventListener("keydown", keyHandler); - return () => document.removeEventListener("keydown", keyHandler); + document.addEventListener('keydown', keyHandler); + return () => document.removeEventListener('keydown', keyHandler); }); return ( @@ -62,7 +62,7 @@ function DropdownTransaction({ align, value, onChange }) { changeValue("Voiting")} + onClick={() => changeValue('Voiting')} > Voiting @@ -89,7 +89,7 @@ function DropdownTransaction({ align, value, onChange }) {
  • changeValue("Unvoiting")} + onClick={() => changeValue('Unvoiting')} > Unvoiting diff --git a/src/components/Filters.js b/src/components/Filters.js index de40574..94ce964 100644 --- a/src/components/Filters.js +++ b/src/components/Filters.js @@ -1,4 +1,4 @@ -import React from "react"; +import React from 'react'; export const Filters = ({ value, onChange, values = [] }) => { return ( diff --git a/src/components/LoadingOverlay.jsx b/src/components/LoadingOverlay.jsx index 9fabc75..3c66f9b 100644 --- a/src/components/LoadingOverlay.jsx +++ b/src/components/LoadingOverlay.jsx @@ -1,15 +1,17 @@ import ReactDOM from 'react-dom'; import React from 'react'; -import {ThreeCircles} from 'react-loader-spinner'; +import { ThreeCircles } from 'react-loader-spinner'; -export const LoadingOverlay = () => ReactDOM.createPortal(( -
    - -
    -), document.body) \ No newline at end of file +export const LoadingOverlay = () => + ReactDOM.createPortal( +
    + +
    , + document.body + ); diff --git a/src/components/PaginationClassic.jsx b/src/components/PaginationClassic.jsx index f976096..8eefdf6 100644 --- a/src/components/PaginationClassic.jsx +++ b/src/components/PaginationClassic.jsx @@ -1,36 +1,49 @@ import React from 'react'; -import cn from 'classnames' +import cn from 'classnames'; -function PaginationClassic({count, limit, offset, onNextPage, onPrevPage}) { +function PaginationClassic({ count, limit, offset, onNextPage, onPrevPage }) { return (
    -
    ); diff --git a/src/css/additional-styles/flatpickr.scss b/src/css/additional-styles/flatpickr.scss index 5f9bd08..1362e01 100644 --- a/src/css/additional-styles/flatpickr.scss +++ b/src/css/additional-styles/flatpickr.scss @@ -4,7 +4,7 @@ // Customise flatpickr $calendarPadding: 24px; $daySize: 36px; -$daysWidth: $daySize*7; +$daysWidth: $daySize * 7; @keyframes fpFadeInDown { from { @@ -18,63 +18,63 @@ $daysWidth: $daySize*7; } .flatpickr-calendar { - border: inherit; - @apply rounded shadow-lg border border-slate-200 left-1/2; - margin-left: - ($daysWidth + $calendarPadding*2)*0.5; - padding: $calendarPadding; - width: $daysWidth + $calendarPadding*2; + border: inherit; + @apply rounded shadow-lg border border-slate-200 left-1/2; + margin-left: -($daysWidth + $calendarPadding * 2) * 0.5; + padding: $calendarPadding; + width: $daysWidth + $calendarPadding * 2; } @screen lg { - .flatpickr-calendar { - @apply left-0 right-auto; - margin-left: 0; - } + .flatpickr-calendar { + @apply left-0 right-auto; + margin-left: 0; + } } .flatpickr-right.flatpickr-calendar { - @apply right-0 left-auto; - margin-left: 0; + @apply right-0 left-auto; + margin-left: 0; } .flatpickr-calendar.animate.open { - animation: fpFadeInDown 200ms ease-out; + animation: fpFadeInDown 200ms ease-out; } .flatpickr-calendar.static { - position: absolute; - top: calc(100% + 4px); + position: absolute; + top: calc(100% + 4px); } .flatpickr-calendar.static.open { - z-index: 20; + z-index: 20; } .flatpickr-days { - width: $daysWidth; + width: $daysWidth; } .dayContainer { - width: $daysWidth; - min-width: $daysWidth; - max-width: $daysWidth; + width: $daysWidth; + min-width: $daysWidth; + max-width: $daysWidth; } .flatpickr-day { - @apply bg-slate-50 text-sm font-medium text-slate-600; - max-width: $daySize; - height: $daySize; - line-height: $daySize; + @apply bg-slate-50 text-sm font-medium text-slate-600; + max-width: $daySize; + height: $daySize; + line-height: $daySize; } .flatpickr-day, .flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { - border: none; + border: none; } -.flatpickr-day, -.flatpickr-day.prevMonthDay, +.flatpickr-day, +.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay, .flatpickr-day.selected.startRange, .flatpickr-day.startRange.startRange, @@ -85,7 +85,7 @@ $daysWidth: $daySize*7; .flatpickr-day.selected.startRange.endRange, .flatpickr-day.startRange.startRange.endRange, .flatpickr-day.endRange.startRange.endRange { - border-radius: 0; + border-radius: 0; } .flatpickr-day.flatpickr-disabled, @@ -95,11 +95,11 @@ $daysWidth: $daySize*7; .flatpickr-day.notAllowed, .flatpickr-day.notAllowed.prevMonthDay, .flatpickr-day.notAllowed.nextMonthDay { - @apply text-slate-400; + @apply text-slate-400; } .rangeMode .flatpickr-day { - margin: 0; + margin: 0; } .flatpickr-day.selected, @@ -120,7 +120,7 @@ $daysWidth: $daySize*7; .flatpickr-day.selected.nextMonthDay, .flatpickr-day.startRange.nextMonthDay, .flatpickr-day.endRange.nextMonthDay { - @apply bg-indigo-500 text-indigo-50; + @apply bg-indigo-500 text-indigo-50; } .flatpickr-day.inRange, @@ -137,92 +137,92 @@ $daysWidth: $daySize*7; .flatpickr-day.nextMonthDay:focus, .flatpickr-day.today:hover, .flatpickr-day.today:focus { - @apply bg-indigo-400 text-indigo-50; + @apply bg-indigo-400 text-indigo-50; } .flatpickr-day.inRange, -.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)), -.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)), -.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) { - box-shadow: none; +.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n + 1)), +.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n + 1)), +.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n + 1)) { + box-shadow: none; } .flatpickr-months { - align-items: center; - margin-top: -8px; - margin-bottom: 6px; + align-items: center; + margin-top: -8px; + margin-bottom: 6px; } .flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { - position: static; - height: auto; - @apply text-slate-600; + position: static; + height: auto; + @apply text-slate-600; } .flatpickr-months .flatpickr-prev-month svg, .flatpickr-months .flatpickr-next-month svg { - width: 7px; - height: 11px; + width: 7px; + height: 11px; } .flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover, .flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { - fill: inherit; - @apply text-slate-400; + fill: inherit; + @apply text-slate-400; } .flatpickr-months .flatpickr-prev-month { - margin-left: -10px; + margin-left: -10px; } .flatpickr-months .flatpickr-next-month { - margin-right: -10px; + margin-right: -10px; } .flatpickr-months .flatpickr-month { - @apply text-slate-800; - height: auto; - line-height: inherit; + @apply text-slate-800; + height: auto; + line-height: inherit; } .flatpickr-current-month { - @apply text-sm font-medium; - position: static; - height: auto; - width: auto; - left: auto; - padding: 0; + @apply text-sm font-medium; + position: static; + height: auto; + width: auto; + left: auto; + padding: 0; } .flatpickr-current-month span.cur-month { - @apply font-medium m-0; + @apply font-medium m-0; } .flatpickr-current-month span.cur-month:hover { - background: none; + background: none; } .flatpickr-current-month input.cur-year { - font-weight: inherit; - box-shadow: none !important; + font-weight: inherit; + box-shadow: none !important; } .numInputWrapper:hover { - background: none; + background: none; } .numInputWrapper span { - display: none; + display: none; } span.flatpickr-weekday { - @apply text-slate-400 font-medium text-xs; + @apply text-slate-400 font-medium text-xs; } .flatpickr-calendar.arrowTop::before, .flatpickr-calendar.arrowTop::after { - display: none; -} \ No newline at end of file + display: none; +} diff --git a/src/css/additional-styles/range-slider.scss b/src/css/additional-styles/range-slider.scss index 6ab0ddd..21f9c36 100644 --- a/src/css/additional-styles/range-slider.scss +++ b/src/css/additional-styles/range-slider.scss @@ -1,55 +1,55 @@ // Range slider $range-thumb-size: 36px; -input[type=range] { +input[type='range'] { + appearance: none; + background: #ccc; + border-radius: 3px; + height: 6px; + margin-top: ($range-thumb-size - 6px) * 0.5; + margin-bottom: ($range-thumb-size - 6px) * 0.5; + --thumb-size: #{$range-thumb-size}; + + &::-webkit-slider-thumb { appearance: none; - background: #ccc; - border-radius: 3px; - height: 6px; - margin-top: ($range-thumb-size - 6px) * 0.5; - margin-bottom: ($range-thumb-size - 6px) * 0.5; - --thumb-size: #{$range-thumb-size}; + -webkit-appearance: none; + background-color: #000; + background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 .5v7L12 4zM0 4l4 3.5v-7z' fill='%23FFF' fill-rule='nonzero'/%3E%3C/svg%3E"); + background-position: center; + background-repeat: no-repeat; + border: 0; + border-radius: 50%; + cursor: pointer; + height: $range-thumb-size; + width: $range-thumb-size; + } - &::-webkit-slider-thumb { - appearance: none; - -webkit-appearance: none; - background-color: #000; - background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 .5v7L12 4zM0 4l4 3.5v-7z' fill='%23FFF' fill-rule='nonzero'/%3E%3C/svg%3E"); - background-position: center; - background-repeat: no-repeat; - border: 0; - border-radius: 50%; - cursor: pointer; - height: $range-thumb-size; - width: $range-thumb-size; - } + &::-moz-range-thumb { + background-color: #000; + background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 .5v7L12 4zM0 4l4 3.5v-7z' fill='%23FFF' fill-rule='nonzero'/%3E%3C/svg%3E"); + background-position: center; + background-repeat: no-repeat; + border: 0; + border: none; + border-radius: 50%; + cursor: pointer; + height: $range-thumb-size; + width: $range-thumb-size; + } - &::-moz-range-thumb { - background-color: #000; - background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 .5v7L12 4zM0 4l4 3.5v-7z' fill='%23FFF' fill-rule='nonzero'/%3E%3C/svg%3E"); - background-position: center; - background-repeat: no-repeat; - border: 0; - border: none; - border-radius: 50%; - cursor: pointer; - height: $range-thumb-size; - width: $range-thumb-size; - } - - &::-ms-thumb { - background-color: #000; - background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 .5v7L12 4zM0 4l4 3.5v-7z' fill='%23FFF' fill-rule='nonzero'/%3E%3C/svg%3E"); - background-position: center; - background-repeat: no-repeat; - border: 0; - border-radius: 50%; - cursor: pointer; - height: $range-thumb-size; - width: $range-thumb-size; - } - - &::-moz-focus-outer { - border: 0; - } -} \ No newline at end of file + &::-ms-thumb { + background-color: #000; + background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 .5v7L12 4zM0 4l4 3.5v-7z' fill='%23FFF' fill-rule='nonzero'/%3E%3C/svg%3E"); + background-position: center; + background-repeat: no-repeat; + border: 0; + border-radius: 50%; + cursor: pointer; + height: $range-thumb-size; + width: $range-thumb-size; + } + + &::-moz-focus-outer { + border: 0; + } +} diff --git a/src/css/additional-styles/theme.scss b/src/css/additional-styles/theme.scss index 5352381..879d0fb 100644 --- a/src/css/additional-styles/theme.scss +++ b/src/css/additional-styles/theme.scss @@ -4,15 +4,14 @@ .form-select, .form-checkbox, .form-radio { - - &:focus { - @apply ring-0; - } + &:focus { + @apply ring-0; + } } .loading-overlay { - background-color: rgba(0, 0, 0, 0.25); - display: flex; - justify-content: center; - align-items: center; + background-color: rgba(0, 0, 0, 0.25); + display: flex; + justify-content: center; + align-items: center; } diff --git a/src/css/additional-styles/toggle-switch.scss b/src/css/additional-styles/toggle-switch.scss index 5faac92..3ff496a 100644 --- a/src/css/additional-styles/toggle-switch.scss +++ b/src/css/additional-styles/toggle-switch.scss @@ -1,44 +1,41 @@ // Switch element .form-switch { - @apply relative select-none; - width: 44px; + @apply relative select-none; + width: 44px; - label { - @apply block overflow-hidden cursor-pointer h-6 rounded-full; + label { + @apply block overflow-hidden cursor-pointer h-6 rounded-full; + + > span:first-child { + @apply absolute block rounded-full; + width: 20px; + height: 20px; + top: 2px; + left: 2px; + right: 50%; + transition: all 0.15s ease-out; + } + } + + input[type='checkbox'] { + &:checked { + + label { + @apply bg-indigo-500; > span:first-child { - @apply absolute block rounded-full; - width: 20px; - height: 20px; - top: 2px; - left: 2px; - right: 50%; - transition: all .15s ease-out; + left: 22px; } + } } - input[type="checkbox"] { - - &:checked { + &:disabled { + + label { + @apply cursor-not-allowed bg-slate-100 border border-slate-200; - + label { - @apply bg-indigo-500; - - > span:first-child { - left: 22px; - } - } - } - - &:disabled { - - + label { - @apply cursor-not-allowed bg-slate-100 border border-slate-200; - - > span:first-child { - @apply bg-slate-400; - } - } + > span:first-child { + @apply bg-slate-400; } + } } -} \ No newline at end of file + } +} diff --git a/src/css/additional-styles/utility-patterns.scss b/src/css/additional-styles/utility-patterns.scss index 58778f4..1f8a00d 100644 --- a/src/css/additional-styles/utility-patterns.scss +++ b/src/css/additional-styles/utility-patterns.scss @@ -1,28 +1,28 @@ // Typography .h1 { - @apply text-4xl font-extrabold tracking-tighter; + @apply text-4xl font-extrabold tracking-tighter; } .h2 { - @apply text-3xl font-extrabold tracking-tighter; + @apply text-3xl font-extrabold tracking-tighter; } .h3 { - @apply text-3xl font-extrabold; + @apply text-3xl font-extrabold; } .h4 { - @apply text-2xl font-extrabold tracking-tight; + @apply text-2xl font-extrabold tracking-tight; } @screen md { - .h1 { - @apply text-5xl; - } + .h1 { + @apply text-5xl; + } - .h2 { - @apply text-4xl; - } + .h2 { + @apply text-4xl; + } } // Buttons @@ -30,30 +30,30 @@ .btn-lg, .btn-sm, .btn-xs { - @apply font-medium text-sm inline-flex items-center justify-center border border-transparent rounded leading-5 shadow-sm transition duration-150 ease-in-out; + @apply font-medium text-sm inline-flex items-center justify-center border border-transparent rounded leading-5 shadow-sm transition duration-150 ease-in-out; } .btn { - @apply px-3 py-2; + @apply px-3 py-2; } .btn-lg { - @apply px-4 py-3; + @apply px-4 py-3; } .btn-sm { - @apply px-2 py-1; + @apply px-2 py-1; } .btn-xs { - @apply px-2 py-0.5; + @apply px-2 py-0.5; } // Forms -input[type="search"]::-webkit-search-decoration, -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-results-button, -input[type="search"]::-webkit-search-results-decoration { +input[type='search']::-webkit-search-decoration, +input[type='search']::-webkit-search-cancel-button, +input[type='search']::-webkit-search-results-button, +input[type='search']::-webkit-search-results-decoration { -webkit-appearance: none; } @@ -63,7 +63,7 @@ input[type="search"]::-webkit-search-results-decoration { .form-select, .form-checkbox, .form-radio { - @apply text-sm text-slate-800 bg-white border; + @apply text-sm text-slate-800 bg-white border; } .form-input, @@ -71,28 +71,28 @@ input[type="search"]::-webkit-search-results-decoration { .form-multiselect, .form-select, .form-checkbox { - @apply rounded; + @apply rounded; } .form-input, .form-textarea, .form-multiselect, .form-select { - @apply leading-5 py-2 px-3 border-slate-200 hover:border-slate-300 focus:border-indigo-300 shadow-sm; + @apply leading-5 py-2 px-3 border-slate-200 hover:border-slate-300 focus:border-indigo-300 shadow-sm; } .form-input, .form-textarea { - @apply placeholder-slate-400; + @apply placeholder-slate-400; } .form-select { - @apply pr-10; + @apply pr-10; } .form-checkbox, .form-radio { - @apply text-indigo-500 border border-slate-300; + @apply text-indigo-500 border border-slate-300; } /* Chrome, Safari and Opera */ @@ -101,6 +101,6 @@ input[type="search"]::-webkit-search-results-decoration { } .no-scrollbar { - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ } diff --git a/src/css/style.scss b/src/css/style.scss index 8af629d..71a0d2f 100644 --- a/src/css/style.scss +++ b/src/css/style.scss @@ -9,4 +9,4 @@ @import 'additional-styles/flatpickr.scss'; @import 'additional-styles/theme.scss'; -@tailwind utilities; \ No newline at end of file +@tailwind utilities; diff --git a/src/images/GenerateOnboardingSvg/GenerateSvg.js b/src/images/GenerateOnboardingSvg/GenerateSvg.js index e8e7add..57e7cca 100644 --- a/src/images/GenerateOnboardingSvg/GenerateSvg.js +++ b/src/images/GenerateOnboardingSvg/GenerateSvg.js @@ -1,92 +1,112 @@ function createBlob(options) { + let points = []; + let slice = (Math.PI * 2) / options.numPoints; + let startAngle = 0; - let points = []; - let slice = (Math.PI * 2) / options.numPoints; - let startAngle = 0; + for (let i = 0; i < options.subkey.length; i++) { + let angle = startAngle + i * slice; + let rnd = Number('0x' + options.subkey.substring(i + 0, i + 1)); + let point = { + x: options.centerX + Math.cos(angle) * (options.radius + rnd), + y: options.centerY + Math.sin(angle) * (options.radius + rnd), + }; + points.push(point); + } - for (let i = 0; i < options.subkey.length; i++) { - let angle = startAngle + i * slice; - let rnd = Number("0x"+options.subkey.substring(i+0,i+1)); - let point = { - x: options.centerX + Math.cos(angle) * (options.radius + rnd), - y: options.centerY + Math.sin(angle) * (options.radius + rnd) - }; - points.push(point); - } + let size = points.length; + let path = 'M' + points[0].x + ' ' + points[0].y + ' C'; - let size = points.length; - let path = "M" + points[0].x + " " + points[0].y + " C"; + for (let i = 0; i < size; i++) { + let p0 = points[(i - 1 + size) % size]; + let p1 = points[i]; + let p2 = points[(i + 1) % size]; + let p3 = points[(i + 2) % size]; - for (let i = 0; i < size; i++) { - let p0 = points[(i - 1 + size) % size]; - let p1 = points[i]; - let p2 = points[(i + 1) % size]; - let p3 = points[(i + 2) % size]; + let x1 = p1.x + (p2.x - p0.x) / 6; + let y1 = p1.y + (p2.y - p0.y) / 6; - let x1 = p1.x + (p2.x - p0.x) / 6; - let y1 = p1.y + (p2.y - p0.y) / 6; + let x2 = p2.x - (p3.x - p1.x) / 6; + let y2 = p2.y - (p3.y - p1.y) / 6; - let x2 = p2.x - (p3.x - p1.x) / 6; - let y2 = p2.y - (p3.y - p1.y) / 6; + path += ' ' + x1 + ' ' + y1 + ' ' + x2 + ' ' + y2 + ' ' + p2.x + ' ' + p2.y; + } - path += " " + x1 + " " + y1 + " " + x2 + " " + y2 + " " + p2.x + " " + p2.y; - } - - return path + "z"; + return path + 'z'; } -export var generateSvgAvatar = ( function () { - return function (publicKey, seed, raw) { - let pubKey = publicKey || Math.floor(Math.random()*65535*65535).toString(16) + Math.floor(Math.random()*65535*65535).toString(16) + Math.floor(Math.random()*65535*65535).toString(16) + Math.floor(Math.random()*65535*65535).toString(16) + Math.floor(Math.random()*65535*65535).toString(16) + Math.floor(Math.random()*65535*65535).toString(16) + Math.floor(Math.random()*65535*65535).toString(16) + Math.floor(Math.random()*65535*65535).toString(16); - //pubKey = "73f47d4929d7b2b6598ca4999d52567f9bb5aef3e353e0a66b468096db6e4e88" - let particles = []; - let gradients = ['#000000']; - let defs = []; +export var generateSvgAvatar = (function () { + return function (publicKey, seed, raw) { + let pubKey = + publicKey || + Math.floor(Math.random() * 65535 * 65535).toString(16) + + Math.floor(Math.random() * 65535 * 65535).toString(16) + + Math.floor(Math.random() * 65535 * 65535).toString(16) + + Math.floor(Math.random() * 65535 * 65535).toString(16) + + Math.floor(Math.random() * 65535 * 65535).toString(16) + + Math.floor(Math.random() * 65535 * 65535).toString(16) + + Math.floor(Math.random() * 65535 * 65535).toString(16) + + Math.floor(Math.random() * 65535 * 65535).toString(16); + //pubKey = "73f47d4929d7b2b6598ca4999d52567f9bb5aef3e353e0a66b468096db6e4e88" + let particles = []; + let gradients = ['#000000']; + let defs = []; - for (let a = 0; a<64; a = a + 8) { - let blob = createBlob({ - numPoints: 8, - centerX: 256, - centerY: 256-a*4, - radius: 16, - subkey: pubKey.substring(a,a + 8) - }); + for (let a = 0; a < 64; a = a + 8) { + let blob = createBlob({ + numPoints: 8, + centerX: 256, + centerY: 256 - a * 4, + radius: 16, + subkey: pubKey.substring(a, a + 8), + }); - let color = "#" + pubKey.substring(a+2,a+8); - let width = Number("0x"+pubKey.substring(a,a+1)); - let opacity = Number("0x"+pubKey.substring(a+1,a+2))/8; + let color = '#' + pubKey.substring(a + 2, a + 8); + let width = Number('0x' + pubKey.substring(a, a + 1)); + let opacity = Number('0x' + pubKey.substring(a + 1, a + 2)) / 8; - gradients.push(color); - defs.push(``); - particles.push(``); + gradients.push(color); + defs.push( + `` + ); + particles.push( + `` + ); + } - } - - let ph = ""; - let off = 4 + Number("0x"+pubKey.substring(0,1)); - let rotate = 0; - for (var i = 0; i < off; i++){ - ph = ph + `,` + "\n"; - rotate = rotate + 360/off; - } - - var svg = [ - '', - '', - '', - '', - '', - '',defs.join('\n'), - '', - '', - particles.join(''), - '', - '', - ph, - '', - '', - ].join(''); - return raw ? svg : 'data:image/svg+xml;base64,' + btoa(svg); - }; + let ph = ''; + let off = 4 + Number('0x' + pubKey.substring(0, 1)); + let rotate = 0; + for (var i = 0; i < off; i++) { + ph = + ph + + `,` + + '\n'; + rotate = rotate + 360 / off; + } + var svg = [ + '', + '', + '', + '', + '', + '', + defs.join('\n'), + '', + '', + particles.join(''), + '', + '', + ph, + '', + '', + ].join(''); + return raw ? svg : 'data:image/svg+xml;base64,' + btoa(svg); + }; })(); diff --git a/src/main.jsx b/src/main.jsx index 3d14e0c..1609207 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -1,24 +1,23 @@ -import React from 'react' -import ReactDOM from 'react-dom' -import {Buffer} from "buffer"; -import { HashRouter as Router } from 'react-router-dom' -import App from './App' -import {store} from './store/store'; - - -globalThis.Buffer = Buffer - -window.store = store; - -BigInt.prototype.toJSON = function() { - return this.toString() -} - -ReactDOM.render( - - - - - , - document.getElementById('root') -) +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Buffer } from 'buffer'; +import { HashRouter as Router } from 'react-router-dom'; +import App from './App'; +import { store } from './store/store'; + +globalThis.Buffer = Buffer; + +window.store = store; + +BigInt.prototype.toJSON = function () { + return this.toString(); +}; + +ReactDOM.render( + + + + + , + document.getElementById('root') +); diff --git a/src/pages/Onboarding1.jsx b/src/pages/Onboarding1.jsx index 9cd07b3..90dcf26 100644 --- a/src/pages/Onboarding1.jsx +++ b/src/pages/Onboarding1.jsx @@ -1,41 +1,41 @@ -import React, {useEffect} from 'react'; +import React, { useEffect } from 'react'; import { Link } from 'react-router-dom'; import OnboardingImage from '../images/onboarding-image.jpg'; import OnboardingDecoration from '../images/auth-decoration.png'; -import Logo from "../images/logo.png"; -import { observer } from "mobx-react-lite"; -import { store } from "../store/store"; -import { Navigate } from "react-router-dom"; +import Logo from '../images/logo.png'; +import { observer } from 'mobx-react-lite'; +import { store } from '../store/store'; +import { Navigate } from 'react-router-dom'; const Onboarding1 = observer(() => { - useEffect(() => { - store.clearDataRegistration() - }, []) + store.clearDataRegistration(); + }, []); - if(store.passPhrase) - return + if (store.passPhrase) + return ; return (
    -
    - {/* Content */}
    -
    -
    - {/* Header */}
    {/* Logo */} - logo + logo
    - Have an account? Sign In + Have an account?{' '} + + Sign In +
    @@ -43,19 +43,42 @@ const Onboarding1 = observer(() => {
    - +
    • - 1 + + 1 +
    • - 2 + + 2 +
    • - 3 + + 3 +
    • - 4 + + 4 +
    @@ -65,49 +88,120 @@ const Onboarding1 = observer(() => {
    - -

    Tell us about your company ✨

    +

    + Tell us about your company ✨ +

    {/* Form */}
    -
    💸 Lorem ipsum is place text commonly?
    -
    Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts.
    +
    + 💸 Lorem ipsum is place text commonly? +
    +
    + Lorem ipsum is placeholder text commonly used in the + graphic, print, and publishing industries for previewing + layouts. +
    - +
    @@ -119,24 +213,34 @@ const Onboarding1 = observer(() => {
    -
    -
    -
    {/* Image */} - -
    ); -}) +}); export default Onboarding1; diff --git a/src/pages/Onboarding2.jsx b/src/pages/Onboarding2.jsx index db80982..9276517 100644 --- a/src/pages/Onboarding2.jsx +++ b/src/pages/Onboarding2.jsx @@ -1,74 +1,81 @@ -import React, {useEffect, useMemo, useState} from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { Link, useNavigate } from 'react-router-dom'; -import { observer } from "mobx-react-lite"; -import { store } from "../store/store"; +import { observer } from 'mobx-react-lite'; +import { store } from '../store/store'; import OnboardingImage from '../images/onboarding-image.jpg'; import OnboardingDecoration from '../images/auth-decoration.png'; -import Logo from "../images/logo.png"; +import Logo from '../images/logo.png'; const Onboarding2 = observer(() => { const navigate = useNavigate(); - const [dataRegistration, setDataRegistration] = useState( - { - firstname: '', - secondname: '', - gender: '', - birthdate: '', - } + const [dataRegistration, setDataRegistration] = useState({ + firstname: '', + secondname: '', + gender: '', + birthdate: '', + }); + + const fillingForm = useMemo( + () => + !Object.keys(dataRegistration).find((item) => !dataRegistration[item]), + [dataRegistration] ); - const fillingForm = useMemo(() => !Object.keys(dataRegistration).find(item => !dataRegistration[item]), [dataRegistration]) - const saveValueChange = (event) => { - const newValue=event.target.value; + const newValue = event.target.value; setDataRegistration({ ...dataRegistration, [event.target.id]: newValue, - }) + }); }; const saveStoreRegistration = () => { if (fillingForm) { - store.saveDataRegistration(Object.keys(dataRegistration).map(item => ({ + store.saveDataRegistration( + Object.keys(dataRegistration).map((item) => ({ key: `${item}`, value: dataRegistration[item], - }) - )) - navigate("/onboarding-3", { replace: true }); + })) + ); + navigate('/onboarding-3', { replace: true }); } }; useEffect(() => { - if(store.accountData.length === 0) - return; - setDataRegistration(store.accountData.reduce((acc, item) => ({ - ...acc, - [item.key]: item.value - }), {})) - - }, []) + if (store.accountData.length === 0) return; + setDataRegistration( + store.accountData.reduce( + (acc, item) => ({ + ...acc, + [item.key]: item.value, + }), + {} + ) + ); + }, []); return (
    -
    - {/* Content */}
    -
    -
    - {/* Header */}
    {/* Logo */} - logo + logo
    - Have an account? Sign In + Have an account?{' '} + + Sign In +
    @@ -76,19 +83,42 @@ const Onboarding2 = observer(() => {
    - +
    • - 1 + + 1 +
    • - 2 + + 2 +
    • - 3 + + 3 +
    • - 4 + + 4 +
    @@ -98,57 +128,120 @@ const Onboarding2 = observer(() => {
    -

    Create your Account ✨

    +

    + Create your Account ✨ +

    {/* Form */}
    - - saveValueChange(event)} className="form-input w-full" type="text" value={dataRegistration.firstname} /> + + saveValueChange(event)} + className="form-input w-full" + type="text" + value={dataRegistration.firstname} + />
    - - saveValueChange(event)} className="form-input w-full" type="text" value={dataRegistration.secondname} /> + + saveValueChange(event)} + className="form-input w-full" + type="text" + value={dataRegistration.secondname} + />
    - - saveValueChange(event)} + className="form-select w-full" + value={dataRegistration.gender} + >
    - - saveValueChange(event)} className="form-input w-full" type="date" autoComplete="on" value={dataRegistration.birthdate} /> + + saveValueChange(event)} + className="form-input w-full" + type="date" + autoComplete="on" + value={dataRegistration.birthdate} + />
    -
    -
    -
    {/* Image */} - -
    ); }); diff --git a/src/pages/Onboarding3.jsx b/src/pages/Onboarding3.jsx index e43686d..6016f5b 100644 --- a/src/pages/Onboarding3.jsx +++ b/src/pages/Onboarding3.jsx @@ -1,53 +1,55 @@ -import React, {useEffect} from 'react'; -import {observer} from "mobx-react-lite"; +import React, { useEffect } from 'react'; +import { observer } from 'mobx-react-lite'; import { Link } from 'react-router-dom'; -import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg"; -import Logo from "../images/logo.png"; -import {store} from "../store/store"; +import { generateSvgAvatar } from '../images/GenerateOnboardingSvg/GenerateSvg'; +import Logo from '../images/logo.png'; +import { store } from '../store/store'; -const Onboarding3 = observer(()=>{ - - useEffect(()=>{ +const Onboarding3 = observer(() => { + useEffect(() => { store.generatePassPhrase(); - }, []) + }, []); const generatePassPhrase = () => { store.generatePassPhrase(); }; - const savePassPhraseInStore = copiedPhrase => { + const savePassPhraseInStore = (copiedPhrase) => { if (copiedPhrase.split(' ').length === 12) { store.savePastPassPhrase(copiedPhrase.trim()); } }; const pastePassPhrase = () => { - navigator.clipboard.readText().then(res => savePassPhraseInStore(res)); + navigator.clipboard.readText().then((res) => savePassPhraseInStore(res)); }; - const convertPassPhraseToArray = () => store.passPhrase.split(' '). - map((item, index) => ({str: item, id: index})); + const convertPassPhraseToArray = () => + store.passPhrase + .split(' ') + .map((item, index) => ({ str: item, id: index })); return (
    -
    - {/* Content */}
    -
    -
    - {/* Header */}
    {/* Logo */} - logo + logo
    - Have an account? Sign In + Have an account?{' '} + + Sign In +
    @@ -55,19 +57,42 @@ const Onboarding3 = observer(()=>{
    - +
    • - 1 + + 1 +
    • - 2 + + 2 +
    • - 3 + + 3 +
    • - 4 + + 4 +
    @@ -77,58 +102,94 @@ const Onboarding3 = observer(()=>{
    -
    -

    Company information ✨

    +

    + Company information ✨ +

    {/* htmlForm */}
    - {convertPassPhraseToArray().map(tag => ( - ))}
    - -
    - <- Back + + <- Back +
    -
    -
    -
    {/* Image */} - -
    ); }); diff --git a/src/pages/Onboarding4.jsx b/src/pages/Onboarding4.jsx index 06c2c8d..a1e4a9f 100644 --- a/src/pages/Onboarding4.jsx +++ b/src/pages/Onboarding4.jsx @@ -1,52 +1,54 @@ -import React, {useState} from 'react'; +import React, { useState } from 'react'; import { Link } from 'react-router-dom'; -import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg"; -import Logo from "../images/logo.png"; -import {observer} from "mobx-react-lite"; -import { store } from "../store/store"; +import { generateSvgAvatar } from '../images/GenerateOnboardingSvg/GenerateSvg'; +import Logo from '../images/logo.png'; +import { observer } from 'mobx-react-lite'; +import { store } from '../store/store'; const Onboarding4 = observer(() => { - const [checkBoxesSelected, setCheckBoxesSelected] = useState([]); function createAccount() { - if(checkBoxesSelected.length === 2) { + if (checkBoxesSelected.length === 2) { store.pushAccountData(); sessionStorage.setItem('passPhrase', store.passPhrase); store.clearDataRegistration(); } - }; + } function saveCheckBoxesValues(e) { const { id, checked } = e.target; setCheckBoxesSelected([...checkBoxesSelected, id]); if (!checked) { - setCheckBoxesSelected(checkBoxesSelected.filter(item => item !== id)); + setCheckBoxesSelected(checkBoxesSelected.filter((item) => item !== id)); } - }; + } - const firstNameAccount = store.accountData.length && store.accountData.find(item => item.key === "firstname").value; + const firstNameAccount = + store.accountData.length && + store.accountData.find((item) => item.key === 'firstname').value; return (
    -
    - {/* Content */}
    -
    -
    - {/* Header */}
    {/* Logo */} - logo + logo
    - Have an account? Sign In + Have an account?{' '} + + Sign In +
    @@ -54,19 +56,42 @@ const Onboarding4 = observer(() => {
    - +
    • - 1 + + 1 +
    • - 2 + + 2 +
    • - 3 + + 3 +
    • - 4 + + 4 +
    @@ -76,50 +101,98 @@ const Onboarding4 = observer(() => {
    -
    - - - + + + -

    {firstNameAccount ? `Nice to meet you, ${firstNameAccount} 🙌` : 'Please, go back step 2'}

    -
    -
    -
    -
    {/* Image */} - -
    ); }); diff --git a/src/pages/ResetPassword.jsx b/src/pages/ResetPassword.jsx index 538b88e..4f0681d 100644 --- a/src/pages/ResetPassword.jsx +++ b/src/pages/ResetPassword.jsx @@ -2,55 +2,77 @@ import React from 'react'; import { Link } from 'react-router-dom'; import AuthImage from '../images/auth-image.jpg'; import AuthDecoration from '../images/auth-decoration.png'; -import Logo from "../images/logo.png"; +import Logo from '../images/logo.png'; function ResetPassword() { return (
    -
    - {/* Content */}
    - {/* Header */}
    {/* Logo */} - logo + logo
    -

    Reset your Password ✨

    +

    + Reset your Password ✨ +

    {/* Form */}
    - - + +
    - +
    -
    {/* Image */} - -
    ); } diff --git a/src/pages/SharedData.jsx b/src/pages/SharedData.jsx index 7a90a2d..34c56fd 100644 --- a/src/pages/SharedData.jsx +++ b/src/pages/SharedData.jsx @@ -1,14 +1,14 @@ -import React, { useEffect, useMemo, useState } from "react"; -import { Link, Navigate, useParams } from "react-router-dom"; -import { generateSvgAvatar } from "../images/GenerateOnboardingSvg/GenerateSvg"; -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 SharedDataRoadMap from "../partials/sharedData/SharedDataRoadmap"; -import { store } from "../store/store"; -import { fetchWrapper } from "../shared/fetchWrapper"; -import { cryptography } from "@liskhq/lisk-client"; -import {generateTransaction} from '../utils/Utils'; +import React, { useEffect, useMemo, useState } from 'react'; +import { Link, Navigate, useParams } from 'react-router-dom'; +import { generateSvgAvatar } from '../images/GenerateOnboardingSvg/GenerateSvg'; +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 SharedDataRoadMap from '../partials/sharedData/SharedDataRoadmap'; +import { store } from '../store/store'; +import { fetchWrapper } from '../shared/fetchWrapper'; +import { cryptography } from '@liskhq/lisk-client'; +import { generateTransaction } from '../utils/Utils'; function SharedData() { const [encryptedData, setEncryptedData] = useState([]); @@ -16,15 +16,15 @@ function SharedData() { const { id } = useParams(); - const [address, pubKey] = id.split(":"); + const [address, pubKey] = id.split(':'); - const passPhrase = sessionStorage.getItem("passPhrase"); + const passPhrase = sessionStorage.getItem('passPhrase'); useEffect(() => { fetchWrapper - .get(`data/shared/${id}`) - .then((res) => setEncryptedData(res.data ?? [])) - .catch((err) => console.log(err)); + .get(`data/shared/${id}`) + .then((res) => setEncryptedData(res.data ?? [])) + .catch((err) => console.log(err)); }, [id]); const decryptedData = useMemo(() => { @@ -32,21 +32,21 @@ function SharedData() { let seed, value, hash; try { [seed, value] = cryptography - .decryptMessageWithPassphrase( - item.value, - item.value_nonce, - passPhrase, - Buffer.from(pubKey, 'hex') - ) - .split(":"); + .decryptMessageWithPassphrase( + item.value, + item.value_nonce, + passPhrase, + Buffer.from(pubKey, 'hex') + ) + .split(':'); hash = cryptography - .hash( - Buffer.concat([ - Buffer.from(seed, "utf8"), - cryptography.hash(value, "utf8"), - ]) - ) - .toString("hex"); + .hash( + Buffer.concat([ + Buffer.from(seed, 'utf8'), + cryptography.hash(value, 'utf8'), + ]) + ) + .toString('hex'); } catch (err) { setHasError(true); console.log(err); @@ -62,19 +62,27 @@ function SharedData() { }, [encryptedData]); const validateAccountData = () => { - const builder = generateTransaction(BigInt(store.accountInfo?.sequence?.nonce || 0), - store.pubKey, store.nodeInfo.networkIdentifier, store.passPhrase) + const builder = generateTransaction( + BigInt(store.accountInfo?.sequence?.nonce || 0), + store.pubKey, + store.nodeInfo.networkIdentifier, + store.passPhrase + ); - const signedTx = builder.validate(decryptedData.map(e => ({ - label: e.label, - value: Buffer.from(e.hash, 'hex') - })), address) + const signedTx = builder.validate( + decryptedData.map((e) => ({ + label: e.label, + value: Buffer.from(e.hash, 'hex'), + })), + address + ); if (signedTx) { - fetchWrapper.post('transactions', {}, signedTx) - .catch((err) => console.log(err)); + fetchWrapper + .post('transactions', {}, signedTx) + .catch((err) => console.log(err)); } - } + }; if (!passPhrase) return ; @@ -103,7 +111,14 @@ function SharedData() {
  • ))} - {!hasError && } + {!hasError && ( + + )} diff --git a/src/pages/SignIn.jsx b/src/pages/SignIn.jsx index 80b079d..dc5425a 100644 --- a/src/pages/SignIn.jsx +++ b/src/pages/SignIn.jsx @@ -1,16 +1,15 @@ -import React, {useState} from 'react'; -import {observer} from "mobx-react-lite"; +import React, { useState } from 'react'; +import { observer } from 'mobx-react-lite'; import { Link } from 'react-router-dom'; -import {generateSvgAvatar} from "../images/GenerateOnboardingSvg/GenerateSvg"; -import Logo from "../images/logo.png"; -import {store} from "../store/store"; +import { generateSvgAvatar } from '../images/GenerateOnboardingSvg/GenerateSvg'; +import Logo from '../images/logo.png'; +import { store } from '../store/store'; -const SignIn = observer(()=>{ +const SignIn = observer(() => { + const [passPhrase, setPassPhrase] = useState('- - - - - - - - - - - -'); + const [addedPassPhrase, setAddedPassPhrase] = useState(false); - const[passPhrase, setPassPhrase] = useState('- - - - - - - - - - - -'); - const[addedPassPhrase, setAddedPassPhrase] = useState(false); - - function savePassPhrase (copiedPhrase) { + function savePassPhrase(copiedPhrase) { if (copiedPhrase.split(' ').length === 12) { store.savePastPassPhrase(copiedPhrase.trim()); setPassPhrase(store.passPhrase); @@ -19,55 +18,67 @@ const SignIn = observer(()=>{ } function convertPassPhraseToArray() { - return passPhrase.split(' ').map((item, index) => ({str:item, id:index})); + return passPhrase + .split(' ') + .map((item, index) => ({ str: item, id: index })); } function pastePassPhrase() { - navigator.clipboard.readText().then(res => savePassPhrase(res)); + navigator.clipboard.readText().then((res) => savePassPhrase(res)); } return (
    -
    - {/* Content */}
    -
    -
    - {/* Header */}
    {/* Logo */} - logo + logo
    - Have not an account? Sign Up + Have not an account?{' '} + + Sign Up +
    -
    -

    Company information ✨

    +

    + Company information ✨ +

    {/* htmlForm */}
    - {convertPassPhraseToArray().map(tag => ( - ))}
    - @@ -75,29 +86,37 @@ const SignIn = observer(()=>{
    -
    -
    -
    {/* Image */} -
    ); }); diff --git a/src/pages/digitalId/ProfileId.jsx b/src/pages/digitalId/ProfileId.jsx index 380c7e7..7fe1564 100644 --- a/src/pages/digitalId/ProfileId.jsx +++ b/src/pages/digitalId/ProfileId.jsx @@ -1,16 +1,25 @@ import React, { useState, useEffect } from 'react'; -import { store } from "../../store/store"; +import { store } from '../../store/store'; import Sidebar from '../../partials/Sidebar'; import { observer } from 'mobx-react-lite'; import Header from '../../partials/Header'; import ProfileTable from '../../partials/profile/ProfileTable'; import Image from '../../images/transactions-image-04.svg'; -import {labelMap} from '../../shared/labelMap'; -import {statusMap} from "../../shared/statusMap"; +import { labelMap } from '../../shared/labelMap'; +import { statusMap } from '../../shared/statusMap'; -const initialPropertyValues = ['First name', 'Second name', 'Birthdate', 'Gender', 'National doctype', 'National doc ID', 'National doc issue date', 'National doc expiry date']; +const initialPropertyValues = [ + 'First name', + 'Second name', + 'Birthdate', + 'Gender', + 'National doctype', + 'National doc ID', + 'National doc issue date', + 'National doc expiry date', +]; -const Profile = observer (() => { +const Profile = observer(() => { const defaultValues = { label: '', value: '', @@ -30,20 +39,20 @@ const Profile = observer (() => { const [updatedValues, setUpdatedValues] = useState([defaultValues]); const [addedValues, setAddedValues] = useState(defaultValues); const [isCheck, setIsCheck] = useState([]); - const [alreadyExists, setAlreadyExists] = useState(false) + const [alreadyExists, setAlreadyExists] = useState(false); const [blockChainValue, setBlockChainValue] = useState(''); - const [publicKey, setPublicKey] = useState('') + const [publicKey, setPublicKey] = useState(''); useEffect(() => { handleSelectedItems(isCheck); - // eslint-disable-next-line react-hooks/exhaustive-deps + // eslint-disable-next-line react-hooks/exhaustive-deps }, [isCheck]); - const handleClick = e => { + const handleClick = (e) => { const { id, checked } = e.target; setIsCheck([...isCheck, id]); if (!checked || !id) { - setIsCheck(isCheck.filter(item => item !== id)); + setIsCheck(isCheck.filter((item) => item !== id)); } }; @@ -57,27 +66,29 @@ const Profile = observer (() => { setAddedValues((prevState) => ({ ...prevState, [field]: value, - })) + })); }; const changeUpdatedValues = (value, field, key) => { - if(field==='value') { - setBlockChainValue(value) + if (field === 'value') { + setBlockChainValue(value); } setUpdatedValues((prevState) => - prevState.map((elem) => ( - (elem.key === key) ? { - ...elem, - [field]: value, - } : elem - )) - ) + prevState.map((elem) => + elem.key === key + ? { + ...elem, + [field]: value, + } + : elem + ) + ); }; const selectHint = (element) => { changeAddedValues(element, 'label'); setPropertyValues([]); - } + }; const closeHint = (eventTarget) => { if (!eventTarget || eventTarget.tabIndex !== -1) { @@ -87,12 +98,21 @@ const Profile = observer (() => { const handleSelectedItems = (selectedItems) => { setSelectedItems([...selectedItems]); - setUpdatedValues(store.decryptedAccountData.filter(({ key }) => selectedItems.includes(key)) - .map(elem => ( - (!elem.seed) ? { - ...elem, - seed: String(Math.floor(Math.random() * 90000000000000000000), 10), - }: elem))); + setUpdatedValues( + store.decryptedAccountData + .filter(({ key }) => selectedItems.includes(key)) + .map((elem) => + !elem.seed + ? { + ...elem, + seed: String( + Math.floor(Math.random() * 90000000000000000000), + 10 + ), + } + : elem + ) + ); if (selectedItems.length > 0) { setButtonPanelOpen(false); setAddPanelOpen(false); @@ -115,8 +135,9 @@ const Profile = observer (() => { }; const sendAddedData = () => { - const checkingAddedData = !store.decryptedAccountData - .some((element) => element.label === addedValues.label) + const checkingAddedData = !store.decryptedAccountData.some( + (element) => element.label === addedValues.label + ); setAlreadyExists(!checkingAddedData); if (checkingAddedData) { setAddPanelOpen(false); @@ -134,54 +155,65 @@ const Profile = observer (() => { }; const deleteDataParameters = () => { - const changeData = store.decryptedAccountData.filter(item=>!selectedItems.includes(item.key)); + const changeData = store.decryptedAccountData.filter( + (item) => !selectedItems.includes(item.key) + ); store.pushAccountData(changeData); - if(storeOnBlockchain) - store.pushAccountDataToBlockchain(changeData.filter(elem=>elem.status!=='Stored')) + if (storeOnBlockchain) + store.pushAccountDataToBlockchain( + changeData.filter((elem) => elem.status !== 'Stored') + ); }; const changeInitialArray = () => { let newArr = []; - store.decryptedAccountData.map(elem => { - updatedValues.forEach(item => { + store.decryptedAccountData.map((elem) => { + updatedValues.forEach((item) => { if (elem.label === item.label) { newArr.push({ ...elem, status: 'new', - 'value': item.value, - 'seed': item.seed, - }) + value: item.value, + seed: item.seed, + }); } - }) - if (!newArr.find(element => element.label === elem.label)) { + }); + if (!newArr.find((element) => element.label === elem.label)) { newArr.push(elem); } - }) + }); return newArr; }; const changeDataParameters = () => { const updatedData = changeInitialArray(); store.pushAccountData(updatedData); - if(storeOnBlockchain) - store.pushAccountDataToBlockchain(updatedData.filter(elem=>elem.status!=='Stored')) + if (storeOnBlockchain) + store.pushAccountDataToBlockchain( + updatedData.filter((elem) => elem.status !== 'Stored') + ); }; const shareAccountData = () => { - const sharedData = store.decryptedAccountData.filter(item => selectedItems.includes(item.key)) - store.pushSharedData(sharedData, publicKey) + const sharedData = store.decryptedAccountData.filter((item) => + selectedItems.includes(item.key) + ); + store.pushSharedData(sharedData, publicKey); cancelSharePanel(); - } + }; const addDataParameters = () => { const label = addedValues.label.toLowerCase().split(' ').join(''); - if(labelMap[label]) + if (labelMap[label]) addedValues.key = addedValues.label.toLowerCase().split(' ').join(''); - else - addedValues.key = addedValues.label + else addedValues.key = addedValues.label; store.pushAccountData(store.decryptedAccountData.concat(addedValues)); - if(storeOnBlockchain) - store.pushAccountDataToBlockchain(store.decryptedAccountData.concat(addedValues).filter(elem=>elem.status!=='Stored')) + if (storeOnBlockchain) + store.pushAccountDataToBlockchain( + store.decryptedAccountData + .concat(addedValues) + .filter((elem) => elem.status !== 'Stored') + ); }; const cancelAddPanel = () => { @@ -191,12 +223,21 @@ const Profile = observer (() => { }; const cancelUpdatePanel = () => { - setUpdatedValues(store.decryptedAccountData.filter(({ key }) => selectedItems.includes(key)) - .map(elem => ( - (!elem.seed) ? { - ...elem, - seed: String(Math.floor(Math.random() * 90000000000000000000), 10), - }: elem))); + setUpdatedValues( + store.decryptedAccountData + .filter(({ key }) => selectedItems.includes(key)) + .map((elem) => + !elem.seed + ? { + ...elem, + seed: String( + Math.floor(Math.random() * 90000000000000000000), + 10 + ), + } + : elem + ) + ); setUpdatePanelOpen(false); setChangePanelOpen(true); setIsCheck([]); @@ -210,12 +251,12 @@ const Profile = observer (() => { const openSharePanel = () => { setSharePanelOpen(true); setChangePanelOpen(false); - } + }; const cancelSharePanel = () => { setSharePanelOpen(false); setChangePanelOpen(true); - } + }; const openUpdatePanel = () => { setUpdatePanelOpen(true); @@ -234,7 +275,9 @@ const Profile = observer (() => { setPropertyValues(initialPropertyValues); if (text) { let reg = new RegExp(`^${text}`, 'img'); - setPropertyValues((prevState) => prevState.filter((element) => element.match(reg))); + setPropertyValues((prevState) => + prevState.filter((element) => element.match(reg)) + ); } }; @@ -272,19 +315,26 @@ const Profile = observer (() => { {/* Table */}
    - +
    {/* Left sidebar */}
    {/* Button panel*/} -
    +
    {/* Add panel */} -
    -
    - +
    +
    + handleInput(e.target.value, 'label')} @@ -307,48 +368,90 @@ const Profile = observer (() => { onClick={openHint} onBlur={(e) => closeHint(e.relatedTarget)} /> -
    0) || 'hidden'}`}> +
    0 || 'hidden' + }`} + >
      {propertyValues.map((element, index) => ( -
    • selectHint(element)}>{element}
    • +
    • selectHint(element)} + > + {element} +
    • ))}
    -
    - { alreadyExists &&
    This property already added!
    } +
    + {alreadyExists && ( +
    + This property already added! +
    + )}
    -
    - +
    + setPropertyValues([])} - onChange={(e) => changeAddedValues(e.target.value, 'value')} + onChange={(e) => + changeAddedValues(e.target.value, 'value') + } value={addedValues.value} />
    -
    - +
    + setPropertyValues([])} - onChange={(e) => changeAddedValues(e.target.value, 'seed')} + onChange={(e) => + changeAddedValues(e.target.value, 'seed') + } value={addedValues.seed} />
    - Store data on blockchain + + Store data on blockchain +
    - setStoreOnBlockchain(!storeOnBlockchain)} /> -
    @@ -370,57 +473,111 @@ const Profile = observer (() => {
    {/* Update panel */} -
    +
    {updatedValues.map((item, index) => (
    - + changeUpdatedValues(e.target.value, 'label', item.key)} + onChange={(e) => + changeUpdatedValues( + e.target.value, + 'label', + item.key + ) + } value={item.label} disabled />
    - + changeUpdatedValues(e.target.value, 'value', item.key)} - value={item.status===statusMap.blockchained?blockChainValue : item.value} + onChange={(e) => + changeUpdatedValues( + e.target.value, + 'value', + item.key + ) + } + value={ + item.status === statusMap.blockchained + ? blockChainValue + : item.value + } />
    - + changeUpdatedValues(e.target.value, 'seed', item.key)} + onChange={(e) => + changeUpdatedValues( + e.target.value, + 'seed', + item.key + ) + } value={item.seed} />
    - {(updatedValues[index+1]) ? ( -
    + {updatedValues[index + 1] ? ( +
    ) : null}
    ))}
    - Store data on blockchain + + Store data on blockchain +
    - setStoreOnBlockchain(!storeOnBlockchain)} /> -
    @@ -442,20 +599,46 @@ const Profile = observer (() => {
    {/* Remove panel */} -
    -

    Summary

    +
    +

    + Summary +

    - {store.decryptedAccountData.filter(({ key }) => selectedItems.includes(key)).map(item => ( - {item.label} - ))} + {store.decryptedAccountData + .filter(({ key }) => selectedItems.includes(key)) + .map((item) => ( + + {item.label} + + ))}
    - On blockchain too + + On blockchain too +
    - setStoreOnBlockchain(!storeOnBlockchain)} /> -
    @@ -464,24 +647,39 @@ const Profile = observer (() => {
    - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do Terms. + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, + sed do Terms. +
    {/* Share panel */} -
    -
    -
    - +
    +
    +
    + {
    {/* Details */} -
    +
    {/* Top */}
    - Transaction 04 + Transaction 04 +
    +
    + 0.012 IDN +
    +
    + Total amount fee
    -
    0.012 IDN
    -
    Total amount fee
    {/* Divider */} -
    - ) -}) + ); +}); -export default Profile +export default Profile; diff --git a/src/pages/digitalId/Validate.jsx b/src/pages/digitalId/Validate.jsx index 351b92c..21ff5d9 100644 --- a/src/pages/digitalId/Validate.jsx +++ b/src/pages/digitalId/Validate.jsx @@ -1,12 +1,12 @@ import React, { useState } from 'react'; -import {observer} from "mobx-react-lite"; +import { observer } from 'mobx-react-lite'; 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 {store} from "../../store/store"; +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 { store } from '../../store/store'; const Validate = observer(() => { const [sidebarOpen, setSidebarOpen] = useState(false); @@ -23,12 +23,19 @@ const Validate = observer(() => {
    - {/* Page header */} + {/* Page header */}
    {/* Title */} -

    0x28394710234192304719234

    +

    + 0x28394710234192304719234 +

    - Explore -> + + Explore -> +
    • @@ -53,20 +60,25 @@ const Validate = observer(() => {
    - +
    -

    Digital ID validation log ✨

    +

    + Digital ID validation log ✨ +

    - {store.transactionsInfo.map(item => { - return + {store.transactionsInfo.map((item) => { + return ; })}
    - +
    - ) -}) + ); +}); export default Validate; diff --git a/src/pages/digitalId/ValidationLog.jsx b/src/pages/digitalId/ValidationLog.jsx index 9644d80..9dc6e0f 100644 --- a/src/pages/digitalId/ValidationLog.jsx +++ b/src/pages/digitalId/ValidationLog.jsx @@ -1,42 +1,44 @@ -import React, {useState} from 'react'; -import ValidateRoadMap from "../../partials/validationLog/ValidateRoadMap"; -import {observer} from "mobx-react-lite"; +import React, { useState } from 'react'; +import ValidateRoadMap from '../../partials/validationLog/ValidateRoadMap'; +import { observer } from 'mobx-react-lite'; import Sidebar from '../../partials/Sidebar'; import Header from '../../partials/Header'; -import {store} from "../../store/store"; +import { store } from '../../store/store'; const ValidationLog = observer(() => { const [sidebarOpen, setSidebarOpen] = useState(false); return ( -
    - {/* Sidebar */} - - {/* Content area */} -
    - {/* Site header */} -
    -
    -
    - {/* Page header */} -
    - {/* Title */} -

    Digital ID transaction log ✨

    -
    - {/*Psosts*/} -
    -
    - {/* PostsID */} - {store.transactionsInfo.map(item => { - return - })} -
    +
    + {/* Sidebar */} + + {/* Content area */} +
    + {/* Site header */} +
    +
    +
    + {/* Page header */} +
    + {/* Title */} +

    + Digital ID transaction log ✨ +

    +
    + {/*Psosts*/} +
    +
    + {/* PostsID */} + {store.transactionsInfo.map((item) => { + return ; + })}
    -
    -
    +
    +
    - ) -}) +
    + ); +}); export default ValidationLog; diff --git a/src/pages/digitalId/Verify.jsx b/src/pages/digitalId/Verify.jsx index 4ccdda6..044b222 100644 --- a/src/pages/digitalId/Verify.jsx +++ b/src/pages/digitalId/Verify.jsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import Sidebar from '../../partials/Sidebar'; import Header from '../../partials/Header'; -import {store} from "../../store/store"; +import { store } from '../../store/store'; import { observer } from 'mobx-react-lite'; const Verify = observer(() => { @@ -9,8 +9,8 @@ const Verify = observer(() => { const [descriptionOpen, setDescriptionOpen] = useState(false); const openShareLink = (id) => { - window.open(`${window.location.origin}/#/shared-data/${id}`, '_blank') - } + window.open(`${window.location.origin}/#/shared-data/${id}`, '_blank'); + }; return (
    @@ -24,48 +24,62 @@ const Verify = observer(() => {
    {/* Page header */}
    -
    -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    -
    +
    +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
    {/* Block */}
    {store.sharedData.map((item, index) => ( -
    +
    {/* Header */}
    {/* Buttons */}
    -
    @@ -73,13 +87,17 @@ const Verify = observer(() => {
    {/* Content */} -
    +
    {item.data.map((elem, index) => ( -
    -
    -
    - {elem.label} - {elem.value} +
    +
    +
    + + {elem.label} + + + {elem.value} +
    @@ -92,7 +110,7 @@ const Verify = observer(() => {
    - ) -}) + ); +}); export default Verify; diff --git a/src/pages/services/Delegates.jsx b/src/pages/services/Delegates.jsx index 55eff72..1371751 100644 --- a/src/pages/services/Delegates.jsx +++ b/src/pages/services/Delegates.jsx @@ -1,29 +1,29 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState } from 'react'; -import Sidebar from "../../partials/Sidebar"; -import Header from "../../partials/Header"; -import DropdownTransaction from "../../components/DropdownTransaction"; -import TransactionsTable from "../../partials/finance/TransactionsTable"; -import PaginationClassic from "../../components/PaginationClassic"; -import { observer } from "mobx-react-lite"; -import TransactionPanel from "../../partials/finance/TransactionPanel"; -import { Filters } from "../../components/Filters"; +import Sidebar from '../../partials/Sidebar'; +import Header from '../../partials/Header'; +import DropdownTransaction from '../../components/DropdownTransaction'; +import TransactionsTable from '../../partials/finance/TransactionsTable'; +import PaginationClassic from '../../components/PaginationClassic'; +import { observer } from 'mobx-react-lite'; +import TransactionPanel from '../../partials/finance/TransactionPanel'; +import { Filters } from '../../components/Filters'; const filters = { - "View All": "", - Voted: "Unvote", - Pending: "Pending", + 'View All': '', + Voted: 'Unvote', + Pending: 'Pending', }; const Delegates = observer(() => { const [sidebarOpen, setSidebarOpen] = useState(false); const [currentDelegate, setCurrentDelegate] = useState(null); - const [currentFilter, setCurrentFilter] = useState("View All"); + const [currentFilter, setCurrentFilter] = useState('View All'); - const [lockedFor, setLockedFor] = useState("Voiting"); + const [lockedFor, setLockedFor] = useState('Voiting'); const lockedLabel = Object.values( - lockedFor === "Voiting" ? store.processedVotes : store.accountLockedVotes + lockedFor === 'Voiting' ? store.processedVotes : store.accountLockedVotes ) .reduce((sum, e) => sum + e, 0n) .toString(); diff --git a/src/pages/services/VPNPrepare.jsx b/src/pages/services/VPNPrepare.jsx index 3d015c4..2764915 100644 --- a/src/pages/services/VPNPrepare.jsx +++ b/src/pages/services/VPNPrepare.jsx @@ -1,10 +1,10 @@ -import React, { useEffect, useState } from "react"; -import Sidebar from "../../partials/Sidebar"; -import Header from "../../partials/Header"; -import VPNServiceImg from "../../images/vpn_service.png"; -import { observer } from "mobx-react-lite"; +import React, { useEffect, useState } from 'react'; +import Sidebar from '../../partials/Sidebar'; +import Header from '../../partials/Header'; +import VPNServiceImg from '../../images/vpn_service.png'; +import { observer } from 'mobx-react-lite'; -import { useNavigate } from "react-router-dom"; +import { useNavigate } from 'react-router-dom'; const VPNPrepare = observer(() => { const [sidebarOpen, setSidebarOpen] = useState(false); @@ -18,12 +18,12 @@ const VPNPrepare = observer(() => { const canVote = store.accountBalance > 20; const clickButton = () => { - if (canVote) navigate("/services/delegates"); - else window.open("https://testnet.idntty.org/faucet", "_blank"); + if (canVote) navigate('/services/delegates'); + else window.open('https://testnet.idntty.org/faucet', '_blank'); }; useEffect(() => { - if (store.canVPN) navigate("/services/vpn/servers"); + if (store.canVPN) navigate('/services/vpn/servers'); }, [store.canVPN]); return ( @@ -62,17 +62,17 @@ const VPNPrepare = observer(() => { />

    {canVote - ? "Vote for VPN delegate to get service" - : "You cannot get the VPN service, sorry 😢"} + ? 'Vote for VPN delegate to get service' + : 'You cannot get the VPN service, sorry 😢'}

    {canVote ? ( - "The tokens used for voting are locked, which means that they still belong to you but they cannot be used for transactions. The funds are locked for as long as you are voting using these tokens and you are able to unlock them any time you want, by removing them from the votes." + 'The tokens used for voting are locked, which means that they still belong to you but they cannot be used for transactions. The funds are locked for as long as you are voting using these tokens and you are able to unlock them any time you want, by removing them from the votes.' ) : ( <> - Only users who can vote for a VPN delegate using{" "} + Only users who can vote for a VPN delegate using{' '} at least 19.9 tokens can use this service. - Unfortunately, your account currently has{" "} + Unfortunately, your account currently has{' '} only {store.accountBalance} tokens, which is not enough to vote. @@ -89,7 +89,7 @@ const VPNPrepare = observer(() => { - {canVote ? "Vote" : "Get It"} + {canVote ? 'Vote' : 'Get It'}

    diff --git a/src/pages/services/VPNServers.jsx b/src/pages/services/VPNServers.jsx index 6f50eae..8a8a4d7 100644 --- a/src/pages/services/VPNServers.jsx +++ b/src/pages/services/VPNServers.jsx @@ -1,22 +1,22 @@ -import React, { useEffect, useMemo, useState } from "react"; +import React, { useEffect, useMemo, useState } from 'react'; -import Sidebar from "../../partials/Sidebar"; -import Header from "../../partials/Header"; -import { QRCodeSVG } from "qrcode.react"; +import Sidebar from '../../partials/Sidebar'; +import Header from '../../partials/Header'; +import { QRCodeSVG } from 'qrcode.react'; -import VPNServeIcon from "../../images/vpn_server_icon.png"; -import { Filters } from "../../components/Filters"; +import VPNServeIcon from '../../images/vpn_server_icon.png'; +import { Filters } from '../../components/Filters'; const filters = { - "View All": "", - Active: "Active", - Offline: "Offline", + 'View All': '', + Active: 'Active', + Offline: 'Offline', }; function VPNServers() { const [sidebarOpen, setSidebarOpen] = useState(false); const [selectedServer, setSelectedServer] = useState(0); - const [currentFilter, setCurrentFilter] = useState("View All"); + const [currentFilter, setCurrentFilter] = useState('View All'); const qrContent = useMemo( () => ` @@ -34,10 +34,10 @@ Endpoint = ${store.vpnServers?.[selectedServer]?.endpoint} ); const downloadTxtFile = () => { - const element = document.createElement("a"); - const file = new Blob([qrContent], { type: "text/plain" }); + const element = document.createElement('a'); + const file = new Blob([qrContent], { type: 'text/plain' }); element.href = URL.createObjectURL(file); - element.download = "vpnConfig.conf"; + element.download = 'vpnConfig.conf'; document.body.appendChild(element); // Required for this to work in FireFox element.click(); }; @@ -183,7 +183,7 @@ Endpoint = ${store.vpnServers?.[selectedServer]?.endpoint}
    Spent This Month
    - 4673,00 Mb{" "} + 4673,00 Mb{' '} / 46730,00 Mb
    @@ -192,7 +192,7 @@ Endpoint = ${store.vpnServers?.[selectedServer]?.endpoint}
    diff --git a/src/partials/Header.jsx b/src/partials/Header.jsx index a9ac698..048f9a3 100644 --- a/src/partials/Header.jsx +++ b/src/partials/Header.jsx @@ -2,21 +2,15 @@ import React, { useState } from 'react'; import UserMenu from '../components/DropdownProfile'; -function Header({ - sidebarOpen, - setSidebarOpen -}) { - - const [searchModalOpen, setSearchModalOpen] = useState(false) +function Header({ sidebarOpen, setSidebarOpen }) { + const [searchModalOpen, setSearchModalOpen] = useState(false); return (
    - {/* Header: Left side */}
    - {/* Hamburger button */} -
    {/* Header: Right side */}
    -
    -
    diff --git a/src/partials/Sidebar.jsx b/src/partials/Sidebar.jsx index ed03e0b..6e9c85d 100644 --- a/src/partials/Sidebar.jsx +++ b/src/partials/Sidebar.jsx @@ -1,8 +1,8 @@ -import React, { useState, useEffect, useRef } from "react"; -import { NavLink, useLocation } from "react-router-dom"; -import Logo from "../images/logo.png"; +import React, { useState, useEffect, useRef } from 'react'; +import { NavLink, useLocation } from 'react-router-dom'; +import Logo from '../images/logo.png'; -import SidebarLinkGroup from "./SidebarLinkGroup"; +import SidebarLinkGroup from './SidebarLinkGroup'; function Sidebar({ sidebarOpen, setSidebarOpen }) { const location = useLocation(); @@ -10,9 +10,9 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { const trigger = useRef(null); const sidebar = useRef(null); - const storedSidebarExpanded = localStorage.getItem("sidebar-expanded"); + const storedSidebarExpanded = localStorage.getItem('sidebar-expanded'); const [sidebarExpanded, setSidebarExpanded] = useState( - storedSidebarExpanded === null ? false : storedSidebarExpanded === "true" + storedSidebarExpanded === null ? false : storedSidebarExpanded === 'true' ); // close on click outside @@ -27,8 +27,8 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { return; setSidebarOpen(false); }; - document.addEventListener("click", clickHandler); - return () => document.removeEventListener("click", clickHandler); + document.addEventListener('click', clickHandler); + return () => document.removeEventListener('click', clickHandler); }); // close if the esc key is pressed @@ -37,16 +37,16 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { if (!sidebarOpen || keyCode !== 27) return; setSidebarOpen(false); }; - document.addEventListener("keydown", keyHandler); - return () => document.removeEventListener("keydown", keyHandler); + document.addEventListener('keydown', keyHandler); + return () => document.removeEventListener('keydown', keyHandler); }); useEffect(() => { - localStorage.setItem("sidebar-expanded", sidebarExpanded); + localStorage.setItem('sidebar-expanded', sidebarExpanded); if (sidebarExpanded) { - document.querySelector("body").classList.add("sidebar-expanded"); + document.querySelector('body').classList.add('sidebar-expanded'); } else { - document.querySelector("body").classList.remove("sidebar-expanded"); + document.querySelector('body').classList.remove('sidebar-expanded'); } }, [sidebarExpanded]); @@ -55,7 +55,7 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { {/* Sidebar backdrop (mobile only) */} @@ -65,7 +65,7 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { id="sidebar" ref={sidebar} className={`flex flex-col absolute z-40 left-0 top-0 lg:static lg:left-auto lg:top-auto lg:translate-x-0 transform h-screen overflow-y-scroll lg:overflow-y-auto no-scrollbar w-64 lg:w-20 lg:sidebar-expanded:!w-64 2xl:!w-64 shrink-0 bg-slate-800 p-4 transition-all duration-200 ease-in-out ${ - sidebarOpen ? "translate-x-0" : "-translate-x-64" + sidebarOpen ? 'translate-x-0' : '-translate-x-64' }`} > {/* Sidebar header */} @@ -111,15 +111,15 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) {
      {/* digitalId */} {(handleClick, open) => { return ( { e.preventDefault(); @@ -136,29 +136,29 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { > @@ -171,7 +171,7 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) {
      @@ -181,14 +181,14 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) {
      -
        +
        • - "block text-slate-400 hover:text-slate-200 transition duration-150 truncate " + - (isActive ? "!text-indigo-500" : "") + 'block text-slate-400 hover:text-slate-200 transition duration-150 truncate ' + + (isActive ? '!text-indigo-500' : '') } > @@ -214,8 +214,8 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { end to="/digitalId/validation-log" className={({ isActive }) => - "block text-slate-400 hover:text-slate-200 transition duration-150 truncate " + - (isActive ? "!text-indigo-500" : "") + 'block text-slate-400 hover:text-slate-200 transition duration-150 truncate ' + + (isActive ? '!text-indigo-500' : '') } > @@ -228,8 +228,8 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { end to="/digitalId/verify" className={({ isActive }) => - "block text-slate-400 hover:text-slate-200 transition duration-150 truncate " + - (isActive ? "!text-indigo-500" : "") + 'block text-slate-400 hover:text-slate-200 transition duration-150 truncate ' + + (isActive ? '!text-indigo-500' : '') } > @@ -243,14 +243,14 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { ); }} - + {(handleClick, open) => { return ( { e.preventDefault(); @@ -267,8 +267,8 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { > @@ -320,14 +320,14 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) {
      -
        +
        • - "block text-slate-400 hover:text-slate-200 transition duration-150 truncate " + - (isActive ? "!text-indigo-500" : "") + 'block text-slate-400 hover:text-slate-200 transition duration-150 truncate ' + + (isActive ? '!text-indigo-500' : '') } > @@ -340,8 +340,8 @@ function Sidebar({ sidebarOpen, setSidebarOpen }) { end to="/services/vpn" className={({ isActive }) => - "block text-slate-400 hover:text-slate-200 transition duration-150 truncate " + - (isActive ? "!text-indigo-500" : "") + 'block text-slate-400 hover:text-slate-200 transition duration-150 truncate ' + + (isActive ? '!text-indigo-500' : '') } > diff --git a/src/partials/SidebarLinkGroup.jsx b/src/partials/SidebarLinkGroup.jsx index 7738423..64dd6b4 100644 --- a/src/partials/SidebarLinkGroup.jsx +++ b/src/partials/SidebarLinkGroup.jsx @@ -1,21 +1,21 @@ import React, { useState } from 'react'; -function SidebarLinkGroup({ - children, - activecondition, -}) { - +function SidebarLinkGroup({ children, activecondition }) { const [open, setOpen] = useState(activecondition); const handleClick = () => { setOpen(!open); - } + }; return ( -
        • +
        • {children(handleClick, open)}
        • ); } -export default SidebarLinkGroup; \ No newline at end of file +export default SidebarLinkGroup; diff --git a/src/partials/finance/TransactionPanel.jsx b/src/partials/finance/TransactionPanel.jsx index e64e138..24e0b9d 100644 --- a/src/partials/finance/TransactionPanel.jsx +++ b/src/partials/finance/TransactionPanel.jsx @@ -1,12 +1,12 @@ -import React, { useEffect, useRef, useState } from "react"; +import React, { useEffect, useRef, useState } from 'react'; -import Image from "../../images/transactions-image-04.svg"; -import moment from "moment"; -import { formatAddressBig } from "../../utils/Utils"; -import { generateSvgAvatar } from "../../images/GenerateOnboardingSvg/GenerateSvg"; -import { store } from "../../store/store"; -import UserAvatar from "../../images/user-avatar-32.png"; -import { observer } from "mobx-react-lite"; +import Image from '../../images/transactions-image-04.svg'; +import moment from 'moment'; +import { formatAddressBig } from '../../utils/Utils'; +import { generateSvgAvatar } from '../../images/GenerateOnboardingSvg/GenerateSvg'; +import { store } from '../../store/store'; +import UserAvatar from '../../images/user-avatar-32.png'; +import { observer } from 'mobx-react-lite'; const TransactionPanel = observer( ({ transactionPanelOpen, onClose, delegate, postTransaction }) => { @@ -17,17 +17,17 @@ const TransactionPanel = observer( const statusColor = () => { switch (delegate.status) { - case "Vote": - return "bg-emerald-100 text-emerald-600"; - case "Unvote": - return "bg-rose-100 text-rose-500"; + case 'Vote': + return 'bg-emerald-100 text-emerald-600'; + case 'Unvote': + return 'bg-rose-100 text-rose-500'; default: - return "bg-slate-100 text-slate-500"; + return 'bg-slate-100 text-slate-500'; } }; const amountLabel = - delegate.status === "Vote" ? "Voiting amount" : "Unvoiting amount"; + delegate.status === 'Vote' ? 'Voiting amount' : 'Unvoiting amount'; // close if the esc key is pressed useEffect(() => { @@ -35,14 +35,14 @@ const TransactionPanel = observer( if (!transactionPanelOpen || keyCode !== 27) return; onClose(); }; - document.addEventListener("keydown", keyHandler); - return () => document.removeEventListener("keydown", keyHandler); + document.addEventListener('keydown', keyHandler); + return () => document.removeEventListener('keydown', keyHandler); }); useEffect(() => { const status = delegate.status; - if (status === "Unvote") { + if (status === 'Unvote') { setAmount(store.accountSentVotes[delegate.address].toString()); } }, [delegate]); @@ -51,7 +51,7 @@ const TransactionPanel = observer(
          @@ -74,7 +74,7 @@ const TransactionPanel = observer( Vote Transaction
          - {moment().format("DD/MM/YYYY hh:mm A")} + {moment().format('DD/MM/YYYY hh:mm A')}
          {/* Details */}
          @@ -96,11 +96,11 @@ const TransactionPanel = observer(
          {delegate?.dpos?.delegate?.username || - formatAddressBig(delegate.address || "")} + formatAddressBig(delegate.address || '')}
          {delegate.status}
          @@ -131,7 +131,7 @@ const TransactionPanel = observer(
          ADDRESS: - {formatAddressBig(delegate.address || "")} + {formatAddressBig(delegate.address || '')}
          diff --git a/src/partials/finance/TransactionsTable.jsx b/src/partials/finance/TransactionsTable.jsx index cc51a37..a77528d 100644 --- a/src/partials/finance/TransactionsTable.jsx +++ b/src/partials/finance/TransactionsTable.jsx @@ -1,8 +1,8 @@ -import React from "react"; -import TransactionItem from "./TransactionsTableItem"; +import React from 'react'; +import TransactionItem from './TransactionsTableItem'; -import Image01 from "../../images/transactions-image-01.svg"; -import { observer } from "mobx-react-lite"; +import Image01 from '../../images/transactions-image-01.svg'; +import { observer } from 'mobx-react-lite'; const TransactionsTable = observer(({ data, rowClick }) => { return ( diff --git a/src/partials/finance/TransactionsTableItem.jsx b/src/partials/finance/TransactionsTableItem.jsx index 60a6530..50f0f15 100644 --- a/src/partials/finance/TransactionsTableItem.jsx +++ b/src/partials/finance/TransactionsTableItem.jsx @@ -1,26 +1,26 @@ -import React from "react"; +import React from 'react'; -import ServiceImage from "../../images/service_icon.png"; -import { observer } from "mobx-react-lite"; +import ServiceImage from '../../images/service_icon.png'; +import { observer } from 'mobx-react-lite'; const TransactionsTableItem = observer((props) => { const statusColor = () => { switch (props.status) { - case "Vote": - return "bg-emerald-100 text-emerald-600"; - case "Unvote": - return "bg-rose-100 text-rose-500"; + case 'Vote': + return 'bg-emerald-100 text-emerald-600'; + case 'Unvote': + return 'bg-rose-100 text-rose-500'; default: - return "bg-slate-100 text-slate-500"; + return 'bg-slate-100 text-slate-500'; } }; const amountColor = () => { - switch (props.status === "Unvote") { - case "+": - return "text-emerald-500"; + switch (props.status === 'Unvote') { + case '+': + return 'text-emerald-500'; default: - return "text-slate-700"; + return 'text-slate-700'; } }; @@ -78,7 +78,7 @@ const TransactionsTableItem = observer((props) => {
          {props.status}
          diff --git a/src/partials/profile/ProfileTable.jsx b/src/partials/profile/ProfileTable.jsx index 9995b53..278c9a8 100644 --- a/src/partials/profile/ProfileTable.jsx +++ b/src/partials/profile/ProfileTable.jsx @@ -1,37 +1,72 @@ -import React, {useState, useEffect} from 'react'; +import React, { useState, useEffect } from 'react'; import ProfileTableItem from './ProfileTableItem'; import ProfileIcon from '../../images/profile-icon.svg'; -function ProfileTable({ - userData, - handleClick, - isCheck, -}) { - +function ProfileTable({ userData, handleClick, isCheck }) { const defaultData = { image: ProfileIcon, status: 'Stored', transactions: ['0x7234ABC342342352345', '0x5745DEF342342352345'], - avatars: null + avatars: null, }; const data = { - 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"], - social:["Telephone", "Twitter", "Facebook", "Instagram", "Youtube", "Wechat", "Tiktok", "Linkedin", "Vk", "Github", "Telegram", "Qq", "Snapchat", "Reddit"] - } + 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', + ], + 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 nationalityData = userData.filter(elem => data.nationality.includes(elem.label)); - const socialData = userData.filter(elem => data.social.includes(elem.label)); - const otherData = userData.filter((elem) => - !data.general.includes(elem.label) && !data.nationality.includes(elem.label) && !data.social.includes(elem.label)); + const generalData = userData.filter((elem) => + data.general.includes(elem.label) + ); + const nationalityData = userData.filter((elem) => + data.nationality.includes(elem.label) + ); + const socialData = userData.filter((elem) => + data.social.includes(elem.label) + ); + const otherData = userData.filter( + (elem) => + !data.general.includes(elem.label) && + !data.nationality.includes(elem.label) && + !data.social.includes(elem.label) + ); return ( <> - {/* General */} + {/* General */}
          0 || 'hidden'}`}> -

          General 🖋️

          +

          + General 🖋️ +

          @@ -41,7 +76,9 @@ function ProfileTable({ key={data.label} id={data.key} 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} status={data.status} transactions={defaultData.transactions} @@ -49,7 +86,7 @@ function ProfileTable({ handleClick={handleClick} isChecked={isCheck.includes(data.key)} /> - ) + ); })}
          @@ -57,17 +94,21 @@ function ProfileTable({
          {/* Nationality */}
          0 || 'hidden'}`}> -

          Nationality 🖋️

          +

          + Nationality 🖋️ +

          - {nationalityData.map(data => { + {nationalityData.map((data) => { return ( - ) + ); })}
          @@ -83,58 +124,64 @@ function ProfileTable({
          {/* Social */}
          0 || 'hidden'}`}> -

          Social 🖋️

          +

          + Social 🖋️ +

          - {socialData.map(data => { - return ( - - ) - })} + {socialData.map((data) => { + return ( + + ); + })}
          {/* Other */}
          0 || 'hidden'}`}> -

          Other 🖋️

          +

          + Other 🖋️ +

          - {otherData.map(data => { - return ( - - ) - })} + {otherData.map((data) => { + return ( + + ); + })}
          - ) + ); } export default ProfileTable; diff --git a/src/partials/profile/ProfileTableItem.jsx b/src/partials/profile/ProfileTableItem.jsx index 371bc66..63f32a0 100644 --- a/src/partials/profile/ProfileTableItem.jsx +++ b/src/partials/profile/ProfileTableItem.jsx @@ -24,12 +24,21 @@ function ProfileTableItem(props) {
          - {props.property} + {props.property}
          - {props.status === statusMap.blockchained || props.status === statusMap.processed - ? `${props.value.slice(0, 4)}****${props.value.slice(props.value.length - 4)}` + {props.status === statusMap.blockchained || + props.status === statusMap.processed + ? `${props.value.slice(0, 4)}****${props.value.slice( + props.value.length - 4 + )}` : props.value}
          {props.property}
          @@ -39,15 +48,25 @@ function ProfileTableItem(props) {
          {props.status === statusMap.blockchained ? ( -
          {props.status}
          +
          + {props.status} +
          ) : props.status === statusMap.processed ? ( -
          {props.status}
          +
          + {props.status} +
          ) : props.status === statusMap.stored ? ( -
          {props.status}
          +
          + {props.status} +
          ) : props.status === statusMap.completed ? ( -
          {props.status}
          +
          + {props.status} +
          ) : ( -
          {props.status}
          +
          + {props.status} +
          )}
          @@ -56,15 +75,15 @@ function ProfileTableItem(props) {
          {props.avatars ? props.avatars.map((avatar, index) => ( - Avatar - )) + Avatar + )) : null} @@ -89,7 +111,9 @@ function ProfileTableItem(props) {
          - - +
          + + + {/* Menu button */} + + + ); } diff --git a/src/partials/validate/ValidatePanel.jsx b/src/partials/validate/ValidatePanel.jsx index 226465f..3439df4 100644 --- a/src/partials/validate/ValidatePanel.jsx +++ b/src/partials/validate/ValidatePanel.jsx @@ -2,109 +2,167 @@ import React from 'react'; import Image from '../../images/transactions-image-04.svg'; -function TransactionPanel({ - validatePanelOpen, - setValidatePanelOpen -}) { - +function TransactionPanel({ validatePanelOpen, setValidatePanelOpen }) { return ( -
          -
          - -
          -
          -
          Bank Transfer
          -
          22/01/2022, 8:56 PM
          - {/* Details */} -
          - {/* Top */} -
          -
          - Transaction 04 -
          -
          0.012 IDN
          -
          Total amount fee
          + + + +
          +
          +
          + Bank Transfer +
          +
          + 22/01/2022, 8:56 PM +
          + {/* Details */} +
          + {/* Top */} +
          +
          + Transaction 04
          - {/* Divider */} -