2025-10-29 18:18:00 -05:00
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
|
|
|
|
|
|
import ChatButton from './components/web/ChatButton';
|
|
|
|
|
import { isChatDisabled } from './functions';
|
|
|
|
|
|
2026-03-06 22:00:40 +05:30
|
|
|
interface IChatButtonEntry {
|
|
|
|
|
Content: typeof ChatButton;
|
|
|
|
|
group: number;
|
|
|
|
|
key: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const chat: IChatButtonEntry = {
|
2025-10-29 18:18:00 -05:00
|
|
|
key: 'chat',
|
|
|
|
|
Content: ChatButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A hook that returns the chat button if chat is not disabled.
|
|
|
|
|
*
|
|
|
|
|
* @returns {Object | undefined} - The chat button object or undefined.
|
|
|
|
|
*/
|
2026-03-06 22:00:40 +05:30
|
|
|
export function useChatButton(): IChatButtonEntry | undefined {
|
2025-10-29 18:18:00 -05:00
|
|
|
const _isChatDisabled = useSelector(isChatDisabled);
|
|
|
|
|
|
2026-03-06 22:00:40 +05:30
|
|
|
if (_isChatDisabled) {
|
|
|
|
|
return;
|
2025-10-29 18:18:00 -05:00
|
|
|
}
|
2026-03-06 22:00:40 +05:30
|
|
|
|
|
|
|
|
return chat;
|
2025-10-29 18:18:00 -05:00
|
|
|
}
|