import { useCallback } from 'react';
import { useSetAtom } from 'jotai';
import { channelsWorkspaceSheetAtom } from '../channelsWorkspaceSheet';

export const useOpenChannelsWorkspaceSheet = (): (() => void) => {
  const setSheet = useSetAtom(channelsWorkspaceSheetAtom);
  return useCallback(() => {
    setSheet(true);
  }, [setSheet]);
};

export const useCloseChannelsWorkspaceSheet = (): (() => void) => {
  const setSheet = useSetAtom(channelsWorkspaceSheetAtom);
  return useCallback(() => {
    setSheet(false);
  }, [setSheet]);
};
