refactor(FE): Refactor tab store to use a unified ReportTabStore

This commit is contained in:
rstubryan
2026-02-12 16:16:40 +07:00
parent 6aae18df54
commit dbb523c710
13 changed files with 76 additions and 182 deletions
@@ -3,11 +3,11 @@
import { useState } from 'react';
import Tabs from '@/components/Tabs';
import PurchasesPerSupplierTab from '@/components/pages/report/logistic-stock/tab/PurchasesPerSupplierTab';
import { useLogisticStockTabStore } from '@/stores/report/logistic-stock-tab/logistic-stock-tab.store';
import { useReportTabStore } from '@/stores/report/report-tab.store';
const LogisticStockTabs = () => {
const [activeTabId, setActiveTabId] = useState<string>('1');
const tabActions = useLogisticStockTabStore((state) => state.tabActions);
const tabActions = useReportTabStore((state) => state.tabActions);
const tabs = [
{
@@ -32,7 +32,7 @@ import {
} from '@/components/pages/report/logistic-stock/filter/PurchasesPerSupplierFilter';
import SelectInputCheckbox from '@/components/input/SelectInputCheckbox';
import SelectInputRadio from '@/components/input/SelectInputRadio';
import { useLogisticStockTabStore } from '@/stores/report/logistic-stock-tab/logistic-stock-tab.store';
import { useReportTabStore } from '@/stores/report/report-tab.store';
import PurchasePerSupplierSkeleton from '@/components/pages/report/logistic-stock/skeleton/PurchasePerSupplierSkeleton';
interface PurchasesPerSupplierTabProps {
@@ -486,12 +486,8 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
]);
// ===== REGISTER TAB ACTIONS TO STORE =====
const setTabActions = useLogisticStockTabStore(
(state) => state.setTabActions
);
const clearTabActions = useLogisticStockTabStore(
(state) => state.clearTabActions
);
const setTabActions = useReportTabStore((state) => state.setTabActions);
const clearTabActions = useReportTabStore((state) => state.clearTabActions);
useEffect(() => {
setTabActions(