-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
497f2be
commit 21ed153
Showing
8 changed files
with
97 additions
and
99 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
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
41 changes: 4 additions & 37 deletions
41
apps/meteor/client/sidebar/sections/StatusDisabledSection.tsx
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
34 changes: 34 additions & 0 deletions
34
apps/meteor/client/views/admin/customUserStatus/CustomUserStatusDisabledModal.tsx
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,34 @@ | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import React from 'react'; | ||
|
||
import GenericModal from '../../../components/GenericModal'; | ||
|
||
type CustomUserStatusDisabledModalProps = { isAdmin: boolean; onConfirm: () => void; onClose: () => void }; | ||
|
||
const CustomUserStatusDisabledModal = ({ isAdmin, onConfirm, onClose }: CustomUserStatusDisabledModalProps) => { | ||
const t = useTranslation(); | ||
return isAdmin ? ( | ||
<GenericModal | ||
title={t('User_status_disabled_learn_more')} | ||
cancelText={t('Close')} | ||
confirmText={t('Go_to_workspace_settings')} | ||
children={t('User_status_disabled_learn_more_description')} | ||
onConfirm={onConfirm} | ||
onClose={onClose} | ||
onCancel={onClose} | ||
icon={null} | ||
variant='warning' | ||
/> | ||
) : ( | ||
<GenericModal | ||
title={t('User_status_disabled_learn_more')} | ||
confirmText={t('Close')} | ||
children={t('User_status_disabled_learn_more_description')} | ||
onConfirm={onConfirm} | ||
onClose={onClose} | ||
icon={null} | ||
/> | ||
); | ||
}; | ||
|
||
export default CustomUserStatusDisabledModal; |
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
22 changes: 22 additions & 0 deletions
22
apps/meteor/client/views/admin/customUserStatus/hooks/useStatusDisabledModal.tsx
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,22 @@ | ||
import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; | ||
import { useRole, useRoute, useSetModal } from '@rocket.chat/ui-contexts'; | ||
import React from 'react'; | ||
|
||
import CustomUserStatusDisabledModal from '../CustomUserStatusDisabledModal'; | ||
|
||
export const useStatusDisabledModal = () => { | ||
const userStatusRoute = useRoute('user-status'); | ||
const setModal = useSetModal(); | ||
const closeModal = useMutableCallback(() => setModal()); | ||
const handleGoToSettings = useMutableCallback(() => { | ||
userStatusRoute.push({ context: 'presence-service' }); | ||
closeModal(); | ||
}); | ||
const isAdmin = useRole('admin'); | ||
|
||
const handleSetModal = () => { | ||
setModal(<CustomUserStatusDisabledModal isAdmin={isAdmin} onConfirm={handleGoToSettings} onClose={closeModal} />); | ||
}; | ||
|
||
return handleSetModal; | ||
}; |
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