import { SettingSetter, useSetting } from './settings';
import { settingsAtom } from '../settings';

/** Members drawer preference for the current room kind (DM vs channel). */
export const usePeopleDrawerSetting = (
  isDirect: boolean
): [boolean, (value: SettingSetter<boolean>) => void] => {
  const rooms = useSetting(settingsAtom, 'peopleDrawerInRooms');
  const directs = useSetting(settingsAtom, 'peopleDrawerInDirects');
  return isDirect ? directs : rooms;
};
