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

This commit is contained in:
rstubryan
2026-02-23 11:05:11 +07:00
parent 75e9b06a83
commit 7e1166b5e8
18 changed files with 75 additions and 150 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 { useReportTabStore } from '@/stores/report/report-tab.store';
import { useTabActionsStore } from '@/stores/tab-actions/tab-actions.store';
const LogisticStockTabs = () => {
const [activeTabId, setActiveTabId] = useState<string>('1');
const tabActions = useReportTabStore((state) => state.tabActions);
const tabActions = useTabActionsStore((state) => state.tabActions);
const tabs = [
{
@@ -30,7 +30,7 @@ import {
} from '@/components/pages/report/logistic-stock/filter/PurchasesPerSupplierFilter';
import SelectInputCheckbox from '@/components/input/SelectInputCheckbox';
import SelectInputRadio from '@/components/input/SelectInputRadio';
import { useReportTabStore } from '@/stores/report/report-tab.store';
import { useTabActionsStore } from '@/stores/tab-actions/tab-actions.store';
import PurchasePerSupplierSkeleton from '@/components/pages/report/logistic-stock/skeleton/PurchasePerSupplierSkeleton';
interface PurchasesPerSupplierTabProps {
@@ -479,8 +479,8 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
]);
// ===== REGISTER TAB ACTIONS TO STORE =====
const setTabActions = useReportTabStore((state) => state.setTabActions);
const clearTabActions = useReportTabStore((state) => state.clearTabActions);
const setTabActions = useTabActionsStore((state) => state.setTabActions);
const clearTabActions = useTabActionsStore((state) => state.clearTabActions);
useEffect(() => {
setTabActions(