BiG-5: Complete, add switch small and medium table row size.

This commit is contained in:
elforjani13
2021-09-26 21:02:53 +02:00
parent fcace4213c
commit 71f9fa47d4
45 changed files with 337 additions and 196 deletions

View File

@@ -1,4 +1,5 @@
import { AppToaster } from 'components';
import { Intent } from '@blueprintjs/core';
import moment from 'moment';
import intl from 'react-intl-universal';
import * as R from 'ramda';
@@ -6,11 +7,13 @@ import {
defaultFastFieldShouldUpdate,
transformToForm,
repeatValue,
ensureEntriesHasEmptyLine
ensureEntriesHasEmptyLine,
} from 'utils';
const ERROR = {
EXPENSE_ALREADY_PUBLISHED: 'EXPENSE.ALREADY.PUBLISHED',
ENTRIES_ALLOCATED_COST_COULD_NOT_DELETED:
'ENTRIES_ALLOCATED_COST_COULD_NOT_DELETED',
};
// Transform API errors in toasts messages.
@@ -24,6 +27,14 @@ export const transformErrors = (errors, { setErrors }) => {
}),
);
}
if (hasError(ERROR.ENTRIES_ALLOCATED_COST_COULD_NOT_DELETED)) {
setErrors(
AppToaster.show({
intent: Intent.DANGER,
message: 'ENTRIES_ALLOCATED_COST_COULD_NOT_DELETED',
}),
);
}
};
export const MIN_LINES_NUMBER = 4;

View File

@@ -80,7 +80,7 @@ function ExpensesActionsBar({
// Handle table row size change.
const handleTableRowSizeChange = (size) => {
addSetting('expense', 'tableSize', size);
addSetting('expenses', 'tableSize', size);
};
return (
<DashboardActionsBar>

View File

@@ -16,6 +16,7 @@ import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withExpensesActions from './withExpensesActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import withSettings from '../../Settings/withSettings';
import { ActionsMenu, useExpensesTableColumns } from './components';
@@ -31,6 +32,9 @@ function ExpensesDataTable({
// #withAlertsActions
openAlert,
// #withSettings
expensesTableSize,
}) {
// Expenses list context.
const {
@@ -119,6 +123,7 @@ function ExpensesDataTable({
onCellClick={handleCellClick}
initialColumnsWidths={initialColumnsWidths}
onColumnResizing={handleColumnResizing}
size={expensesTableSize}
payload={{
onPublish: handlePublishExpense,
onDelete: handleDeleteExpense,
@@ -135,4 +140,7 @@ export default compose(
withAlertsActions,
withDrawerActions,
withExpensesActions,
withSettings(({ expenseSettings }) => ({
expensesTableSize: expenseSettings?.tableSize,
})),
)(ExpensesDataTable);