mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-04-25 12:47:55 +00:00
d21bfb1320
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
78 lines
1.8 KiB
TypeScript
78 lines
1.8 KiB
TypeScript
// Copyright 2017-2025 @pezkuwi/app-js authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { AppProps as Props } from '@pezkuwi/react-components/types';
|
|
|
|
import React, { useRef } from 'react';
|
|
import { Route, Routes } from 'react-router';
|
|
|
|
import { Icon, Tabs } from '@pezkuwi/react-components';
|
|
import { useSudo } from '@pezkuwi/react-hooks';
|
|
|
|
import SetKey from './SetKey.js';
|
|
import Sudo from './Sudo.js';
|
|
import { useTranslation } from './translate.js';
|
|
|
|
function SudoApp ({ basePath }: Props): React.ReactElement<Props> {
|
|
const { t } = useTranslation();
|
|
const { allAccounts, hasSudoKey, sudoKey } = useSudo();
|
|
|
|
const itemsRef = useRef([
|
|
{
|
|
isRoot: true,
|
|
name: 'index',
|
|
text: t('Sudo access')
|
|
},
|
|
{
|
|
name: 'key',
|
|
text: t('Set sudo key')
|
|
}
|
|
]);
|
|
|
|
return (
|
|
<main>
|
|
<Tabs
|
|
basePath={basePath}
|
|
items={itemsRef.current}
|
|
/>
|
|
{hasSudoKey
|
|
? (
|
|
<Routes>
|
|
<Route path={basePath}>
|
|
<Route
|
|
element={
|
|
<SetKey
|
|
allAccounts={allAccounts}
|
|
isMine={hasSudoKey}
|
|
sudoKey={sudoKey}
|
|
/>
|
|
}
|
|
path='key'
|
|
/>
|
|
<Route
|
|
element={
|
|
<Sudo
|
|
isMine={hasSudoKey}
|
|
sudoKey={sudoKey}
|
|
/>
|
|
}
|
|
index
|
|
/>
|
|
</Route>
|
|
</Routes>
|
|
)
|
|
: (
|
|
<article className='error padded'>
|
|
<div>
|
|
<Icon icon='ban' />
|
|
{t('You do not have access to the current sudo key')}
|
|
</div>
|
|
</article>
|
|
)
|
|
}
|
|
</main>
|
|
);
|
|
}
|
|
|
|
export default React.memo(SudoApp);
|