mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
refactoring(*): paper drawer.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import React, { lazy } from 'react';
|
import React, { lazy } from 'react';
|
||||||
import { Drawer, DrawerSuspense } from 'components';
|
import { Drawer, DrawerSuspense } from 'components';
|
||||||
import withDrawers from 'containers/Drawer/withDrawers';
|
import withDrawers from 'containers/Drawer/withDrawers';
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -15,15 +14,9 @@ function EstimateDrawer({
|
|||||||
//#withDrawer
|
//#withDrawer
|
||||||
isOpen,
|
isOpen,
|
||||||
payload: { estimateId },
|
payload: { estimateId },
|
||||||
|
|
||||||
closeDrawer,
|
|
||||||
}) {
|
}) {
|
||||||
// handle close Drawer
|
|
||||||
const handleDrawerClose = () => {
|
|
||||||
closeDrawer(name);
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<Drawer isOpen={isOpen} isClose={handleDrawerClose}>
|
<Drawer isOpen={isOpen} name={name}>
|
||||||
<DrawerSuspense>
|
<DrawerSuspense>
|
||||||
<EstimateDrawerContent estimateId={estimateId} />
|
<EstimateDrawerContent estimateId={estimateId} />
|
||||||
</DrawerSuspense>
|
</DrawerSuspense>
|
||||||
@@ -31,4 +24,4 @@ function EstimateDrawer({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(withDrawers(), withDrawerActions)(EstimateDrawer);
|
export default compose(withDrawers())(EstimateDrawer);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { createContext } from 'react';
|
import React, { createContext } from 'react';
|
||||||
import { useEstimate } from 'hooks/query';
|
import { useEstimate } from 'hooks/query';
|
||||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
import { DrawerHeaderContent, DashboardInsider } from 'components';
|
||||||
|
|
||||||
const EstimateDrawerContext = createContext();
|
const EstimateDrawerContext = createContext();
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ function EstimateDrawerProvider({ estimateId, ...props }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardInsider loading={isEstimateLoading}>
|
<DashboardInsider loading={isEstimateLoading}>
|
||||||
|
<DrawerHeaderContent name={'estimate-drawer'} />
|
||||||
<EstimateDrawerContext.Provider value={provider} {...props} />
|
<EstimateDrawerContext.Provider value={provider} {...props} />
|
||||||
</DashboardInsider>
|
</DashboardInsider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React, { lazy } from 'react';
|
import React, { lazy } from 'react';
|
||||||
import withDrawers from 'containers/Drawer/withDrawers';
|
import withDrawers from 'containers/Drawer/withDrawers';
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
|
||||||
|
|
||||||
import { Drawer, DrawerSuspense } from 'components';
|
import { Drawer, DrawerSuspense } from 'components';
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
@@ -16,15 +15,10 @@ function InvoiceDrawer({
|
|||||||
isOpen,
|
isOpen,
|
||||||
payload: { invoiceId },
|
payload: { invoiceId },
|
||||||
|
|
||||||
closeDrawer,
|
|
||||||
}) {
|
}) {
|
||||||
// handle close Drawer
|
|
||||||
const handleDrawerClose = () => {
|
|
||||||
closeDrawer(name);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer isOpen={isOpen} isClose={handleDrawerClose}>
|
<Drawer isOpen={isOpen} name={name}>
|
||||||
<DrawerSuspense>
|
<DrawerSuspense>
|
||||||
<InvoicesDrawerContent invoiceId={invoiceId} />
|
<InvoicesDrawerContent invoiceId={invoiceId} />
|
||||||
</DrawerSuspense>
|
</DrawerSuspense>
|
||||||
@@ -32,4 +26,4 @@ function InvoiceDrawer({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(withDrawers(), withDrawerActions)(InvoiceDrawer);
|
export default compose(withDrawers())(InvoiceDrawer);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { createContext, useContext } from 'react';
|
import React, { createContext, useContext } from 'react';
|
||||||
import { useInvoice } from 'hooks/query';
|
import { useInvoice } from 'hooks/query';
|
||||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
import { DrawerHeaderContent, DashboardInsider } from 'components';
|
||||||
|
|
||||||
const InvoiceDrawerContext = createContext();
|
const InvoiceDrawerContext = createContext();
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ function InvoiceDrawerProvider({ invoiceId, ...props }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardInsider loading={isInvoiceLoading}>
|
<DashboardInsider loading={isInvoiceLoading}>
|
||||||
|
<DrawerHeaderContent name={'invoice-drawer'} />
|
||||||
<InvoiceDrawerContext.Provider value={provider} {...props} />
|
<InvoiceDrawerContext.Provider value={provider} {...props} />
|
||||||
</DashboardInsider>
|
</DashboardInsider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React, { lazy } from 'react';
|
import React, { lazy } from 'react';
|
||||||
import withDrawers from 'containers/Drawer/withDrawers';
|
import withDrawers from 'containers/Drawer/withDrawers';
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
|
||||||
import { Drawer, DrawerSuspense } from 'components';
|
import { Drawer, DrawerSuspense } from 'components';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
@@ -18,15 +17,10 @@ function PaymentReceiveDrawer({
|
|||||||
isOpen,
|
isOpen,
|
||||||
payload: { paymentReceiveId },
|
payload: { paymentReceiveId },
|
||||||
|
|
||||||
closeDrawer,
|
|
||||||
}) {
|
}) {
|
||||||
// handle close Drawer
|
|
||||||
const handleDrawerClose = () => {
|
|
||||||
closeDrawer(name);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer isOpen={isOpen} isClose={handleDrawerClose}>
|
<Drawer isOpen={isOpen} name={name}>
|
||||||
<DrawerSuspense>
|
<DrawerSuspense>
|
||||||
<PaymentReceiveDrawerContent paymentReceiveId={paymentReceiveId} />
|
<PaymentReceiveDrawerContent paymentReceiveId={paymentReceiveId} />
|
||||||
</DrawerSuspense>
|
</DrawerSuspense>
|
||||||
@@ -34,4 +28,4 @@ function PaymentReceiveDrawer({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(withDrawers(), withDrawerActions)(PaymentReceiveDrawer);
|
export default compose(withDrawers())(PaymentReceiveDrawer);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { createContext, useContext } from 'react';
|
import React, { createContext, useContext } from 'react';
|
||||||
import { usePaymentReceive } from 'hooks/query';
|
import { usePaymentReceive } from 'hooks/query';
|
||||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
import { DrawerHeaderContent, DashboardInsider } from 'components';
|
||||||
|
|
||||||
const PaymentReceiveDrawerContext = createContext();
|
const PaymentReceiveDrawerContext = createContext();
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@ function PaymentReceiveDrawerProvider({ paymentReceiveId, ...props }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardInsider loading={isPaymentReceiveLoading}>
|
<DashboardInsider loading={isPaymentReceiveLoading}>
|
||||||
|
<DrawerHeaderContent name={'payment-receive-drawer'} />
|
||||||
<PaymentReceiveDrawerContext.Provider value={provider} {...props} />
|
<PaymentReceiveDrawerContext.Provider value={provider} {...props} />
|
||||||
</DashboardInsider>
|
</DashboardInsider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React, { lazy } from 'react';
|
import React, { lazy } from 'react';
|
||||||
import withDrawers from 'containers/Drawer/withDrawers';
|
import withDrawers from 'containers/Drawer/withDrawers';
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
|
||||||
|
|
||||||
import { Drawer, DrawerSuspense } from 'components';
|
import { Drawer, DrawerSuspense } from 'components';
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
@@ -15,17 +14,10 @@ const ReceiptDrawer = ({
|
|||||||
//#withDrawer
|
//#withDrawer
|
||||||
isOpen,
|
isOpen,
|
||||||
payload: { receiptId },
|
payload: { receiptId },
|
||||||
|
|
||||||
closeDrawer,
|
|
||||||
}) => {
|
}) => {
|
||||||
// handle close Drawer
|
|
||||||
const handleDrawerClose = () => {
|
|
||||||
closeDrawer(name);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Drawer isOpen={isOpen} isClose={handleDrawerClose}>
|
<Drawer isOpen={isOpen} name={name}>
|
||||||
<DrawerSuspense>
|
<DrawerSuspense>
|
||||||
<ReceiptDrawerContent receiptId={receiptId} />
|
<ReceiptDrawerContent receiptId={receiptId} />
|
||||||
</DrawerSuspense>
|
</DrawerSuspense>
|
||||||
@@ -34,4 +26,4 @@ const ReceiptDrawer = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default compose(withDrawers(), withDrawerActions)(ReceiptDrawer);
|
export default compose(withDrawers())(ReceiptDrawer);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { createContext, useContext } from 'react';
|
import React, { createContext, useContext } from 'react';
|
||||||
import { useReceipt } from 'hooks/query';
|
import { useReceipt } from 'hooks/query';
|
||||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
import { DrawerHeaderContent, DashboardInsider } from 'components';
|
||||||
|
|
||||||
const ReceiptDrawerContext = createContext();
|
const ReceiptDrawerContext = createContext();
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@ function ReceiptDrawerProvider({ receiptId, ...props }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardInsider loading={isReceiptLoading}>
|
<DashboardInsider loading={isReceiptLoading}>
|
||||||
|
<DrawerHeaderContent name={'receipt-drawer'} />
|
||||||
<ReceiptDrawerContext.Provider value={provider} {...props} />
|
<ReceiptDrawerContext.Provider value={provider} {...props} />
|
||||||
</DashboardInsider>
|
</DashboardInsider>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user