The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/components/ActionManagerBusyState.tsx

53 lines
1.1 KiB

import { css } from '@rocket.chat/css-in-js';
import { Box } from '@rocket.chat/fuselage';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useUiKitActionManager } from '../uikit/hooks/useUiKitActionManager';
const ActionManagerBusyState = () => {
const { t } = useTranslation();
const actionManager = useUiKitActionManager();
const [busy, setBusy] = useState(false);
useEffect(() => {
if (!actionManager) {
return;
}
const handleBusyStateChange = ({ busy }: { busy: boolean }) => setBusy(busy);
actionManager.on('busy', handleBusyStateChange);
return () => {
actionManager.off('busy', handleBusyStateChange);
};
}, [actionManager]);
if (busy) {
return (
<Box
className={css`
transform: translateX(-50%);
pointer-events: none;
`}
position='absolute'
insetInlineStart='50%'
p={16}
bg='tint'
color='default'
textAlign='center'
fontSize='p2'
elevation='2'
borderRadius='0 0 4px 4px'
zIndex={99999}
>
{t('Loading')}
</Box>
);
}
return null;
};
export default ActionManagerBusyState;