From 96f718cd75d45fb97c00eab076a465c681d0727f Mon Sep 17 00:00:00 2001 From: Eswara Sai Date: Mon, 23 Sep 2019 15:55:13 +0530 Subject: [PATCH] Added network modal to select chain (#1642) * Added network modal to change selection * Added toggleNetworkModal function --- packages/app-settings/src/General.tsx | 115 +++++++++++++++----------- packages/apps/src/SideBar/SideBar.css | 1 + packages/apps/src/SideBar/index.tsx | 32 +++++-- packages/apps/src/modals/Network.tsx | 35 ++++++++ 4 files changed, 127 insertions(+), 56 deletions(-) create mode 100644 packages/apps/src/modals/Network.tsx diff --git a/packages/app-settings/src/General.tsx b/packages/app-settings/src/General.tsx index 449600286f..8b7987040e 100644 --- a/packages/app-settings/src/General.tsx +++ b/packages/app-settings/src/General.tsx @@ -2,22 +2,22 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { AppProps, I18nProps } from '@polkadot/react-components/types'; +import { I18nProps } from '@polkadot/react-components/types'; import { Option } from './types'; import queryString from 'query-string'; import React, { useEffect, useState } from 'react'; import { isLedgerCapable } from '@polkadot/react-api'; import { Button, Dropdown } from '@polkadot/react-components'; -import { ActionStatus } from '@polkadot/react-components/Status/types'; import uiSettings from '@polkadot/ui-settings'; import translate from './translate'; import { createIdenticon, createOption, save, saveAndReload } from './util'; import SelectUrl from './SelectUrl'; -interface Props extends AppProps, I18nProps { - onStatusChange: (status: ActionStatus) => void; +interface Props extends I18nProps{ + isModalContent?: boolean; + onClose?: () => void; } // check for a ledger=... string, acivate @@ -28,7 +28,7 @@ const prefixOptions = uiSettings.availablePrefixes.map((o): Option => createOpti const iconOptions = uiSettings.availableIcons.map((o): Option => createIdenticon(o, ['default'])); const ledgerConnOptions = uiSettings.availableLedgerConn; -function General ({ className, t }: Props): React.ReactElement { +function General ({ className, isModalContent, onClose, t }: Props): React.ReactElement { // tri-state: null = nothing changed, false = no reload, true = reload required const [changed, setChanged] = useState(null); const [settings, setSettings] = useState(uiSettings.get()); @@ -61,53 +61,68 @@ function General ({ className, t }: Props): React.ReactElement { return (
-
- -
-
- -
-
- -
- {WITH_LEDGER && isLedgerCapable() && ( -
- -
+ {!isModalContent && ( + <> +
+ +
+
+ +
+
+ +
+ {WITH_LEDGER && isLedgerCapable() && ( +
+ +
+ )} +
+ +
+ )} -
- -
+ {isModalContent && ( + <> +