Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

643 B
Raw Blame
import { useCallback } from 'react';

import { useGlobalStore } from '@/store/global';
import { systemStatusSelectors } from '@/store/global/selectors/systemStatus';

import { type GroupMode } from '../types';

export const usePanelState = () => {
  const groupMode = useGlobalStore(systemStatusSelectors.modelSwitchPanelGroupMode) as GroupMode;
  const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);

  const handleGroupModeChange = useCallback(
    (mode: GroupMode) => {
      updateSystemStatus({ modelSwitchPanelGroupBy: mode });
    },
    [updateSystemStatus],
  );

  return { groupMode, handleGroupModeChange };
};