Skip to content

Commit

Permalink
fix: not accessible modal showing when the wallet is not synced
Browse files Browse the repository at this point in the history
feat: moved wallet not synced modal to router with not accessible modal
  • Loading branch information
wwills2 committed Feb 29, 2024
1 parent 0e8a7bf commit 0a95e5a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"chia-wallet": "^1.0.18",
"chia-web2-gateway": "^1.0.10",
"components": "^0.1.0",
"express": "^4.18.2",
"express": "^4.18.3",
"flowbite": "^2.3.0",
"flowbite-react": "^0.7.2",
"flowbite-typography": "^1.0.3",
Expand All @@ -43,15 +43,15 @@
"react-dom": "^18.2.0",
"react-intl": "^6.6.2",
"react-redux": "^9.1.0",
"react-router-dom": "^6.22.1",
"react-router-dom": "^6.22.2",
"react-webview": "^0.1.0",
"redux-persist": "^6.0.0",
"styled-components": "^6.1.8",
"uuid": "^9.0.1",
"xterm": "^5.3.0"
},
"devDependencies": {
"@types/react": "^18.2.60",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^6.21.0",
Expand All @@ -60,7 +60,7 @@
"autoprefixer": "^10.4.17",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"electron": "^28.2.4",
"electron": "^28.2.5",
"electron-builder": "^24.12.0",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ const ChiaNotAccessibleModal: React.FC = () => {
error: walletQueryError,
} = useGetConfigQuery({wallet_id: 1}, {pollingInterval: 5500});

let datalayerFailure = false;
if (datalayerResponse){
datalayerFailure = !datalayerResponse?.success;
}

// talk to michael: datalayer will not respond while wallet outputs
const chiaInaccessible: boolean =
Boolean(!datalayerResponse?.success || !walletResponse || datalayerQueryError || walletQueryError);
Boolean(datalayerFailure || !walletResponse || datalayerQueryError || walletQueryError);

return (
<Modal show={chiaInaccessible} dismissible={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ const WaitingForWalletSyncModal: React.FC = () => {
return (
<Modal show={Boolean(walletData?.wallet_balance?.pending_coin_removal_count) || !walletSyncStatus?.synced}>
<div className="flex items-start justify-between rounded-t dark:border-gray-600 border-b p-5">
<FormattedMessage id="waiting-for-transactions-to-confirm" />
{!walletSyncStatus?.synced
? <FormattedMessage id={'waiting-for-wallet-to-sync'}/>
: <FormattedMessage id="waiting-for-transactions-to-confirm" />
}
</div>
<Modal.Body>
<div style={{ display: 'flex', justifyContent: 'center' }}>
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/pages/MyStores/MyStores.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useState} from "react";
import {CreateDlStoreButton, OwnedStoresTable, Spacer, WaitingForWalletSyncModal} from "@/components";
import {CreateDlStoreButton, OwnedStoresTable, Spacer} from "@/components";

const MyStores: React.FC = () => {

Expand All @@ -18,7 +18,6 @@ const MyStores: React.FC = () => {
setTableContentsLoaded={setStoreTableContentsLoaded}
/>
<Spacer size={10}/>
<WaitingForWalletSyncModal />
</>
);
};
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from 'react-router-dom';
import ROUTES from './route-constants'
import * as Pages from '@/pages'
import {ChiaNotAccessibleModal, Template} from '@/components';
import {ChiaNotAccessibleModal, Template, WaitingForWalletSyncModal} from '@/components';

const AppNavigator: React.FC = () => {
return (
Expand Down Expand Up @@ -54,7 +54,9 @@ const AppNavigator: React.FC = () => {
/>
</Route>
</Routes>
{/* app-wide blocking modals */}
<ChiaNotAccessibleModal/>
<WaitingForWalletSyncModal/>
</Router>
</>
);
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/translations/tokens/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,6 @@
"if-you-need-to-install-chia-downloads-for-all-platforms-can-be-found-at"
: "If you need to install Chia, downloads for all platforms can be found at",
"the-official-downloads-page": "the official downloads page",
"chia-is-running-retry": "Chia is running, retry"
"chia-is-running-retry": "Chia is running, retry",
"waiting-for-wallet-to-sync": "Waiting for wallet to sync"
}

0 comments on commit 0a95e5a

Please sign in to comment.