diff --git a/src/components/Utils/Join.js b/src/components/Utils/Join.js new file mode 100644 index 000000000..a2314599e --- /dev/null +++ b/src/components/Utils/Join.js @@ -0,0 +1,13 @@ +import React from 'react'; + +export function Join({ items, sep }) { + return items.length > 0 + ? items.reduce((result, item) => ( + <> + {result} + {sep} + {item} + > + )) + : null; +} diff --git a/src/components/Utils/index.js b/src/components/Utils/index.js index f1104e044..5be485ebc 100644 --- a/src/components/Utils/index.js +++ b/src/components/Utils/index.js @@ -1,4 +1,5 @@ export * from './FormatNumber'; -export * from './FormatDate'; \ No newline at end of file +export * from './FormatDate'; +export * from './Join'; \ No newline at end of file diff --git a/src/components/index.js b/src/components/index.js index f30398145..068947018 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -87,6 +87,7 @@ export * from './Button'; export * from './IntersectionObserver'; export * from './SMSPreview'; export * from './Contacts'; +export * from './Utils/Join'; const Hint = FieldHint; diff --git a/src/containers/TransactionsLocking/TransactionsLockingList.js b/src/containers/TransactionsLocking/TransactionsLockingList.js index 23de5ebc4..c04054500 100644 --- a/src/containers/TransactionsLocking/TransactionsLockingList.js +++ b/src/containers/TransactionsLocking/TransactionsLockingList.js @@ -4,7 +4,7 @@ import { Intent } from '@blueprintjs/core'; import styled from 'styled-components'; import * as R from 'ramda'; -import { Alert, ButtonLink } from 'components'; +import { Alert, ButtonLink, AppToaster, Join } from 'components'; import { TransactionsLockingProvider } from './TransactionsLockingProvider'; import { TransactionLockingContent, @@ -12,6 +12,10 @@ import { } from './components'; import { useTransactionsLockingContext } from './TransactionsLockingProvider'; import withDialogActions from 'containers/Dialog/withDialogActions'; +import { + validateMoveToFullLocking, + validateMoveToPartialLocking, +} from './utils'; function Paragraph({ className, children }) { return
{children}
; @@ -59,16 +63,49 @@ function TransactionLockingSkeletonList() { } function TransactionsLockingAlert() { - const { transactionLockingType, setTransactionLockingType } = - useTransactionsLockingContext(); + const { + transactionsLocking, + transactionLockingType, + setTransactionLockingType, + } = useTransactionsLockingContext(); // Handle all lock link click. const handleAllLockClick = () => { - setTransactionLockingType('all'); + const activeModules = validateMoveToFullLocking( + transactionsLocking.modules, + ); + const modulesStrong = activeModules.map((module) => ( + {module.formatted_module} + )); + if (activeModules.length > 0) { + AppToaster.show({ + message: ( + + You should unlock