mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-06-25 20:41:02 +00:00
971df8edba
- Remove all 3rd party parachain configurations from endpoints: - productionRelayPolkadot.ts: Keep only system parachains - productionRelayDicle.ts: Keep only system parachains - testingRelayZagros.ts: Keep only system parachains - testingRelayTeyrChain.ts: Keep only system parachains - Update domain references: - polkadot.js.org → pezkuwichain.app - wiki.polkadot.network → wiki.pezkuwichain.io - dotapps.io → pezkuwichain.app - statement.polkadot.network → docs.pezkuwichain.io/statement - support.polkadot.network → docs.pezkuwichain.io - Update repository references: - github.com/pezkuwi-js/apps → github.com/pezkuwichain/pwap - Rename system parachains to Pezkuwi ecosystem: - PolkadotAssetHub → PezkuwiAssetHub - polkadotBridgeHub → pezkuwiBridgeHub - polkadotCollectives → pezkuwiCollectives - polkadotCoretime → pezkuwiCoretime - polkadotPeople → pezkuwiPeople - Update network name in claims utility: - Polkadot → Pezkuwi
77 lines
2.5 KiB
TypeScript
77 lines
2.5 KiB
TypeScript
// Copyright 2017-2026 @pezkuwi/apps authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { ThemeDef } from '@pezkuwi/react-components/types';
|
|
import type { KeyringStore } from '@pezkuwi/ui-keyring/types';
|
|
|
|
import React, { Suspense, useEffect, useState } from 'react';
|
|
import { HashRouter } from 'react-router-dom';
|
|
import { ThemeProvider } from 'styled-components';
|
|
|
|
import { ApiCtxRoot } from '@pezkuwi/react-api';
|
|
import { ApiStatsCtxRoot, BlockAuthorsCtxRoot, BlockEventsCtxRoot, KeyringCtxRoot, PayWithAssetCtxRoot, QueueCtxRoot, StakingAsyncApisCtxRoot, WindowSizeCtxRoot } from '@pezkuwi/react-hooks';
|
|
import { settings } from '@pezkuwi/ui-settings';
|
|
|
|
import BeforeApiInit from './overlays/BeforeInit.js';
|
|
import Apps from './Apps.js';
|
|
|
|
interface Props {
|
|
isElectron: boolean;
|
|
store?: KeyringStore;
|
|
}
|
|
|
|
function createTheme ({ uiTheme }: { uiTheme: string }): ThemeDef {
|
|
const theme = uiTheme === 'dark'
|
|
? 'dark'
|
|
: 'light';
|
|
|
|
document?.documentElement?.setAttribute('data-theme', theme);
|
|
|
|
return { theme };
|
|
}
|
|
|
|
function Root ({ isElectron, store }: Props): React.ReactElement<Props> {
|
|
const [theme, setTheme] = useState(() => createTheme(settings));
|
|
|
|
useEffect((): void => {
|
|
settings.on('change', (settings) => setTheme(createTheme(settings)));
|
|
}, []);
|
|
|
|
// The ordering here is critical. It defines the hierarchy of dependencies,
|
|
// i.e. Block* depends on Api. Certainly no cross-deps allowed
|
|
return (
|
|
<Suspense fallback='...'>
|
|
<ThemeProvider theme={theme}>
|
|
<QueueCtxRoot>
|
|
<ApiCtxRoot
|
|
apiUrl={settings.apiUrl}
|
|
beforeApiInit={<BeforeApiInit />}
|
|
isElectron={isElectron}
|
|
store={store}
|
|
>
|
|
<KeyringCtxRoot>
|
|
<ApiStatsCtxRoot>
|
|
<BlockAuthorsCtxRoot>
|
|
<BlockEventsCtxRoot>
|
|
<HashRouter>
|
|
<WindowSizeCtxRoot>
|
|
<PayWithAssetCtxRoot>
|
|
<StakingAsyncApisCtxRoot>
|
|
<Apps />
|
|
</StakingAsyncApisCtxRoot>
|
|
</PayWithAssetCtxRoot>
|
|
</WindowSizeCtxRoot>
|
|
</HashRouter>
|
|
</BlockEventsCtxRoot>
|
|
</BlockAuthorsCtxRoot>
|
|
</ApiStatsCtxRoot>
|
|
</KeyringCtxRoot>
|
|
</ApiCtxRoot>
|
|
</QueueCtxRoot>
|
|
</ThemeProvider>
|
|
</Suspense>
|
|
);
|
|
}
|
|
|
|
export default React.memo(Root);
|