mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
// @ts-nocheck
|
|
import React from 'react';
|
|
import classNames from 'classnames';
|
|
import styled from 'styled-components';
|
|
import { CLASSES } from '@/constants/classes';
|
|
import { useSettings } from '@/hooks/query';
|
|
import PreferencesPageLoader from '../PreferencesPageLoader';
|
|
import { Card } from '@/components';
|
|
|
|
const PreferencesInvoiceFormContext = React.createContext();
|
|
|
|
function PreferencesInvoicesBoot({ ...props }) {
|
|
// Fetches organization settings.
|
|
const { isLoading: isSettingsLoading } = useSettings();
|
|
|
|
// Provider state.
|
|
const provider = {
|
|
isSettingsLoading
|
|
};
|
|
|
|
// Detarmines whether if any query is loading.
|
|
const isLoading = isSettingsLoading;
|
|
|
|
return (
|
|
<div
|
|
className={classNames(
|
|
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT,
|
|
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT,
|
|
)}
|
|
>
|
|
<PreferencesInvoicesCard>
|
|
{isLoading ? (
|
|
<PreferencesPageLoader />
|
|
) : (
|
|
<PreferencesInvoiceFormContext.Provider value={provider} {...props} />
|
|
)}
|
|
</PreferencesInvoicesCard>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const PreferencesInvoicesCard = styled(Card)`
|
|
padding: 25px;
|
|
|
|
.bp4-form-group{
|
|
max-width: 600px;
|
|
}
|
|
`;
|
|
|
|
const usePreferencesInvoiceFormContext = () =>
|
|
React.useContext(PreferencesInvoiceFormContext);
|
|
|
|
export { PreferencesInvoicesBoot, usePreferencesInvoiceFormContext };
|