Expand ui-settings with additional info on options (#190)

This commit is contained in:
Jaco Greeff
2019-08-28 11:41:54 +02:00
committed by GitHub
parent f0af2aaa6e
commit b548b239d7
2 changed files with 72 additions and 15 deletions
+71 -15
View File
@@ -5,7 +5,6 @@
import { Options } from './types'; import { Options } from './types';
// matches https://polkadot.js.org & https://*.polkadot.io // matches https://polkadot.js.org & https://*.polkadot.io
// tslint:disable-next-line
const isPolkadot = typeof window !== 'undefined' && window.location.host.indexOf('polkadot') !== -1; const isPolkadot = typeof window !== 'undefined' && window.location.host.indexOf('polkadot') !== -1;
const WSS_NODES = { const WSS_NODES = {
@@ -34,61 +33,119 @@ const LANGUAGE_DEFAULT = 'default';
const LOCKING_DEFAULT = 'session'; const LOCKING_DEFAULT = 'session';
const CRYPTOS: Options = [ const CRYPTOS: Options = [
{ text: 'Edwards (ed25519)', value: 'ed25519' }, {
{ text: 'Schnorrkel (sr25519)', value: 'sr25519' } info: 'ed25519',
text: 'Edwards (ed25519)',
value: 'ed25519'
},
{
info: 'sr25519',
text: 'Schnorrkel (sr25519)',
value: 'sr25519'
}
]; ];
const ENDPOINTS: Options = [ const ENDPOINTS: Options = [
{ {
info: 'kusama',
text: `Kusama (Polkadot Canary, ${WSS_NODES.parity.hosted})`, text: `Kusama (Polkadot Canary, ${WSS_NODES.parity.hosted})`,
value: WSS_NODES.parity.nodes.kusama value: WSS_NODES.parity.nodes.kusama
}, },
{ {
info: 'kusama',
text: `Kusama (Polkadot Canary, ${WSS_NODES.w3f.hosted})`, text: `Kusama (Polkadot Canary, ${WSS_NODES.w3f.hosted})`,
value: WSS_NODES.w3f.nodes.kusama value: WSS_NODES.w3f.nodes.kusama
}, },
{ {
info: 'alexander',
text: `Alexander (Polkadot Test, ${WSS_NODES.parity.hosted})`, text: `Alexander (Polkadot Test, ${WSS_NODES.parity.hosted})`,
value: WSS_NODES.parity.nodes.alex value: WSS_NODES.parity.nodes.alex
}, },
{ {
info: 'alexander',
text: `Alexander (Polkadot Test, ${WSS_NODES.unfra.hosted})`, text: `Alexander (Polkadot Test, ${WSS_NODES.unfra.hosted})`,
value: WSS_NODES.unfra.nodes.alex value: WSS_NODES.unfra.nodes.alex
}, },
{ {
info: 'substrate',
text: `Flaming Fir (Substrate Test, ${WSS_NODES.parity.hosted})`, text: `Flaming Fir (Substrate Test, ${WSS_NODES.parity.hosted})`,
value: WSS_NODES.parity.nodes.fir value: WSS_NODES.parity.nodes.fir
}, },
{ {
info: 'local',
text: 'Local Node (127.0.0.1:9944)', text: 'Local Node (127.0.0.1:9944)',
value: 'ws://127.0.0.1:9944/' value: 'ws://127.0.0.1:9944/'
} }
]; ];
const LANGUAGES: Options = [ const LANGUAGES: Options = [
{ text: 'Default browser language (auto-detect)', value: LANGUAGE_DEFAULT } {
info: 'detect',
text: 'Default browser language (auto-detect)',
value: LANGUAGE_DEFAULT
}
]; ];
const LOCKING: Options = [ const LOCKING: Options = [
{ text: 'Once per session', value: 'session' }, {
{ text: 'On each transaction', value: 'tx' } info: 'session',
text: 'Once per session',
value: 'session'
},
{
info: 'tx',
text: 'On each transaction',
value: 'tx'
}
]; ];
const PREFIXES: Options = [ const PREFIXES: Options = [
{ text: 'Default for the connected node', value: -1 }, {
{ text: 'Substrate (development)', value: 42 }, info: 'default',
{ text: 'Kusama (canary)', value: 2 }, text: 'Default for the connected node',
{ text: 'Polkadot (live)', value: 0 } value: -1
},
{
info: 'substrate',
text: 'Substrate (development)',
value: 42
},
{
info: 'kusama',
text: 'Kusama (canary)',
value: 2
},
{
info: 'polkadot',
text: 'Polkadot (live)',
value: 0
}
]; ];
const UIMODES: Options = [ const UIMODES: Options = [
{ value: 'full', text: 'Fully featured' }, {
{ value: 'light', text: 'Basic features only' } info: 'full',
text: 'Fully featured',
value: 'full'
},
{
info: 'light',
text: 'Basic features only',
value: 'light'
}
]; ];
const UITHEMES: Options = [ const UITHEMES: Options = [
{ value: 'polkadot', text: 'Polkadot' }, {
{ value: 'substrate', text: 'Substrate' } info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
},
{
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}
]; ];
const ENDPOINT_DEFAULT = isPolkadot const ENDPOINT_DEFAULT = isPolkadot
@@ -101,7 +158,6 @@ const UITHEME_DEFAULT = isPolkadot
? 'polkadot' ? 'polkadot'
: 'substrate'; : 'substrate';
// tslint:disable-next-line
const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.indexOf('ui-light') !== -1 const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.indexOf('ui-light') !== -1
? 'light' ? 'light'
: 'full'; : 'full';
+1
View File
@@ -4,6 +4,7 @@
export type Options = { export type Options = {
disabled?: boolean; disabled?: boolean;
info: string;
text: string; text: string;
value: string | number; value: string | number;
}[] }[]