Files
pwap/pezkuwi-sdk-ui/packages/react-components/src/TreasuryProposal.tsx
T
pezkuwichain 971df8edba Rebrand: Remove 3rd party chains, update domains to PezkuwiChain
- 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
2026-01-09 03:08:11 +03:00

87 lines
2.3 KiB
TypeScript

// Copyright 2017-2026 @pezkuwi/app-democracy authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Option } from '@pezkuwi/types';
import type { TreasuryProposal as TreasuryProposalType } from '@pezkuwi/types/interfaces';
import React, { useEffect, useState } from 'react';
import { useApi } from '@pezkuwi/react-hooks';
import { FormatBalance } from '@pezkuwi/react-query';
import InputAddress from './InputAddress/index.js';
import Labelled from './Labelled.js';
import Static from './Static.js';
import { useTranslation } from './translate.js';
interface Props {
className?: string;
onClick?: () => void;
proposalId?: string;
proposal?: TreasuryProposalType | null;
withLink?: boolean;
}
function TreasuryProposal ({ className = '', onClick, proposal, proposalId }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const [stateProposal, setProposal] = useState<TreasuryProposalType | null>(null);
const { api } = useApi();
useEffect((): void => {
if (!proposal && proposalId) {
api.query.treasury
.proposals<Option<TreasuryProposalType>>(proposalId)
.then((proposal): TreasuryProposalType | null => proposal.unwrapOr(null))
.catch((): null => null)
.then(setProposal)
.catch(console.error);
} else {
setProposal(proposal || null);
}
}, [api, proposal, proposalId]);
if (!stateProposal) {
return null;
}
const { beneficiary, bond, proposer, value } = stateProposal;
const inner = (
<>
<Labelled label={t('proposed by')}>
<InputAddress
defaultValue={proposer}
isDisabled
value={proposer}
withLabel={false}
/>
</Labelled>
<Labelled label={t('beneficiary')}>
<InputAddress
defaultValue={beneficiary}
isDisabled
value={beneficiary}
withLabel={false}
/>
</Labelled>
<Static label={t('value')}>
<FormatBalance value={value} />
</Static>
<Static label={t('bond')}>
<FormatBalance value={bond} />
</Static>
</>
);
return (
<div
className={className}
onClick={onClick && onClick}
>
{inner}
</div>
);
}
export default React.memo(TreasuryProposal);