Files
explore/ui/hotContracts/HotContractsIntervalSelect.tsx
2ff074ee3b Release v2.6.1 (#3247)
* essential dapps config: switch to concurrent request and and add worker termination

* fix rollbar error logging and enable it for server errors

* fix for tokens request on address page

* update generator script for multichain config

* fix hot contracts interval select

* update screenshot

* update screenshots

* pass chainId to trackTransaction for essential dapps

* fix vertical alignment in hot contracts table

* bump next.js to v15.5.10

---------

Co-authored-by: isstuev <[email protected]>
Co-authored-by: Max Alekseenko <[email protected]>
2026-02-03 18:05:00 +01:00

65 lines
1.8 KiB
TypeScript

import { createListCollection } from '@chakra-ui/react';
import React from 'react';
import type { HotContractsInterval } from 'types/api/contracts';
import useIsInitialLoading from 'lib/hooks/useIsInitialLoading';
import type { SelectOption } from 'toolkit/chakra/select';
import { Select } from 'toolkit/chakra/select';
import TagGroupSelect from 'ui/shared/tagGroupSelect/TagGroupSelect';
import { INTERVAL_ITEMS } from './utils';
const intervalCollection = createListCollection<SelectOption<string>>({
items: INTERVAL_ITEMS.map((item) => ({
value: item.id,
label: item.labelFull,
})),
});
const intervalItems = INTERVAL_ITEMS.map((item) => ({
id: item.id,
title: item.labelShort,
}));
interface Props {
interval: HotContractsInterval;
onIntervalChange: (newInterval: HotContractsInterval) => void;
isLoading?: boolean;
};
const HotContractsIntervalSelect = ({ interval, onIntervalChange, isLoading }: Props) => {
const isInitialLoading = useIsInitialLoading(isLoading);
const handleItemSelect = React.useCallback(({ value }: { value: Array<string> }) => {
onIntervalChange(value[0] as HotContractsInterval);
}, [ onIntervalChange ]);
return (
<>
<TagGroupSelect<HotContractsInterval>
items={ intervalItems }
onChange={ onIntervalChange }
value={ interval }
tagSize="lg"
loading={ isInitialLoading }
disabled={ isLoading }
hideBelow="lg"
/>
<Select
collection={ intervalCollection }
placeholder="Select interval"
value={ [ interval ] }
onValueChange={ handleItemSelect }
hideFrom="lg"
w="100%"
loading={ isInitialLoading }
disabled={ isLoading }
/>
</>
);
};
export default React.memo(HotContractsIntervalSelect);