Skip to content

Commit

Permalink
KEEP-1144 Clean up and fix network selection
Browse files Browse the repository at this point in the history
  • Loading branch information
faergeek committed Feb 3, 2023
1 parent f4d2f77 commit cff03f2
Show file tree
Hide file tree
Showing 15 changed files with 504 additions and 694 deletions.
4 changes: 2 additions & 2 deletions .size-limit.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "css",
"path": "dist/build/*.css",
"limit": "26 kB"
"limit": "25 kB"
},
{
"name": "background",
Expand All @@ -17,7 +17,7 @@
"dist/build/popup.js",
"dist/build/vendors*.js"
],
"limit": "439 kB"
"limit": "438 kB"
},
{
"name": "contentscript",
Expand Down
18 changes: 9 additions & 9 deletions src/accounts/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { RouteObject } from 'react-router-dom';
import { ErrorPage } from 'ui/components/pages/errorPage';
import { RootAccounts } from 'ui/components/RootAccounts';

import { Bottom } from '../ui/components/bottom/bottom';
import { BottomPanel } from '../layout/bottomPanel';
import { Menu } from '../ui/components/menu/Menu';
import { BackUpSeed } from '../ui/components/pages/BackupSeed';
import { ConfirmBackup } from '../ui/components/pages/ConfirmBackup';
Expand Down Expand Up @@ -33,7 +33,7 @@ export const routes: RouteObject[] = [
<>
<Menu hasLogo />
<AccountsHome />
<Bottom allowChangingNetwork />
<BottomPanel allowChangingNetwork />
</>
),
},
Expand All @@ -43,7 +43,7 @@ export const routes: RouteObject[] = [
<>
<Menu hasBack hasLogo />
<NewWallet />
<Bottom />
<BottomPanel />
</>
),
},
Expand All @@ -53,7 +53,7 @@ export const routes: RouteObject[] = [
<>
<Menu hasBack hasLogo />
<BackUpSeed />
<Bottom />
<BottomPanel />
</>
),
},
Expand All @@ -63,7 +63,7 @@ export const routes: RouteObject[] = [
<>
<Menu hasBack hasLogo />
<ConfirmBackup />
<Bottom />
<BottomPanel />
</>
),
},
Expand All @@ -73,7 +73,7 @@ export const routes: RouteObject[] = [
<>
<Menu hasBack hasLogo />
<ImportDebug />
<Bottom />
<BottomPanel />
</>
),
},
Expand All @@ -83,7 +83,7 @@ export const routes: RouteObject[] = [
<>
<Menu hasBack hasLogo />
<ImportSeed />
<Bottom />
<BottomPanel />
</>
),
},
Expand Down Expand Up @@ -111,7 +111,7 @@ export const routes: RouteObject[] = [
<>
<Menu hasBack hasLogo />
<ImportEmail />
<Bottom />
<BottomPanel />
</>
),
},
Expand All @@ -121,7 +121,7 @@ export const routes: RouteObject[] = [
<>
<Menu hasBack hasLogo />
<NewWalletName />
<Bottom />
<BottomPanel />
</>
),
},
Expand Down
17 changes: 9 additions & 8 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ export const STATUS = {
UPDATED: 2,
};

export interface NetworkConfigItem {
matcherBaseUrl: string;
name: NetworkName;
networkCode: string;
nodeBaseUrl: string;
}

export const NETWORK_CONFIG: Record<NetworkName, NetworkConfigItem> = {
export const NETWORK_CONFIG: Record<
NetworkName,
{
matcherBaseUrl: string;
name: NetworkName;
networkCode: string;
nodeBaseUrl: string;
}
> = {
[NetworkName.Testnet]: {
matcherBaseUrl: 'https://matcher-testnet.waves.exchange/',
name: NetworkName.Testnet,
Expand Down
96 changes: 96 additions & 0 deletions src/layout/bottomPanel.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.root {
z-index: 10;
flex: 0 0 34px;
margin-top: auto;
padding: 0 14px;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 -1px 4px 0 #00000019;
}

.networkTooltipContent {
max-width: calc(357px - 14px * 2);
}

.network {
display: flex;
gap: 10px;
align-items: center;
cursor: pointer;
}

.dropdownButton {
display: flex;
gap: 8px;
align-items: center;
justify-content: space-between;
background: none;
color: var(--color-basic500);
font: inherit;
}

.dropdownButton:disabled {
opacity: 0.5;
}

.dropdownButtonText {
border-bottom: 1px dotted var(--color-basic500);
}

.dropdown {
position: absolute;
z-index: 10;
bottom: 6px;
left: 6px;
padding: 2px 8px;
border-radius: 5px;
box-shadow: 0 2px 6px 0 #9ba6b266;
background-color: var(--color-white);
}

.dropdownItem {
padding: 6px 5px;
display: flex;
gap: 8px;
align-items: center;
width: 100%;
background: none;
color: var(--color-basic500);
font: inherit;
font-weight: normal;
}

.dropdownItem + .dropdownItem {
border-top: 1px solid var(--color-accent50);
}

.dropdownItem_selected,
.dropdownItem:hover {
color: var(--color-black);
}

.dropdownItem_selected {
cursor: default;
}

.dropdownItem:is(.dropdownItem_selected, :hover) .networkIcon,
.dropdownItem:not(.dropdownItem_selected, :hover) .networkIconActive {
display: none;
}

.editButton {
padding: 2px 6px;
border: 1px solid var(--color-basic200);
border-radius: 4px;
background: var(--color-basic100);
font-size: 11px;
}

.editButton:disabled {
opacity: 0.5;
}

.editButton:not(:disabled):hover {
background: var(--color-basic200);
}
Loading

0 comments on commit cff03f2

Please sign in to comment.