Skip to content

The open alternative to Salesforce, designed for AI.

613 B
Raw Blame
import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState';
import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';
import { useCallback } from 'react';

export const useUnpinTab = (pageLayoutIdFromProps?: string) => {
  const setPageLayoutDraft = useSetAtomComponentState(
    pageLayoutDraftComponentState,
    pageLayoutIdFromProps,
  );

  const unpinTab = useCallback(() => {
    setPageLayoutDraft((prev) => ({
      ...prev,
      isFirstTabPinned: false,
    }));
  }, [setPageLayoutDraft]);

  return { unpinTab };
};