BIG-5: add switching between compact and medium row size.

This commit is contained in:
elforjani13
2021-09-23 15:39:49 +02:00
parent cd70bf1d80
commit 460ee2718e
10 changed files with 262 additions and 9 deletions

View File

@@ -14,6 +14,7 @@ import {
DashboardFilterButton,
AdvancedFilterPopover,
FormattedMessage as T,
DashboardRowsHeightButton,
} from 'components';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
@@ -23,6 +24,9 @@ import { If, DashboardActionViewsList } from 'components';
import withPaymentReceivesActions from './withPaymentReceivesActions';
import withPaymentReceives from './withPaymentReceives';
import withSettingsActions from 'containers/Settings/withSettingsActions';
import withSettings from 'containers/Settings/withSettings';
import { compose } from 'utils';
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
import { useRefreshPaymentReceive } from 'hooks/query/paymentReceives';
@@ -35,7 +39,13 @@ function PaymentReceiveActionsBar({
setPaymentReceivesTableState,
// #withPaymentReceives
paymentFilterConditions
paymentFilterConditions,
// #withSettings
paymentReceivesTableSize,
// #withSettingsActions
addSetting,
}) {
// History context.
const history = useHistory();
@@ -61,6 +71,11 @@ function PaymentReceiveActionsBar({
refresh();
};
// Handle table row size change.
const handleTableRowSizeChange = (size) => {
addSetting('payment_receive', 'tableSize', size);
};
return (
<DashboardActionsBar>
<NavbarGroup>
@@ -115,6 +130,13 @@ function PaymentReceiveActionsBar({
icon={<Icon icon={'file-export-16'} iconSize={'16'} />}
text={<T id={'export'} />}
/>
<NavbarDivider />
<DashboardRowsHeightButton
initialValue={paymentReceivesTableSize}
onChange={handleTableRowSizeChange}
/>
<NavbarDivider />
</NavbarGroup>
<NavbarGroup align={Alignment.RIGHT}>
<Button
@@ -129,8 +151,12 @@ function PaymentReceiveActionsBar({
export default compose(
withPaymentReceivesActions,
withSettingsActions,
withPaymentReceives(({ paymentReceivesTableState }) => ({
paymentReceivesTableState,
paymentFilterConditions: paymentReceivesTableState.filterRoles,
})),
withSettings(({ paymentReceiveSettings }) => ({
paymentReceivesTableSize: paymentReceiveSettings?.tableSize,
})),
)(PaymentReceiveActionsBar);