feat: initial Pezkuwi Apps rebrand from polkadot-apps

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
This commit is contained in:
Kurdistan Tech Ministry committed 2026-01-07 13:05:27 +03:00
commit d21bfb1320
5867 files changed
+329019

No files matched your search

@@ -0,0 +1,108 @@
// Copyright 2017-2025 @pezkuwi/app-treasury authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { SubmittableExtrinsic } from '@pezkuwi/api/types';
import type { ProposalIndex } from '@pezkuwi/types/interfaces';
import React, { useEffect, useRef, useState } from 'react';
import { getTreasuryProposalThreshold } from '@pezkuwi/apps-config';
import { Button, Dropdown, InputAddress, Modal, TxButton } from '@pezkuwi/react-components';
import { useApi, useCollectiveInstance, useToggle } from '@pezkuwi/react-hooks';
import { useTranslation } from '../translate.js';
interface Props {
id: ProposalIndex;
isDisabled: boolean;
members: string[];
}
interface ProposalState {
proposal?: SubmittableExtrinsic<'promise'> | null;
proposalLength: number;
}
function Council ({ id, isDisabled, members }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const [isOpen, toggleOpen] = useToggle();
const [accountId, setAccountId] = useState<string | null>(null);
const [proposalType, setProposalType] = useState('accept');
const [{ proposal, proposalLength }, setProposal] = useState<ProposalState>(() => ({ proposalLength: 0 }));
const modCouncil = useCollectiveInstance('council');
const threshold = Math.ceil((members?.length || 0) * getTreasuryProposalThreshold(api));
const councilTypeOptRef = useRef([
{ text: t('Acceptance proposal to council'), value: 'accept' },
{ text: t('Rejection proposal to council'), value: 'reject' }
]);
useEffect((): void => {
const proposal = proposalType === 'reject'
? api.tx.treasury.rejectProposal(id)
: api.tx.treasury.approveProposal(id);
setProposal({ proposal, proposalLength: proposal.length });
}, [api, id, proposalType]);
if (!modCouncil) {
return null;
}
return (
<>
{isOpen && (
<Modal
header={t('Send to council')}
onClose={toggleOpen}
size='large'
>
<Modal.Content>
<Modal.Columns hint={t('The council member that is proposing this, submission equates to an "aye" vote.')}>
<InputAddress
filter={members}
label={t('submit with council account')}
onChange={setAccountId}
type='account'
withLabel
/>
</Modal.Columns>
<Modal.Columns hint={t('Proposal can either be to approve or reject this spend. Once approved, the change is applied by either removing the proposal or scheduling payout.')}>
<Dropdown
label={t('council proposal type')}
onChange={setProposalType}
options={councilTypeOptRef.current}
value={proposalType}
/>
</Modal.Columns>
</Modal.Content>
<Modal.Actions>
<TxButton
accountId={accountId}
icon='check'
isDisabled={!accountId || !threshold}
label={t('Send to council')}
onStart={toggleOpen}
params={
api.tx[modCouncil].propose.meta.args.length === 3
? [threshold, proposal, proposalLength]
: [threshold, proposal]
}
tx={api.tx[modCouncil].propose}
/>
</Modal.Actions>
</Modal>
)}
<Button
icon='step-forward'
isDisabled={isDisabled}
label={t('To council')}
onClick={toggleOpen}
/>
</>
);
}
export default React.memo(Council);
@@ -0,0 +1,93 @@
// Copyright 2017-2025 @pezkuwi/app-treasury authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveTreasuryProposal } from '@pezkuwi/api-derive/types';
import React, { useMemo } from 'react';
import { AddressMini, AddressSmall, Columar, LinkExternal, Table } from '@pezkuwi/react-components';
import { useApi, useToggle } from '@pezkuwi/react-hooks';
import { isFunction } from '@pezkuwi/util';
import { useTranslation } from '../translate.js';
import Council from './Council.js';
interface Props {
className?: string;
isMember: boolean;
members: string[];
proposal: DeriveTreasuryProposal;
withSend: boolean;
}
function ProposalDisplay ({ className = '', isMember, members, proposal: { council, id, proposal }, withSend }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const [isExpanded, toggleIsExpanded] = useToggle(false);
const hasCouncil = isFunction(api.tx.council?.propose);
const hasProposals = useMemo(
() => !!council
.map(({ votes }) => votes ? votes.index.toNumber() : -1)
.filter((index) => index !== -1)
.length,
[council]
);
return (
<>
<tr className={`${className} isExpanded isFirst ${isExpanded ? '' : 'isLast'}`}>
<Table.Column.Id value={id} />
<td className='address all'>
<AddressSmall value={proposal.beneficiary} />
</td>
<Table.Column.Balance value={proposal.value} />
<td className='address'>
<AddressMini
balance={proposal.bond}
value={proposal.proposer}
withBalance
/>
</td>
<td className={hasProposals ? 'middle' : 'button'}>
{hasCouncil
? hasProposals
? <a href='#/council/motions'>{t('Voting')}</a>
: withSend && (
<Council
id={id}
isDisabled={!isMember}
members={members}
/>
)
: null
}
</td>
<Table.Column.Expand
isExpanded={isExpanded}
toggle={toggleIsExpanded}
/>
</tr>
<tr className={`${className} ${isExpanded ? 'isExpanded isLast' : 'isCollapsed'} packedTop`}>
<td />
<td
className='columar'
colSpan={4}
>
<Columar is100>
<Columar.Column>
<LinkExternal
data={id}
type='treasury'
withTitle
/>
</Columar.Column>
</Columar>
</td>
<td />
</tr>
</>
);
}
export default React.memo(ProposalDisplay);
@@ -0,0 +1,128 @@
// Copyright 2017-2025 @pezkuwi/app-treasury authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Option, u128 } from '@pezkuwi/types';
import type { Permill } from '@pezkuwi/types/interfaces';
import React, { useMemo, useState } from 'react';
import { Button, InputAddress, InputBalance, MarkWarning, Modal, Static, TxButton } from '@pezkuwi/react-components';
import { useApi, useToggle } from '@pezkuwi/react-hooks';
import { BN, BN_HUNDRED, BN_MILLION } from '@pezkuwi/util';
import { useTranslation } from '../translate.js';
interface Props {
className?: string;
}
function Propose ({ className }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const [accountId, setAccountId] = useState<string | null>(null);
const [beneficiary, setBeneficiary] = useState<string | null>(null);
const [isOpen, toggleOpen] = useToggle();
const [value, setValue] = useState<BN | undefined>();
const hasValue = value?.gtn(0);
const [bondMin, bondMax, bondPercentage] = useMemo(
() => [
api.consts.treasury.proposalBondMinimum
? (api.consts.treasury.proposalBondMinimum as u128).toString()
: null,
(api.consts.treasury.proposalBondMaximum as Option<u128>)?.isSome
? (api.consts.treasury.proposalBondMaximum as Option<u128>).unwrap().toString()
: null,
api.consts.treasury.proposalBond
? `${(api.consts.treasury.proposalBond as Permill).mul(BN_HUNDRED).div(BN_MILLION).toNumber().toFixed(2)}%`
: `${new BN(0).toNumber().toFixed(2)}%`
],
[api]
);
return (
<>
{isOpen && (
<Modal
className={className}
header={t('Submit treasury proposal')}
onClose={toggleOpen}
size='large'
>
<Modal.Content>
<Modal.Columns hint={t('This account will make the proposal and be responsible for the bond.')}>
<InputAddress
label={t('submit with account')}
onChange={setAccountId}
type='account'
withLabel
/>
</Modal.Columns>
<Modal.Columns hint={t('The beneficiary will receive the full amount if the proposal passes.')}>
<InputAddress
label={t('beneficiary')}
onChange={setBeneficiary}
type='allPlus'
/>
</Modal.Columns>
<Modal.Columns
hint={
<>
<p>{t('The value is the amount that is being asked for and that will be allocated to the beneficiary if the proposal is approved.')}</p>
{bondMax
? <p>{t('Of the beneficiary amount, no less than the minimum bond amount and no more than maximum on-chain bond would need to be put up as collateral. This is calculated from {{bondPercentage}} of the requested amount.', { replace: { bondPercentage } })}</p>
: <p>{t('Of the beneficiary amount, no less than the minimum bond amount would need to be put up as collateral. This is calculated from {{bondPercentage}} of the requested amount.', { replace: { bondPercentage } })}</p>
}
</>
}
>
<InputBalance
isError={!hasValue}
label={t('value')}
onChange={setValue}
/>
<Static
label={t('proposal bond')}
>
{bondPercentage}
</Static>
{bondMin && (
<InputBalance
defaultValue={bondMin}
isDisabled
label={t('minimum bond')}
/>
)}
{bondMax && (
<InputBalance
defaultValue={bondMax}
isDisabled
label={t('maximum bond')}
/>
)}
<MarkWarning content={t('Be aware that once submitted the proposal will be put to a vote. If the proposal is rejected due to a lack of info, invalid requirements or non-benefit to the network as a whole, the full bond posted (as describe above) will be lost.')} />
</Modal.Columns>
</Modal.Content>
<Modal.Actions>
<TxButton
accountId={accountId}
icon='plus'
isDisabled={!accountId || !hasValue}
label={t('Submit proposal')}
onStart={toggleOpen}
params={[value, beneficiary]}
tx={api.tx.treasury.spendLocal ?? api.tx.treasury.proposeSpend}
/>
</Modal.Actions>
</Modal>
)}
<Button
icon='plus'
label={t('Submit proposal')}
onClick={toggleOpen}
/>
</>
);
}
export default React.memo(Propose);
@@ -0,0 +1,51 @@
// Copyright 2017-2025 @pezkuwi/app-treasury authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveTreasuryProposal } from '@pezkuwi/api-derive/types';
import React, { useMemo } from 'react';
import { Table } from '@pezkuwi/react-components';
import { useTranslation } from '../translate.js';
import Proposal from './Proposal.js';
interface Props {
className?: string;
isApprovals?: boolean;
isMember: boolean;
members: string[];
proposals?: DeriveTreasuryProposal[];
}
function ProposalsBase ({ className = '', isApprovals, isMember, members, proposals }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const header = useMemo<([React.ReactNode?, string?, number?] | false)[]>(() => [
[isApprovals ? t('Approved') : t('Proposals'), 'start', 2],
[],
[t('proposer'), 'address'],
[],
[]
], [isApprovals, t]);
return (
<Table
className={className}
empty={proposals && (isApprovals ? t('No approved proposals') : t('No pending proposals'))}
header={header}
>
{proposals?.map((proposal): React.ReactNode => (
<Proposal
isMember={isMember}
key={proposal.id.toString()}
members={members}
proposal={proposal}
withSend={!isApprovals}
/>
))}
</Table>
);
}
export default React.memo(ProposalsBase);
@@ -0,0 +1,135 @@
// Copyright 2017-2025 @pezkuwi/app-treasury authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { BN } from '@pezkuwi/util';
import React, { useMemo } from 'react';
import { CardSummary, SummaryBox } from '@pezkuwi/react-components';
import { useApi, useBestNumber, useCall, useTreasury } from '@pezkuwi/react-hooks';
import { FormatBalance } from '@pezkuwi/react-query';
import { BN_THREE, BN_TWO, BN_ZERO, formatNumber } from '@pezkuwi/util';
import { useTranslation } from '../translate.js';
interface Props {
approvalCount?: number;
proposalCount?: number;
}
function Summary ({ approvalCount, proposalCount }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const bestNumber = useBestNumber();
const totalProposals = useCall<BN>(api.query.treasury.proposalCount);
const { burn, pendingBounties, pendingProposals, spendPeriod, value } = useTreasury();
const spendable = useMemo(
() => value?.sub(pendingBounties).sub(pendingProposals),
[value, pendingBounties, pendingProposals]
);
const hasSpendable = !!(value && spendable);
return (
<SummaryBox>
<section>
<CardSummary
className='media--1700'
label={t('open')}
>
{proposalCount === undefined
? <span className='--tmp'>99</span>
: formatNumber(proposalCount)}
</CardSummary>
<CardSummary
className='media--1600'
label={t('approved')}
>
{approvalCount === undefined
? <span className='--tmp'>99</span>
: formatNumber(approvalCount)}
</CardSummary>
<CardSummary
className='media--1400'
label={t('total')}
>
{totalProposals === undefined
? <span className='--tmp'>99</span>
: formatNumber(totalProposals)}
</CardSummary>
</section>
<section>
{!pendingProposals.isZero() && (
<CardSummary
className='media--1100'
label={t('approved')}
>
<FormatBalance
value={pendingProposals}
withSi
/>
</CardSummary>
)}
{!pendingBounties.isZero() && (
<CardSummary
className='media--1200'
label={t('bounties')}
>
<FormatBalance
value={pendingBounties}
withSi
/>
</CardSummary>
)}
<CardSummary
className='media--1300'
label={t('next burn')}
>
<FormatBalance
className={burn ? '' : '--tmp'}
value={burn || 1}
withSi
/>
</CardSummary>
</section>
<section>
<CardSummary
label={t('spendable / available')}
progress={{
hideValue: true,
isBlurred: !hasSpendable,
total: hasSpendable ? value : BN_THREE,
value: hasSpendable ? spendable : BN_TWO
}}
>
<span className={hasSpendable ? '' : '--tmp'}>
<FormatBalance
value={spendable || BN_TWO}
withSi
/>
<>&nbsp;/&nbsp;</>
<FormatBalance
value={value || BN_THREE}
withSi
/>
</span>
</CardSummary>
</section>
{bestNumber && spendPeriod.gt(BN_ZERO) && (
<section>
<CardSummary
label={t('spend period')}
progress={{
total: spendPeriod,
value: bestNumber.mod(spendPeriod),
withTime: true
}}
/>
</section>
)}
</SummaryBox>
);
}
export default React.memo(Summary);
@@ -0,0 +1,53 @@
// Copyright 2017-2025 @pezkuwi/app-treasury authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveTreasuryProposals } from '@pezkuwi/api-derive/types';
import React from 'react';
import { Button } from '@pezkuwi/react-components';
import { useApi, useCall } from '@pezkuwi/react-hooks';
import ProposalCreate from './ProposalCreate.js';
import Proposals from './Proposals.js';
import Summary from './Summary.js';
interface Props {
className?: string;
isMember: boolean;
members: string[];
}
function Overview ({ className, isMember, members }: Props): React.ReactElement<Props> {
const { api } = useApi();
const info = useCall<DeriveTreasuryProposals>(api.derive.treasury.proposals);
return (
<div className={className}>
<Summary
approvalCount={info?.approvals.length}
proposalCount={info?.proposals.length}
/>
{
api.tx.treasury.proposeSpend || !!api.tx.treasury.spendLocal
? <Button.Group>
<ProposalCreate />
</Button.Group>
: <></>
}
<Proposals
isMember={isMember}
members={members}
proposals={info?.proposals}
/>
<Proposals
isApprovals
isMember={isMember}
members={members}
proposals={info?.approvals}
/>
</div>
);
}
export default React.memo(Overview);