import { Button } from '@rocket.chat/fuselage'; import { ContextualbarHeader, ContextualbarClose, ContextualbarDialog, ContextualbarTitle, Page, PageHeader, PageContent, } from '@rocket.chat/ui-client'; import { useRoute, useRouteParameter, usePermission } from '@rocket.chat/ui-contexts'; import { useCallback, useRef } from 'react'; import { useTranslation } from 'react-i18next'; import AddCustomEmoji from './AddCustomEmoji'; import CustomEmoji from './CustomEmoji'; import EditCustomEmojiWithData from './EditCustomEmojiWithData'; import NotAuthorizedPage from '../../notAuthorized/NotAuthorizedPage'; const CustomEmojiRoute = () => { const { t } = useTranslation(); const route = useRoute('emoji-custom'); const context = useRouteParameter('context'); const id = useRouteParameter('id'); const canManageEmoji = usePermission('manage-emoji'); const handleItemClick = (_id: string) => (): void => { route.push({ context: 'edit', id: _id, }); }; const handleAddEmoji = useCallback(() => { route.push({ context: 'new' }); }, [route]); const handleClose = (): void => { route.push({}); }; const reload = useRef(() => null); const handleChange = useCallback(() => { reload.current(); }, [reload]); if (!canManageEmoji) { return ; } return ( {context && ( {context === 'edit' && t('Custom_Emoji_Info')} {context === 'new' && t('Custom_Emoji_Add')} {context === 'edit' && id && } {context === 'new' && } )} ); }; export default CustomEmojiRoute;