From 19cc6e93ca296d1e674490c24b2fde5fa83bb499 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Fri, 7 Oct 2022 12:33:22 -0700 Subject: [PATCH] Fix Tor connection icon in web --- frontend/src/components/TorConnection.tsx | 128 ++++++++++++---------- frontend/static/locales/en.json | 5 +- 2 files changed, 76 insertions(+), 57 deletions(-) diff --git a/frontend/src/components/TorConnection.tsx b/frontend/src/components/TorConnection.tsx index 6b0ed2d5..96ae0e00 100644 --- a/frontend/src/components/TorConnection.tsx +++ b/frontend/src/components/TorConnection.tsx @@ -2,6 +2,52 @@ import React, { useEffect, useState } from 'react'; import { Box, CircularProgress, Tooltip } from '@mui/material'; import { TorIcon } from './Icons'; import { useTranslation } from 'react-i18next'; +import { gridQuickFilterValuesSelector } from '@mui/x-data-grid'; + +interface Props { + color: 'inherit' | 'error' | 'warning' | 'success' | 'primary' | 'secondary' | 'info' | undefined; + tooltipOpen?: boolean | undefined; + title: string; + progress: boolean; +} + +const TorIndicator = ({ color, tooltipOpen = undefined, title, progress }: Props): JSX.Element => { + return ( + + + {progress ? ( + <> + + + + + + ) : ( + + + + )} + + + ); +}; const TorConnection = (): JSX.Element => { const [torStatus, setTorStatus] = useState('NOTINIT'); @@ -13,66 +59,38 @@ const TorConnection = (): JSX.Element => { }); }, []); - if (window?.NativeRobosats && (torStatus === 'NOTINIT' || torStatus === 'STARTING')) { + if (!window?.NativeRobosats) { + return <>; + } + + if (torStatus === 'NOTINIT') { return ( - - - - - - - - + ); - } else if (window?.NativeRobosats && (torStatus === '"Done"' || torStatus === 'DONE')) { + } else if (torStatus === 'STARTING') { return ( - - - - - + ); - } else if (true) { + } else if (torStatus === '"Done"' || torStatus === 'DONE') { + return ; + } else { return ( - - - - - + ); } }; diff --git a/frontend/static/locales/en.json b/frontend/static/locales/en.json index 1b1c7e74..ff8f9585 100644 --- a/frontend/static/locales/en.json +++ b/frontend/static/locales/en.json @@ -7,9 +7,10 @@ "You are self-hosting RoboSats": "You are self-hosting RoboSats", "RoboSats client is served from your own node granting you the strongest security and privacy.": "RoboSats client is served from your own node granting you the strongest security and privacy.", - "Connected to TOR network": "Connected to TOR network", - "TOR connection error": "TOR connection error", + "Initializing TOR daemon": "Initializing TOR daemon", "Connecting to TOR network": "Connecting to TOR network", + "Connected to TOR network": "Connected to TOR network", + "Connection error": "Connection error", "USER GENERATION PAGE - UserGenPage.js": "Landing Page and User Generation", "Simple and Private LN P2P Exchange": "Simple and Private LN P2P Exchange",