mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
re-structure to monorepo.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import { DrawerHeaderContent, DashboardInsider } from '@/components';
|
||||
import { useContact } from '@/hooks/query';
|
||||
|
||||
const ContactDetailDrawerContext = React.createContext();
|
||||
|
||||
/**
|
||||
* Contact detail provider.
|
||||
*/
|
||||
function ContactDetailDrawerProvider({ contactId, ...props }) {
|
||||
// Handle fetch contact duplicate details.
|
||||
const { data: contact, isLoading: isContactLoading } = useContact(contactId, {
|
||||
enabled: !!contactId,
|
||||
});
|
||||
//provider.
|
||||
const provider = {
|
||||
contact,
|
||||
contactId,
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardInsider loading={isContactLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="contact-detail-drawer"
|
||||
title={contact?.display_name}
|
||||
/>
|
||||
|
||||
<ContactDetailDrawerContext.Provider value={provider} {...props} />
|
||||
</DashboardInsider>
|
||||
);
|
||||
}
|
||||
|
||||
const useContactDetailDrawerContext = () =>
|
||||
React.useContext(ContactDetailDrawerContext);
|
||||
|
||||
export { ContactDetailDrawerProvider, useContactDetailDrawerContext };
|
||||
Reference in New Issue
Block a user