// @ts-nocheck import React from 'react'; import intl from 'react-intl-universal'; import styled from 'styled-components'; import { Intent } from '@blueprintjs/core'; import { useTransactionsLockingContext } from './TransactionsLockingProvider'; import { ButtonLink, AppToaster, Join, FormattedMessage as T, Alert, AlertDesc, } from '@/components'; import { validateMoveToFullLocking, validateMoveToPartialLocking, } from './utils'; /** * Transactions locking header. * @returns */ export function TransactionsLockingHeader() { const { transactionsLocking, transactionLockingType, setTransactionLockingType, } = useTransactionsLockingContext(); // Handle all lock link click. const handleAllLockClick = () => { const activeModules = validateMoveToFullLocking( transactionsLocking.modules, ); const modulesStrong = activeModules.map((module) => ( {module.formatted_module} )); if (activeModules.length > 0) { AppToaster.show({ message: ( You should unlock modules first, than you can lock all transactions at once. ), intent: Intent.DANGER, }); } else { setTransactionLockingType('all'); } }; const handleUndividualLockClick = () => { const isAllLockingActive = validateMoveToPartialLocking( transactionsLocking.all, ); if (isAllLockingActive) { AppToaster.show({ message: intl.get( 'transactions_locking.you_should_unlock_all_transactions_at_once_before', ), intent: Intent.DANGER, }); } else { setTransactionLockingType('partial'); } }; return transactionLockingType !== 'all' ? ( } intent={Intent.PRIMARY} >

) : ( } intent={Intent.PRIMARY} >

); } const LockAllAlert = styled(Alert)` margin-bottom: 0; margin-top: 20px; background: transparent; ${AlertDesc} { color: #1f3255; } `;