mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
fix(account drawer): acconut drawer.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { useAccount, useAccountTransactions } from 'hooks/query';
|
||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
||||
import { DrawerHeaderContent, DashboardInsider } from 'components';
|
||||
|
||||
const AccountDrawerContext = React.createContext();
|
||||
|
||||
@@ -20,6 +20,7 @@ function AccountDrawerProvider({ accountId, ...props }) {
|
||||
} = useAccountTransactions(accountId, {
|
||||
enabled: !!accountId,
|
||||
});
|
||||
const name = `${account.name} ${account.code}`;
|
||||
|
||||
// provider.
|
||||
const provider = {
|
||||
@@ -30,6 +31,7 @@ function AccountDrawerProvider({ accountId, ...props }) {
|
||||
|
||||
return (
|
||||
<DashboardInsider loading={isAccountLoading || isAccountsLoading}>
|
||||
<DrawerHeaderContent name={'account-drawer'} title={name} />
|
||||
<AccountDrawerContext.Provider value={provider} {...props} />
|
||||
</DashboardInsider>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, { lazy } from 'react';
|
||||
import { Drawer, DrawerSuspense } from 'components';
|
||||
import withDrawers from 'containers/Drawer/withDrawers';
|
||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
@@ -14,17 +13,11 @@ function AccountDrawer({
|
||||
name,
|
||||
//#withDrawer
|
||||
isOpen,
|
||||
payload: { accountId, title },
|
||||
|
||||
closeDrawer,
|
||||
payload: { accountId },
|
||||
}) {
|
||||
// Handle close drawer.
|
||||
const handleDrawerClose = () => {
|
||||
closeDrawer(name);
|
||||
};
|
||||
|
||||
return (
|
||||
<Drawer isOpen={isOpen} title={title} isClose={handleDrawerClose}>
|
||||
<Drawer isOpen={isOpen} name={name}>
|
||||
<DrawerSuspense>
|
||||
<AccountDrawerContent accountId={accountId} />
|
||||
</DrawerSuspense>
|
||||
@@ -32,4 +25,4 @@ function AccountDrawer({
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDrawers(), withDrawerActions)(AccountDrawer);
|
||||
export default compose(withDrawers())(AccountDrawer);
|
||||
|
||||
Reference in New Issue
Block a user