feat: Datatable UI improvements

This commit is contained in:
Ahmed Bouhuolia
2024-09-03 16:39:13 +02:00
parent 0c6f23e770
commit 1b51742c36
7 changed files with 22 additions and 16 deletions

View File

@@ -1,7 +1,8 @@
// @ts-nocheck // @ts-nocheck
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { Intent, Tag } from '@blueprintjs/core'; import { Intent, Tag, Classes } from '@blueprintjs/core';
import clsx from 'classnames';
import { If, AppToaster } from '@/components'; import { If, AppToaster } from '@/components';
import { NormalCell, BalanceCell, BankBalanceCell } from './components'; import { NormalCell, BalanceCell, BankBalanceCell } from './components';
@@ -73,7 +74,7 @@ export const useAccountsTableColumns = () => {
id: 'type', id: 'type',
Header: intl.get('type'), Header: intl.get('type'),
accessor: 'account_type_label', accessor: 'account_type_label',
className: 'type', className: clsx('type', Classes.TEXT_MUTED),
width: 140, width: 140,
clickable: true, clickable: true,
textOverview: true, textOverview: true,
@@ -91,6 +92,7 @@ export const useAccountsTableColumns = () => {
id: 'currency', id: 'currency',
Header: intl.get('currency'), Header: intl.get('currency'),
accessor: 'currency_code', accessor: 'currency_code',
className: clsx(Classes.TEXT_MUTED),
width: 75, width: 75,
clickable: true, clickable: true,
}, },

View File

