Zingo PC
+
diff --git a/src/components/loadingscreen/LoadingScreen.tsx b/src/components/loadingscreen/LoadingScreen.tsx
index d4f267d4..044b1826 100644
--- a/src/components/loadingscreen/LoadingScreen.tsx
+++ b/src/components/loadingscreen/LoadingScreen.tsx
@@ -1,16 +1,16 @@
import React, { Component } from "react";
-import { Redirect, RouteComponentProps, withRouter } from "react-router";
+import { RouteComponentProps, withRouter } from "react-router";
import TextareaAutosize from "react-textarea-autosize";
import request from "request";
import progress from "progress-stream";
import native from "../../native.node";
-import routes from "../../constants/routes.json";
import { RPCConfig, Info, Server } from "../appstate";
import RPC from "../../rpc/rpc";
import cstyles from "../common/Common.module.css";
import styles from "./LoadingScreen.module.css";
import { ContextApp } from "../../context/ContextAppState";
-import serverUris from "../../utils/serverUris";
+import serverUrisList from "../../utils/serverUrisList";
+import { Logo } from "../logo";
const { ipcRenderer } = window.require("electron");
const fs = window.require("fs");
@@ -81,9 +81,9 @@ type LoadingScreenProps = {
setRescanning: (rescan: boolean, prevSyncId: number) => void;
setInfo: (info: Info) => void;
openServerSelectModal: () => void;
- logo: string;
setReadOnly: (readOnly: boolean) => void;
setServerUris: (serverUris: Server[]) => void;
+ navigateToDashboard: () => void;
};
class LoadingScreen extends Component {
@@ -103,7 +103,9 @@ class LoadingScreen extends Component s.uri === server)
+ const serverInList = serverUrisList().filter((s: Server) => s.uri === server)
if (!settings.serverchain_name) {
chain_name = 'main';
if (serverInList && serverInList.length === 1) {
@@ -229,8 +231,8 @@ class LoadingScreen extends Component s.latency !== null).sort((a, b) => (a.latency ? a.latency : Infinity) - (b.latency ? b.latency : Infinity));
+ this.setState({ currentStatus: "Checking " + serverUrisList().length + " servers to connect..." });
+ servers = this.calculateServerLatency(serverUrisList()).filter(s => s.latency !== null).sort((a, b) => (a.latency ? a.latency : Infinity) - (b.latency ? b.latency : Infinity));
server = servers[0].uri;
chain_name = servers[0].chain_name;
await ipcRenderer.invoke("saveSettings", { key: "serveruri", value: server });
@@ -418,9 +420,9 @@ class LoadingScreen extends Component let's go to dashboard
if (ss.sync_id > prevSyncId || !ss.in_progress || ss.batch_num >= 25) {
// First, save the wallet so we don't lose the just-synced data
- if (!ss.last_error) {
- RPC.doSave();
- }
+ //if (!ss.last_error) {
+ // RPC.doSave();
+ //}
// Set the info object, so the sidebar will show
//console.log("Object info\n");
@@ -450,11 +452,11 @@ class LoadingScreen extends Component= myThis.state.nextSaveBatch) {
- console.log('&&&&&&&&&&&&&&&&&&&&&&&&&&& save wallet', ss.batch_num, myThis.state.nextSaveBatch);
- RPC.doSave();
- myThis.setState({ nextSaveBatch: ss.batch_num + 2});
- }
+ //if (ss.batch_num >= myThis.state.nextSaveBatch) {
+ // console.log('&&&&&&&&&&&&&&&&&&&&&&&&&&& save wallet', ss.batch_num, myThis.state.nextSaveBatch);
+ // RPC.doSave();
+ // myThis.setState({ nextSaveBatch: ss.batch_num + 2});
+ //}
let base = 0;
if (ss.batch_total) {
@@ -600,37 +602,97 @@ class LoadingScreen extends Component this.props.navigateToDashboard(), 500);
+ }
+
// If still loading, show the status
- if (!loadingDone) {
- return (
-
- {walletScreen === 0 && (
-
-
-
Zingo PC v1.0.4
-
+ return (
+
+
+
+
+ {walletScreen === 0 && (
+
+
{currentStatus}
+ {currentStatusIsError && (
+
+
+
+
-
{currentStatus}
- {currentStatusIsError && (
-
-
+ )}
+
+ )}
+
+ {walletScreen === 1 && (
+
+
+
+
Create A New Wallet
+
+ Creates a new wallet with a new randomly generated seed phrase. Please save the seed phrase
+ carefully, it’s the only way to restore your wallet.
+
+
+
+
+
+
+
Restore Wallet From Seed
+
+ If you already have a seed phrase, you can restore it to this wallet. This will rescan the
+ blockchain for all transactions from the seed phrase.
+
+
- )}
-
- )}
-
- {walletScreen === 1 && (
-
-
-
Zingo PC v1.0.4
-
-
-
-
Create A New Wallet
-
- Creates a new wallet with a new randomly generated seed phrase. Please save the seed phrase
- carefully, it’s the only way to restore your wallet.
-
-
-
-
-
-
-
-
Restore Wallet From Seed
-
- If you already have a seed phrase, you can restore it to this wallet. This will rescan the
- blockchain for all transactions from the seed phrase.
-
-
-
-
+
+
Restore Wallet From Viewing Key
+
+ If you already have a Unified Full Viewing Key, you can restore it to this wallet. This will rescan the
+ blockchain for all transactions from the UFVK.
-
-
Restore Wallet From Viewing Key
-
- If you already have a Unified Full Viewing Key, you can restore it to this wallet. This will rescan the
- blockchain for all transactions from the UFVK.
-
-
-
-
+
+
- )}
-
- {walletScreen === 2 && (
-
-
-
Zingo PC v1.0.4
-
-
-
-
- {newWalletError && (
-
-
Error Creating New Wallet
-
There was an error creating a new wallet
-
-
{newWalletError}
-
-
-
-
+
+ )}
+
+ {walletScreen === 2 && (
+
+
+
+ {newWalletError && (
+
+
Error Creating New Wallet
+
There was an error creating a new wallet
+
+
{newWalletError}
+
+
+
- )}
-
- {!newWalletError && (
-
-
Your New Wallet
-
- This is your new wallet. Below is your seed phrase. PLEASE STORE IT CAREFULLY! The seed phrase
- is the only way to recover your funds and transactions.
-
-
-
{seed}
-
-
-
-
+
+ )}
+
+ {!newWalletError && (
+
+
Your New Wallet
+
+ This is your new wallet. Below is your seed phrase. PLEASE STORE IT CAREFULLY! The seed phrase
+ is the only way to recover your funds and transactions.
- )}
-
+
+
{seed}
+
+
+
+
+
+ )}
- )}
-
- {walletScreen === 3 && (
-
-
-
Zingo PC v1.0.4
-
-
-
-
- {newWalletError && (
-
-
Error Restoring Wallet
-
There was an error restoring your seed phrase
-
-
{newWalletError}
-
-
-
-
+
+ )}
+
+ {walletScreen === 3 && (
+
+
+
+ {newWalletError && (
+
+
Error Restoring Wallet
+
There was an error restoring your seed phrase
+
+
{newWalletError}
+
+
+
+
+
+ )}
+
+ {!newWalletError && (
+
+
Please enter your seed phrase
+ this.updateSeed(e)}
+ />
+
+
+ Wallet Birthday. If you don’t know this, it is OK to enter ‘0’
- )}
-
- {!newWalletError && (
-
-
Please enter your seed phrase
- this.updateSeed(e)}
- />
-
-
- Wallet Birthday. If you don’t know this, it is OK to enter ‘0’
-
- this.updateBirthday(e)}
- />
-
-
-
-
-
+ this.updateBirthday(e)}
+ />
+
+
+
+
- )}
-
+
+ )}
- )}
-
- {walletScreen === 4 && (
-
-
-
Zingo PC v4
-
-
-
-
- {newWalletError && (
-
-
Error Restoring Wallet
-
There was an error restoring your Viewing Key
-
-
{newWalletError}
-
-
-
-
+
+ )}
+
+ {walletScreen === 4 && (
+
+
+
+ {newWalletError && (
+
+
Error Restoring Wallet
+
There was an error restoring your Viewing Key
+
+
{newWalletError}
+
+
+
+
+
+ )}
+
+ {!newWalletError && (
+
+
Please enter your Unified Full Viewing Key
+ this.updateUfvk(e)}
+ />
+
+
+ Wallet Birthday. If you don’t know this, it is OK to enter ‘0’
- )}
-
- {!newWalletError && (
-
-
Please enter your Unified Full Viewing Key
- this.updateUfvk(e)}
- />
-
-
- Wallet Birthday. If you don’t know this, it is OK to enter ‘0’
-
- this.updateBirthday(e)}
- />
-
-
-
-
-
+ this.updateBirthday(e)}
+ />
+
+
+
+
- )}
-
+
+ )}
- )}
-
- );
- }
+
+ )}
+
+ );
- return ;
}
}
diff --git a/src/components/logo/Logo.tsx b/src/components/logo/Logo.tsx
new file mode 100644
index 00000000..40fde841
--- /dev/null
+++ b/src/components/logo/Logo.tsx
@@ -0,0 +1,24 @@
+import logo from "../../assets/img/logobig.png";
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { faSnowflake } from '@fortawesome/free-solid-svg-icons';
+
+type LogoProps = {
+ readOnly: boolean;
+}
+
+const Logo = ({ readOnly }: LogoProps) => {
+
+ return (
+ <>
+
Zingo PC v1.0.4
+
+
+ {readOnly && (
+
+ )}
+
+ >
+ );
+}
+
+export default Logo;
\ No newline at end of file
diff --git a/src/components/logo/index.ts b/src/components/logo/index.ts
new file mode 100644
index 00000000..586b1e73
--- /dev/null
+++ b/src/components/logo/index.ts
@@ -0,0 +1,3 @@
+import Logo from "./Logo";
+
+export { Logo };
\ No newline at end of file
diff --git a/src/components/serverselectmodal/ServerSelectModal.tsx b/src/components/serverselectmodal/ServerSelectModal.tsx
index 998f0110..6d895255 100644
--- a/src/components/serverselectmodal/ServerSelectModal.tsx
+++ b/src/components/serverselectmodal/ServerSelectModal.tsx
@@ -3,7 +3,7 @@ import React, { useCallback, useContext, useEffect, useState } from "react";
import cstyles from "../common/Common.module.css";
import { ContextApp } from "../../context/ContextAppState";
import { Server } from "../appstate";
-import serverUris from "../../utils/serverUris";
+import serverUrisList from "../../utils/serverUrisList";
const { ipcRenderer } = window.require("electron");
type ModalProps = {
@@ -13,7 +13,7 @@ type ModalProps = {
export default function ServerSelectModal({ closeModal, openErrorModal }: ModalProps) {
const context = useContext(ContextApp);
- const { serverSelectState, serverUris: serverUrisContext } = context;
+ const { serverSelectState, serverUris } = context;
const { modalIsOpen } = serverSelectState;
const [selectedServer, setSelectedServer] = useState("");
@@ -28,7 +28,7 @@ export default function ServerSelectModal({ closeModal, openErrorModal }: ModalP
const [customChain, setCustomChain] = useState<'main' | 'test' | 'regtest' | ''>("");
//const [listChain, setListChain] = useState<'main' | 'test' | 'regtest' | ''>("");
- const [servers, setServers] = useState(serverUrisContext.length > 0 ? serverUrisContext : serverUris());
+ const [servers, setServers] = useState(serverUris.length > 0 ? serverUris : serverUrisList());
const chains = {
"main": "Mainnet",
@@ -70,7 +70,7 @@ export default function ServerSelectModal({ closeModal, openErrorModal }: ModalP
useEffect(() => {
(async () => {
- const servers: Server[] = serverUrisContext.length > 0 ? serverUrisContext : serverUris();
+ const servers: Server[] = serverUris.length > 0 ? serverUris : serverUrisList();
const settings = await ipcRenderer.invoke("loadSettings");
//console.log('modal server settings', settings);
@@ -83,7 +83,7 @@ export default function ServerSelectModal({ closeModal, openErrorModal }: ModalP
setSelectedSelection(currSelection);
setServers(servers);
})();
- }, [initialServerValue, serverUrisContext]);
+ }, [initialServerValue, serverUris]);
const switchServer = async () => {
const serveruri: string = selectedServer;
diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx
index bb4abeda..8b0e881e 100644
--- a/src/components/sidebar/Sidebar.tsx
+++ b/src/components/sidebar/Sidebar.tsx
@@ -4,7 +4,7 @@ import { RouteComponentProps, withRouter } from "react-router";
import styles from "./Sidebar.module.css";
import cstyles from "../common/Common.module.css";
import routes from "../../constants/routes.json";
-import { Address, Info, Transaction, TxDetail } from "../appstate";
+import { Address, Info, Server, Transaction, TxDetail } from "../appstate";
import Utils from "../../utils/utils";
import RPC from "../../rpc/rpc";
import { parseZcashURI, ZcashURITarget } from "../../utils/uris";
@@ -14,9 +14,7 @@ import ImportPrivKeyModal from "./components/ImportPrivKeyModal";
import ExportPrivKeyModal from "./components/ExportPrivKeyModal";
import SidebarMenuItem from "./components/SidebarMenuItem";
import { ContextApp } from "../../context/ContextAppState";
-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { faSnowflake } from '@fortawesome/free-solid-svg-icons';
-import serverUris from "../../utils/serverUris";
+import { Logo } from "../logo";
const { ipcRenderer, remote } = window.require("electron");
const fs = window.require("fs");
@@ -40,7 +38,7 @@ type SidebarProps = {
encryptWallet: (p: string) => Promise;
decryptWallet: (p: string) => Promise;
updateWalletSettings: () => Promise;
- logo: string;
+ navigateToLoadingScreen: (b: boolean, c: string, s: Server[]) => void;
};
type SidebarState = {
@@ -199,7 +197,6 @@ class Sidebar extends PureComponent {
- const s = serverUris;
// To change to another wallet, we reset the wallet loading
// and redirect to the loading screen
clearTimers();
@@ -207,14 +204,7 @@ class Sidebar extends PureComponent {
- const s = serverUris;
// To rescan, we reset the wallet loading
// So set info the default, and redirect to the loading screen
clearTimers();
@@ -344,12 +333,7 @@ class Sidebar extends PureComponent {
- const { importPrivKeys, openErrorModal, setInfo, clearTimers, setRescanning, history } = this.props;
- const { info } = this.context;
+ const { importPrivKeys, openErrorModal, setInfo, clearTimers, setRescanning } = this.props;
+ const { info, serverUris } = this.context;
if (key) {
let keys: string[] = key.split(new RegExp("[\\n\\r]+"));
@@ -467,7 +451,6 @@ class Sidebar extends PureComponent