mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-06-13 05:51:03 +00:00
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:
@@ -0,0 +1,38 @@
|
||||
// Copyright 2017-2025 @pezkuwi/react-hooks authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
import type { Vec } from '@pezkuwi/types';
|
||||
import type { PalletBrokerScheduleItem } from '@pezkuwi/types/lookup';
|
||||
import type { Reservation } from './types.js';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { createNamedHook, useCall } from '@pezkuwi/react-hooks';
|
||||
|
||||
import { processHexMask } from './utils/dataProcessing.js';
|
||||
|
||||
function useBrokerReservationsImpl (api: ApiPromise, ready: boolean): Reservation[] | undefined {
|
||||
const reservations = useCall<[any, Vec<Vec<PalletBrokerScheduleItem>>[]]>(ready && api?.query.broker.reservations);
|
||||
const [state, setState] = useState<Reservation[]>();
|
||||
|
||||
useEffect((): void => {
|
||||
if (!reservations) {
|
||||
return;
|
||||
}
|
||||
|
||||
setState(
|
||||
reservations.map((info: PalletBrokerScheduleItem[]) => {
|
||||
return {
|
||||
mask: processHexMask(info[0]?.mask),
|
||||
maskBits: processHexMask(info[0]?.mask)?.length ?? 0,
|
||||
task: info[0]?.assignment?.isTask ? info[0]?.assignment?.asTask.toString() : info[0]?.assignment?.isPool ? 'Pool' : ''
|
||||
};
|
||||
}
|
||||
));
|
||||
}, [reservations]);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
export const useBrokerReservations = createNamedHook('useBrokerReservations', useBrokerReservationsImpl);
|
||||
Reference in New Issue
Block a user