@@ -1,6 +1,7 @@
// @ts-nocheck // @ts-nocheck
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import clsx from 'classnames';
import { import {
Menu, Menu,
MenuItem, MenuItem,
@@ -14,6 +15,7 @@ import {
import { Can, Icon, Money, If, AvatarCell } from '@/components'; import { Can, Icon, Money, If, AvatarCell } from '@/components';
import { CustomerAction, AbilitySubject } from '@/constants/abilityOption'; import { CustomerAction, AbilitySubject } from '@/constants/abilityOption';
import { safeCallback } from '@/utils'; import { safeCallback } from '@/utils';
import { CLASSES } from '@/constants';
/** /**
* Actions menu. * Actions menu.
@@ -140,7 +142,7 @@ export function useCustomersTableColumns() {
id: 'company_name', id: 'company_name',
Header: intl.get('company_name'), Header: intl.get('company_name'),
accessor: 'company_name', accessor: 'company_name',
className: 'company_name', className: clsx('company_name', CLASSES.TEXT_MUTED),
width: 150, width: 150,
clickable: true, clickable: true,
}, },
@@ -148,9 +150,9 @@ export function useCustomersTableColumns() {
id: 'work_phone', id: 'work_phone',
Header: intl.get('phone_number'), Header: intl.get('phone_number'),
accessor: PhoneNumberAccessor, accessor: PhoneNumberAccessor,
className: 'phone_number',
width: 100, width: 100,
clickable: true, clickable: true,
className: clsx('phone_number', CLASSES.TEXT_MUTED)
}, },
{ {
id: 'note', id: 'note',
@@ -159,6 +161,7 @@ export function useCustomersTableColumns() {
disableSortBy: true, disableSortBy: true,
width: 85, width: 85,
clickable: true, clickable: true,
className: clsx(CLASSES.TEXT_MUTED)
}, },
{ {
id: 'balance', id: 'balance',

View File

@@ -140,7 +140,6 @@ export function useExpensesTableColumns() {
id: 'amount', id: 'amount',
Header: intl.get('full_amount'), Header: intl.get('full_amount'),
accessor: 'formatted_amount', accessor: 'formatted_amount',
className: 'amount',
align: 'right', align: 'right',
width: 150, width: 150,
clickable: true, clickable: true,
@@ -150,16 +149,15 @@ export function useExpensesTableColumns() {
id: 'payment_account', id: 'payment_account',
Header: intl.get('payment_account'), Header: intl.get('payment_account'),
accessor: 'payment_account.name', accessor: 'payment_account.name',
className: 'payment_account',
width: 150, width: 150,
clickable: true, clickable: true,
className: clsx(CLASSES.TEXT_MUTED),
}, },
{ {
id: 'expense_account', id: 'expense_account',
Header: intl.get('expense_account'), Header: intl.get('expense_account'),
accessor: ExpenseAccountAccessor, accessor: ExpenseAccountAccessor,
width: 160, width: 160,
className: 'expense_account',
disableSortBy: true, disableSortBy: true,
clickable: true, clickable: true,
}, },

View File

@@ -1,6 +1,7 @@
// @ts-nocheck // @ts-nocheck
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import clsx from 'classnames';
import { isNumber } from 'lodash'; import { isNumber } from 'lodash';
import { import {
Menu, Menu,
@@ -11,6 +12,7 @@ import {
Position, Position,
Button, Button,
Popover, Popover,
Classes,
} from '@blueprintjs/core'; } from '@blueprintjs/core';
import { FormattedMessage as T, Icon, Money, If, Can } from '@/components'; import { FormattedMessage as T, Icon, Money, If, Can } from '@/components';
import { isBlank, safeCallback } from '@/utils'; import { isBlank, safeCallback } from '@/utils';
@@ -182,7 +184,7 @@ export const useItemsTableColumns = () => {
id: 'code', id: 'code',
Header: intl.get('item_code'), Header: intl.get('item_code'),
accessor: 'code', accessor: 'code',
className: 'code', className: clsx(Classes.TEXT_MUTED),
width: 120, width: 120,
clickable: true, clickable: true,
}, },
@@ -198,7 +200,7 @@ export const useItemsTableColumns = () => {
id: 'category', id: 'category',
Header: intl.get('category'), Header: intl.get('category'),
accessor: 'category.name', accessor: 'category.name',
className: 'category', className: clsx(Classes.TEXT_MUTED),
width: 150, width: 150,
clickable: true, clickable: true,
textOverview: true, textOverview: true,

View File

@@ -229,7 +229,6 @@ export function useInvoicesTableColumns() {
Header: intl.get('invoice_no__'), Header: intl.get('invoice_no__'),
accessor: 'invoice_no', accessor: 'invoice_no',
width: 100, width: 100,
className: 'invoice_no',
clickable: true, clickable: true,
textOverview: true, textOverview: true,
}, },
@@ -266,7 +265,6 @@ export function useInvoicesTableColumns() {
Header: intl.get('reference_no'), Header: intl.get('reference_no'),
accessor: 'reference_no', accessor: 'reference_no',
width: 90, width: 90,
className: 'reference_no',
clickable: true, clickable: true,
textOverview: true, textOverview: true,
}, },

View File

@@ -12,6 +12,7 @@ import {
Intent, Intent,
Classes, Classes,
} from '@blueprintjs/core'; } from '@blueprintjs/core';
import clsx from 'classnames';
import { Can, Icon, Money, If, AvatarCell } from '@/components'; import { Can, Icon, Money, If, AvatarCell } from '@/components';
import { VendorAction, AbilitySubject } from '@/constants/abilityOption'; import { VendorAction, AbilitySubject } from '@/constants/abilityOption';
@@ -163,7 +164,7 @@ export function useVendorsTableColumns() {
id: 'company_name', id: 'company_name',
Header: intl.get('company_name'), Header: intl.get('company_name'),
accessor: 'company_name', accessor: 'company_name',
className: 'company_name', className: clsx(Classes.TEXT_MUTED),
width: 150, width: 150,
clickable: true, clickable: true,
}, },
@@ -171,7 +172,7 @@ export function useVendorsTableColumns() {
id: 'work_phone', id: 'work_phone',
Header: intl.get('phone_number'), Header: intl.get('phone_number'),
accessor: PhoneNumberAccessor, accessor: PhoneNumberAccessor,
className: 'work_phone', className: clsx(Classes.TEXT_MUTED),
width: 100, width: 100,
clickable: true, clickable: true,
}, },
@@ -180,6 +181,7 @@ export function useVendorsTableColumns() {
Header: intl.get('note'), Header: intl.get('note'),
accessor: NoteAccessor, accessor: NoteAccessor,
disableSortBy: true, disableSortBy: true,
className: clsx(Classes.TEXT_MUTED),
width: 85, width: 85,
clickable: true, clickable: true,
}, },

View File

@@ -8,6 +8,7 @@
border-spacing: 0; border-spacing: 0;
min-width: 100%; min-width: 100%;
display: block; display: block;
color: #101219;
.thead .thead-inner, .thead .thead-inner,
.tbody .tbody-inner { .tbody .tbody-inner {
@@ -21,7 +22,7 @@
padding: 0.68rem 0.5rem; padding: 0.68rem 0.5rem;
background: #f5f5f5; background: #f5f5f5;
font-size: 14px; font-size: 14px;
color: #4E5B6F; color: #424853;
font-weight: 400; font-weight: 400;
border-bottom: 1px solid #d2dde2; border-bottom: 1px solid #d2dde2;
@@ -180,9 +181,9 @@
} }
.tr .td { .tr .td {
border-bottom: 1px solid #e0e0e0; border-bottom: 1px solid #ececec;
align-items: center; align-items: center;
color: #101219;
.placeholder { .placeholder {
color: #a0a0a0; color: #a0a0a0;