Expander adjustment (#3480)

* Expander adjustment

* AddressInfo w/ New DOT

* Adjust

* Content padding

* Basic settings when not connected
This commit is contained in:
Jaco Greeff 2020-08-23 10:35:12 +02:00 committed by GitHub
parent 74064d97f7
commit 39422a06ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 7 deletions

View File

@ -37,6 +37,7 @@ function Content ({ className }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api, isApiConnected, isApiReady } = useApi();
const { queueAction } = useContext(StatusContext);
const { Component, display: { needsApi }, name } = useMemo(
(): Route => {
const app = location.pathname.slice(1) || '';
@ -46,9 +47,14 @@ function Content ({ className }: Props): React.ReactElement<Props> {
[location, t]
);
const missingApis = useMemo(
() => findMissingApis(api, needsApi),
[api, needsApi]
);
return (
<div className={className}>
{(!isApiReady || !isApiConnected)
{needsApi && (!isApiReady || !isApiConnected)
? (
<div className='connecting'>
<Spinner label={t<string>('Initializing connection')} />
@ -57,7 +63,7 @@ function Content ({ className }: Props): React.ReactElement<Props> {
: (
<>
<Suspense fallback='...'>
{findMissingApis(api, needsApi).length
{missingApis.length
? <NotFound />
: (
<ErrorBoundary trigger={name}>
@ -82,7 +88,7 @@ export default React.memo(styled(Content)`
flex-grow: 1;
overflow-x: hidden;
overflow-y: auto;
padding: 0 2.5rem 1rem;
padding: 0 2rem 1rem;
position: relative;
width: 100%;

View File

@ -48,6 +48,8 @@ function checkVisible (name: string, { api, isApiConnected, isApiReady }: ApiPro
return false;
} else if (needsAccounts && !hasAccounts) {
return false;
} else if (!needsApi) {
return true;
} else if (!isApiReady || !isApiConnected) {
return false;
} else if (needsSudo && !hasSudo) {

View File

@ -7,6 +7,7 @@ import { AppProps as Props } from '@polkadot/react-components/types';
import React, { useMemo } from 'react';
import { Route, Switch } from 'react-router';
import { HelpOverlay, Tabs } from '@polkadot/react-components';
import { useApi } from '@polkadot/react-hooks';
import md from './md/basics.md';
import { useTranslation } from './translate';
@ -20,7 +21,9 @@ export { useCounter };
function SettingsApp ({ basePath, onStatusChange }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { isApiConnected, isApiReady } = useApi();
const numExtensions = useCounter();
const items = useMemo(() => [
{
isRoot: true,
@ -42,12 +45,18 @@ function SettingsApp ({ basePath, onStatusChange }: Props): React.ReactElement<P
}
], [numExtensions, t]);
const hidden = useMemo(
() => (isApiConnected && isApiReady) ? [] : ['metadata', 'i18n'],
[isApiConnected, isApiReady]
);
return (
<main className='settings--App'>
<HelpOverlay md={md as string} />
<header>
<Tabs
basePath={basePath}
hidden={hidden}
items={items}
/>
</header>

View File

@ -438,7 +438,7 @@ export default withMulti(
justify-content: start;
&.column--expander {
width: 16.5rem;
width: 17.5rem;
.ui--Expander {
width: 100%;

View File

@ -107,11 +107,11 @@ export default React.memo(styled(Expander)`
.ui--Expander-summary {
margin: 0;
min-width: 12.5rem;
min-width: 13.5rem;
overflow: hidden;
.ui--Expander-summary-header > .ui--FormatBalance {
min-width: 10rem;
min-width: 11rem;
}
> div {
@ -126,7 +126,6 @@ export default React.memo(styled(Expander)`
.ui--Expander-summary-sub {
font-size: 1rem;
opacity: 0.6;
padding-left: 1.75rem;
}
}
`);