mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
// @ts-nocheck
|
|
import React from 'react';
|
|
import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
|
|
|
import { DashboardViewsTabs } from '@/components';
|
|
|
|
import { withEstimatesActions } from './withEstimatesActions';
|
|
import { withEstimates } from './withEstimates';
|
|
|
|
import { useEstimatesListContext } from './EstimatesListProvider';
|
|
import { compose, transfromViewsToTabs } from '@/utils';
|
|
|
|
/**
|
|
* Estimates views tabs.
|
|
*/
|
|
function EstimateViewTabs({
|
|
// #withEstimatesActions
|
|
setEstimatesTableState,
|
|
|
|
// #withEstimates
|
|
estimatesCurrentView,
|
|
}) {
|
|
// Estimates list context.
|
|
const { estimatesViews } = useEstimatesListContext();
|
|
|
|
// Estimates views.
|
|
const tabs = transfromViewsToTabs(estimatesViews);
|
|
|
|
// Handle tab change.
|
|
const handleTabsChange = (viewSlug) => {
|
|
setEstimatesTableState({ viewSlug: viewSlug || null });
|
|
};
|
|
|
|
return (
|
|
<Navbar className={'navbar--dashboard-views'}>
|
|
<NavbarGroup align={Alignment.LEFT}>
|
|
<DashboardViewsTabs
|
|
currentViewSlug={estimatesCurrentView}
|
|
resourceName={'estimates'}
|
|
tabs={tabs}
|
|
onChange={handleTabsChange}
|
|
/>
|
|
</NavbarGroup>
|
|
</Navbar>
|
|
);
|
|
}
|
|
|
|
export default compose(
|
|
withEstimatesActions,
|
|
withEstimates(({ estimatesTableState }) => ({
|
|
estimatesCurrentView: estimatesTableState.viewSlug
|
|
})),
|
|
)(EstimateViewTabs);
|