Skip to content

Commit

Permalink
update panel
Browse files Browse the repository at this point in the history
  • Loading branch information
deadit committed Mar 18, 2021
1 parent 78bfc01 commit cdf36a9
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 36 deletions.
14 changes: 7 additions & 7 deletions build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"files": {
"main.css": "/static/css/main.0e9161bb.chunk.css",
"main.js": "/static/js/main.f279ca07.chunk.js",
"main.js.map": "/static/js/main.f279ca07.chunk.js.map",
"main.js": "/static/js/main.3c3e7be0.chunk.js",
"main.js.map": "/static/js/main.3c3e7be0.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.219240e0.js",
"runtime-main.js.map": "/static/js/runtime-main.219240e0.js.map",
"static/css/2.9338f6a1.chunk.css": "/static/css/2.9338f6a1.chunk.css",
"static/js/2.403e76f2.chunk.js": "/static/js/2.403e76f2.chunk.js",
"static/js/2.403e76f2.chunk.js.map": "/static/js/2.403e76f2.chunk.js.map",
"static/js/2.7f3897d7.chunk.js": "/static/js/2.7f3897d7.chunk.js",
"static/js/2.7f3897d7.chunk.js.map": "/static/js/2.7f3897d7.chunk.js.map",
"index.html": "/index.html",
"precache-manifest.f040045e0deb84c673ab57e20ec4cf2d.js": "/precache-manifest.f040045e0deb84c673ab57e20ec4cf2d.js",
"precache-manifest.afcf3f0cc9867c165cadb68757203faa.js": "/precache-manifest.afcf3f0cc9867c165cadb68757203faa.js",
"service-worker.js": "/service-worker.js",
"static/css/2.9338f6a1.chunk.css.map": "/static/css/2.9338f6a1.chunk.css.map",
"static/css/main.0e9161bb.chunk.css.map": "/static/css/main.0e9161bb.chunk.css.map",
Expand All @@ -23,8 +23,8 @@
"entrypoints": [
"static/js/runtime-main.219240e0.js",
"static/css/2.9338f6a1.chunk.css",
"static/js/2.403e76f2.chunk.js",
"static/js/2.7f3897d7.chunk.js",
"static/css/main.0e9161bb.chunk.css",
"static/js/main.f279ca07.chunk.js"
"static/js/main.3c3e7be0.chunk.js"
]
}
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.svg"/><meta name="viewport" content="minimum-scale=1,initial-scale=1,width=device-width,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Ergo node interface</title><link href="/static/css/2.9338f6a1.chunk.css" rel="stylesheet"><link href="/static/css/main.0e9161bb.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><div id="modal-root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],Object.prototype.hasOwnProperty.call(c,t)&&c[t]&&i.push(c[t][0]),c[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return p.push.apply(p,u||[]),a()}function a(){for(var e,r=0;r<p.length;r++){for(var t=p[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==c[u]&&(n=!1)}n&&(p.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},c={1:0},p=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var r=this["webpackJsonpergo-node-interface"]=this["webpackJsonpergo-node-interface"]||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="/static/js/2.403e76f2.chunk.js"></script><script src="/static/js/main.f279ca07.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.svg"/><meta name="viewport" content="minimum-scale=1,initial-scale=1,width=device-width,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Ergo node interface</title><link href="/static/css/2.9338f6a1.chunk.css" rel="stylesheet"><link href="/static/css/main.0e9161bb.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><div id="modal-root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],Object.prototype.hasOwnProperty.call(c,t)&&c[t]&&i.push(c[t][0]),c[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return p.push.apply(p,u||[]),a()}function a(){for(var e,r=0;r<p.length;r++){for(var t=p[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==c[u]&&(n=!1)}n&&(p.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},c={1:0},p=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var r=this["webpackJsonpergo-node-interface"]=this["webpackJsonpergo-node-interface"]||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="/static/js/2.7f3897d7.chunk.js"></script><script src="/static/js/main.3c3e7be0.chunk.js"></script></body></html>
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "513527f08eaf9fb338c88976990ef55f",
"revision": "8f5fb4d37df89e4a0a1af53859964bb0",
"url": "/index.html"
},
{
"revision": "8cf7d410052d09d9962c",
"revision": "592106c793990df954cb",
"url": "/static/css/2.9338f6a1.chunk.css"
},
{
"revision": "dfb1c0beb16de7b5a66a",
"revision": "406b71fe775e045f1908",
"url": "/static/css/main.0e9161bb.chunk.css"
},
{
"revision": "8cf7d410052d09d9962c",
"url": "/static/js/2.403e76f2.chunk.js"
"revision": "592106c793990df954cb",
"url": "/static/js/2.7f3897d7.chunk.js"
},
{
"revision": "dfb1c0beb16de7b5a66a",
"url": "/static/js/main.f279ca07.chunk.js"
"revision": "406b71fe775e045f1908",
"url": "/static/js/main.3c3e7be0.chunk.js"
},
{
"revision": "ce813ebd69754efed759",
Expand Down
2 changes: 1 addition & 1 deletion build/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
"/precache-manifest.f040045e0deb84c673ab57e20ec4cf2d.js"
"/precache-manifest.afcf3f0cc9867c165cadb68757203faa.js"
);

self.addEventListener('message', (event) => {
Expand Down
2 changes: 0 additions & 2 deletions build/static/js/2.403e76f2.chunk.js

This file was deleted.

1 change: 0 additions & 1 deletion build/static/js/2.403e76f2.chunk.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions build/static/js/2.7f3897d7.chunk.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/static/js/2.7f3897d7.chunk.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions build/static/js/main.3c3e7be0.chunk.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/static/js/main.3c3e7be0.chunk.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions build/static/js/main.f279ca07.chunk.js

This file was deleted.

1 change: 0 additions & 1 deletion build/static/js/main.f279ca07.chunk.js.map

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"react-transition-group": "^4.3.0",
"redux": "^4.0.4",
"redux-starter-kit": "^1.0.1",
"typescript": "^3.8.3"
"typescript": "^3.8.3",
"uuid": "^8.3.2"
},
"scripts": {
"start": "HOST='0.0.0.0' react-app-rewired start",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Header/ApiKeyModal/ApiKeyModalContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ const ApiKeyModalContainer = (props) => {
setShowModal(false);
};

const submitForm = (values) => {
const submitForm = (values, uuid) => {
// Check API key for random get method
nodeApi
.get('/wallet/status', {
headers: {
api_key: values.apiKey,
api_key: values[`apiKey${uuid}`],
},
})
.then(() => {
dispatchSetApiKey(values.apiKey.trim());
dispatchSetApiKey(values[`apiKey${uuid}`].trim());
customToast('success', 'API key is set successfully');
handleHide();
})
Expand Down
9 changes: 7 additions & 2 deletions src/components/Header/ApiKeyModal/ApiKeyModalView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Modal } from 'react-bootstrap';
import { Formik, Form, Field } from 'formik';
import { v4 as uuidv4 } from 'uuid';

const renderButton = (apiKey, handleShow) => {
if (apiKey === '') {
Expand All @@ -19,11 +20,15 @@ const renderButton = (apiKey, handleShow) => {
};

const ApiKeyModalView = ({ showModal, handleHide, submitForm, apiKey, handleShow }) => {
const uuid = uuidv4();
return (
<div>
{renderButton(apiKey, handleShow)}
<Modal show={showModal} onHide={() => handleHide()} centered>
<Formik initialValues={{ apiKey }} onSubmit={submitForm}>
<Formik
initialValues={{ [`apiKey${uuid}`]: apiKey }}
onSubmit={(values) => submitForm(values, uuid)}
>
{() => (
<Form>
<Modal.Header closeButton>
Expand All @@ -34,7 +39,7 @@ const ApiKeyModalView = ({ showModal, handleHide, submitForm, apiKey, handleShow
<div className="input-group">
<Field
type="text"
name="apiKey"
name={`apiKey${uuid}`}
className="form-control"
placeholder="Enter API key"
/>
Expand Down
25 changes: 18 additions & 7 deletions src/components/elements/RestoreWalletForm/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component, memo } from 'react';
import { Formik, Field, Form } from 'formik';
import { v4 as uuidv4 } from 'uuid';
import nodeApi from '../../../api/api';
import customToast from '../../../utils/toast';

Expand All @@ -10,14 +11,19 @@ const initialFormValues = {
};

class RestoreWalletForm extends Component {
walletRestore = async ({ walletPassword, mnemonicPass = '', mnemonic = '' }) => {
if (!mnemonic || !String(mnemonic).trim()) {
walletRestore = async (values, uuid) => {
const { walletPassword, mnemonicPass = '' } = values;
if (!values[`mnemonic${uuid}`] || !String(values[`mnemonic${uuid}`]).trim()) {
throw Error('Need to set mnemonic');
}

return nodeApi.post(
'/wallet/restore',
{ pass: walletPassword, mnemonicPass, mnemonic },
{
pass: walletPassword || '',
mnemonicPass: mnemonicPass || '',
mnemonic: values[`mnemonic${uuid}`],
},
{
headers: {
api_key: this.props.apiKey,
Expand All @@ -26,9 +32,9 @@ class RestoreWalletForm extends Component {
);
};

handleSubmit = (values, { setSubmitting, resetForm, setStatus }) => {
handleSubmit = (values, { setSubmitting, resetForm, setStatus }, uuid) => {
setStatus({ status: 'submitting' });
this.walletRestore(values)
this.walletRestore(values, uuid)
.then(() => {
resetForm(initialFormValues);
customToast('success', 'Your wallet successfully re-stored');
Expand All @@ -41,10 +47,15 @@ class RestoreWalletForm extends Component {
};

render() {
const uuid = uuidv4();

return (
<div className="card bg-white p-4 mb-4">
<h2 className="h5 mb-3">Re-store wallet</h2>
<Formik initialValues={initialFormValues} onSubmit={this.handleSubmit}>
<Formik
initialValues={{ walletPassword: '', mnemonicPass: '', [`mnemonic${uuid}`]: '' }}
onSubmit={(values, props) => this.handleSubmit(values, props, uuid)}
>
{({ status, isSubmitting }) => (
<Form>
{status && status.state === 'error' && (
Expand All @@ -58,7 +69,7 @@ class RestoreWalletForm extends Component {
<div className="form-group">
<label htmlFor="restore-mnemonic-input">Mnemonic</label>
<Field
name="mnemonic"
name={`mnemonic${uuid}`}
type="text"
id="restore-mnemonic-input"
className="form-control"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const PaymentSendForm = ({
<Form
onSubmit={sendForm}
validate={validateForm}
initialValues={{ fee: 0.001, amount: 0.001 }}
initialValues={{ fee: 0.001, amount: 0.01 }}
render={({ handleSubmit, submitting, pristine, form, values, errors }) => {
return (
<>
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11688,6 +11688,11 @@ uuid@^3.0.1, uuid@^3.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==

uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

v8-compile-cache@^2.0.3:
version "2.1.1"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745"
Expand Down

0 comments on commit cdf36a9

Please sign in to comment.