-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(apps):
ActionManagerBusyState
component for apps `ui.interacti…
…on` (#30142)
- Loading branch information
1 parent
ebab8c4
commit 9edca67
Showing
7 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rocket.chat/meteor": patch | ||
--- | ||
|
||
feat(apps): `ActionManagerBusyState` component for apps `ui.interaction` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
import { useUiKitActionManager } from '../hooks/useUiKitActionManager'; | ||
|
||
const ActionManagerBusyState = () => { | ||
const t = useTranslation(); | ||
const actionManager = useUiKitActionManager(); | ||
const [busy, setBusy] = useState(false); | ||
|
||
useEffect(() => { | ||
if (!actionManager) { | ||
return; | ||
} | ||
|
||
actionManager.on('busy', ({ busy }: { busy: boolean }) => setBusy(busy)); | ||
|
||
return () => { | ||
actionManager.off('busy'); | ||
}; | ||
}, [actionManager]); | ||
|
||
if (busy) { | ||
return ( | ||
<Box display='flex' position='fixed' zIndex={99999} justifyContent='center' w='100vw'> | ||
<Box bg='tint' p={16} fontSize='p2' elevation='2' borderRadius='0 0 4px 4px'> | ||
{t('Loading')} | ||
</Box> | ||
</Box> | ||
); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
export default ActionManagerBusyState; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters