From 4ef00ab12226f1af421f445c3b212b2558066ade Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Wed, 4 Sep 2024 09:51:35 +0200 Subject: [PATCH] feat: Bank pages layout breaking --- .../AccountTransactionsActionsBar.tsx | 92 ++++++++++++++----- .../AccountTransactionsDetailsBar.tsx | 15 ++- packages/webapp/src/hooks/useMediaQuery.ts | 63 +++++++++++++ 3 files changed, 142 insertions(+), 28 deletions(-) create mode 100644 packages/webapp/src/hooks/useMediaQuery.ts diff --git a/packages/webapp/src/containers/CashFlow/AccountTransactions/AccountTransactionsActionsBar.tsx b/packages/webapp/src/containers/CashFlow/AccountTransactions/AccountTransactionsActionsBar.tsx index d8d7df5d6..c4151505d 100644 --- a/packages/webapp/src/containers/CashFlow/AccountTransactions/AccountTransactionsActionsBar.tsx +++ b/packages/webapp/src/containers/CashFlow/AccountTransactions/AccountTransactionsActionsBar.tsx @@ -34,21 +34,23 @@ import { } from '@/constants/cashflowOptions'; import { useRefreshCashflowTransactions } from '@/hooks/query'; import { useAccountTransactionsContext } from './AccountTransactionsProvider'; +import { useMediaQuery } from '@/hooks/useMediaQuery'; +import { useAppShellContext } from '@/components/AppShell/AppContentShell/AppContentShellProvider'; import withDialogActions from '@/containers/Dialog/withDialogActions'; import withSettings from '@/containers/Settings/withSettings'; import withSettingsActions from '@/containers/Settings/withSettingsActions'; - -import { compose } from '@/utils'; +import { withBankingActions } from '../withBankingActions'; +import { withBanking } from '../withBanking'; +import withAlertActions from '@/containers/Alert/withAlertActions'; import { useUpdateBankAccount, useExcludeUncategorizedTransactions, useUnexcludeUncategorizedTransactions, } from '@/hooks/query/bank-rules'; -import { withBankingActions } from '../withBankingActions'; -import { withBanking } from '../withBanking'; -import withAlertActions from '@/containers/Alert/withAlertActions'; + import { DialogsName } from '@/constants/dialogs'; +import { compose } from '@/utils'; function AccountTransactionsActionsBar({ // #withDialogActions @@ -221,6 +223,13 @@ function AccountTransactionsActionsBar({ }); }; + const { hideAside } = useAppShellContext(); + const isMin1350Query = useMediaQuery('(min-width: 1350px)'); + + // Shrink actions to dropdown if the aside is open and matched the media query, + // To avoid actions overflow in small screens. + const shrinkActions = !hideAside && !isMin1350Query; + return ( @@ -241,23 +250,27 @@ function AccountTransactionsActionsBar({ }} /> -