mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-08-09 03:15:40 +00:00
60a800b33e
- Clone Polkadot.js Apps repository - Update package.json with Pezkuwi branding - Add Pezkuwi endpoint to production chains (wss://pezkuwichain.app:9944) - Create comprehensive README for SDK UI - Set up project structure with all packages Next steps: - Apply Kurdistan colors (Kesk, Sor, Zer, Spi + Black) to UI theme - Replace logos with Pezkuwi branding - Test build and deployment
70 lines
1.8 KiB
TypeScript
70 lines
1.8 KiB
TypeScript
// Copyright 2017-2025 @polkadot/app-coretime authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { ApiPromise } from '@polkadot/api';
|
|
import type { TabItem } from '@polkadot/react-components/types';
|
|
import type { RelayName } from './types.js';
|
|
|
|
import React, { useRef } from 'react';
|
|
import { Route, Routes } from 'react-router-dom';
|
|
|
|
import { Spinner, Tabs } from '@polkadot/react-components';
|
|
import { useCall } from '@polkadot/react-hooks';
|
|
|
|
import Overview from './Overview/index.js';
|
|
import Sale from './Sale/index.js';
|
|
import { useTranslation } from './translate.js';
|
|
|
|
interface Props {
|
|
basePath: string;
|
|
className?: string;
|
|
api: ApiPromise;
|
|
isApiReady: boolean;
|
|
}
|
|
|
|
function createItemsRef (t: (key: string, options?: { replace: Record<string, unknown> }) => string): TabItem[] {
|
|
return [
|
|
{
|
|
isRoot: true,
|
|
name: 'overview',
|
|
text: t('Overview')
|
|
},
|
|
{
|
|
name: 'sale',
|
|
text: t('Sale')
|
|
}
|
|
];
|
|
}
|
|
|
|
function CoretimePage ({ api, basePath, className, isApiReady }: Props): React.ReactElement<Props> {
|
|
const { t } = useTranslation();
|
|
const itemsRef = useRef(createItemsRef(t));
|
|
const relayName = useCall<string>(isApiReady && api?.rpc.system.chain)?.toString().toLowerCase() as RelayName;
|
|
|
|
return (
|
|
<main className={className}>
|
|
<Tabs
|
|
basePath={basePath}
|
|
items={itemsRef.current}
|
|
/>
|
|
{!relayName
|
|
? <div><Spinner /></div>
|
|
: <Routes>
|
|
<Route path={basePath}>
|
|
<Route
|
|
element={<Overview relayName={relayName} />}
|
|
index
|
|
/>
|
|
<Route
|
|
element={<Sale relayName={relayName} />}
|
|
path='sale'
|
|
/>
|
|
</Route>
|
|
</Routes>
|
|
}
|
|
</main>
|
|
);
|
|
}
|
|
|
|
export default React.memo(CoretimePage);
|