mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-06-14 02:51:09 +00:00
7a4bbeac25
- Update @pezkuwi/extension-inject to ^0.62.13 with proper /types exports - Update @pezkuwi/extension-dapp to ^0.62.13 - Update @pezkuwi/extension-compat-metamask to ^0.62.13 - Fix IconTheme type to include 'bizinikiwi' and 'pezkuwi' themes - Fix endpoint array issues (getTeleports -> direct array references) - Add type assertions for external package compatibility (acala, moonbeam, parallel) - Fix subspace.ts dynamic class typing - Fix conviction type in page-referenda - Update Pallet type names to Pezpallet prefix across codebase - Define InjectedExtension types locally for module resolution - Add styled-components DefaultTheme augmentation - Add react-copy-to-clipboard type declaration for React 18 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
131 lines
3.6 KiB
TypeScript
131 lines
3.6 KiB
TypeScript
// Copyright 2017-2026 @pezkuwi/app-teyrchains authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import '@pezkuwi/api-augment/bizinikiwi';
|
|
|
|
import type { ParaId } from '@pezkuwi/types/interfaces';
|
|
|
|
import React, { useRef } from 'react';
|
|
import { Route, Routes } from 'react-router';
|
|
import { useLocation } from 'react-router-dom';
|
|
|
|
import { Tabs } from '@pezkuwi/react-components';
|
|
import { useApi, useCall } from '@pezkuwi/react-hooks';
|
|
|
|
import Auctions from './Auctions/index.js';
|
|
import Crowdloan from './Crowdloan/index.js';
|
|
import Overview from './Overview/index.js';
|
|
import Parathreads from './Parathreads/index.js';
|
|
import Proposals from './Proposals/index.js';
|
|
import { useTranslation } from './translate.js';
|
|
import useActionsQueue from './useActionsQueue.js';
|
|
import useAuctionInfo from './useAuctionInfo.js';
|
|
import useFunds from './useFunds.js';
|
|
import useLeasePeriod from './useLeasePeriod.js';
|
|
import useOwnedIds from './useOwnedIds.js';
|
|
import useProposals from './useProposals.js';
|
|
import useUpcomingIds from './useUpcomingIds.js';
|
|
import useWinningData from './useWinningData.js';
|
|
|
|
interface Props {
|
|
basePath: string;
|
|
className?: string;
|
|
}
|
|
|
|
function TeyrchainsApp ({ basePath, className }: Props): React.ReactElement<Props> {
|
|
const { t } = useTranslation();
|
|
const { api } = useApi();
|
|
const { pathname } = useLocation();
|
|
const auctionInfo = useAuctionInfo();
|
|
const campaigns = useFunds();
|
|
const leasePeriod = useLeasePeriod();
|
|
const ownedIds = useOwnedIds();
|
|
const winningData = useWinningData(auctionInfo);
|
|
const proposals = useProposals();
|
|
const actionsQueue = useActionsQueue();
|
|
const upcomingIds = useUpcomingIds();
|
|
const paraIds = useCall<ParaId[]>(api.query.paras.teyrchains);
|
|
|
|
const items = useRef([
|
|
{
|
|
isRoot: true,
|
|
name: 'overview',
|
|
text: t('Overview')
|
|
},
|
|
{
|
|
name: 'parathreads',
|
|
text: t('Parathreads')
|
|
},
|
|
api.query.proposeTeyrchain && {
|
|
name: 'proposals',
|
|
text: t('Proposals')
|
|
},
|
|
api.query.auctions && {
|
|
name: 'auctions',
|
|
text: t('Auctions')
|
|
},
|
|
api.query.crowdloan && {
|
|
name: 'crowdloan',
|
|
text: t('Crowdloan')
|
|
}
|
|
].filter((q) => !!q));
|
|
|
|
return (
|
|
<main className={className}>
|
|
<Tabs
|
|
basePath={basePath}
|
|
items={items.current}
|
|
/>
|
|
<Routes>
|
|
<Route path={basePath}>
|
|
<Route
|
|
element={
|
|
<Auctions
|
|
auctionInfo={auctionInfo}
|
|
campaigns={campaigns}
|
|
ownedIds={ownedIds}
|
|
winningData={winningData}
|
|
/>
|
|
}
|
|
path='auctions'
|
|
/>
|
|
<Route
|
|
element={
|
|
<Crowdloan
|
|
auctionInfo={auctionInfo}
|
|
campaigns={campaigns}
|
|
leasePeriod={leasePeriod}
|
|
ownedIds={ownedIds}
|
|
/>
|
|
}
|
|
path='crowdloan'
|
|
/>
|
|
<Route
|
|
element={
|
|
<Proposals proposals={proposals} />
|
|
}
|
|
path='proposals'
|
|
/>
|
|
</Route>
|
|
</Routes>
|
|
<Overview
|
|
actionsQueue={actionsQueue}
|
|
className={pathname === basePath ? '' : '--hidden'}
|
|
leasePeriod={leasePeriod}
|
|
paraIds={paraIds}
|
|
proposals={proposals}
|
|
threadIds={upcomingIds}
|
|
/>
|
|
<Parathreads
|
|
actionsQueue={actionsQueue}
|
|
className={pathname === `${basePath}/parathreads` ? '' : '--hidden'}
|
|
ids={upcomingIds}
|
|
leasePeriod={leasePeriod}
|
|
ownedIds={ownedIds}
|
|
/>
|
|
</main>
|
|
);
|
|
}
|
|
|
|
export default React.memo(TeyrchainsApp);
|