-
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.
feat: Added new setting 'Hide conversation after closing' (#30591)
- Loading branch information
1 parent
6a5ec53
commit 7429d15
Showing
9 changed files
with
95 additions
and
11 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': minor | ||
--- | ||
|
||
Added new Omnichannel setting 'Hide conversation after closing' |
23 changes: 23 additions & 0 deletions
23
apps/meteor/client/hooks/omnichannel/useOmnichannelCloseRoute.ts
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,23 @@ | ||
import { useRouter, useUserPreference } from '@rocket.chat/ui-contexts'; | ||
import { useCallback } from 'react'; | ||
|
||
export const useOmnichannelCloseRoute = () => { | ||
const hideConversationAfterClosing = useUserPreference<boolean>('omnichannelHideConversationAfterClosing') ?? true; | ||
const router = useRouter(); | ||
|
||
const navigateHome = useCallback(() => { | ||
if (!hideConversationAfterClosing) { | ||
return; | ||
} | ||
|
||
const routeName = router.getRouteName(); | ||
|
||
if (routeName === 'omnichannel-current-chats') { | ||
router.navigate({ name: 'omnichannel-current-chats' }); | ||
} else { | ||
router.navigate({ name: 'home' }); | ||
} | ||
}, [hideConversationAfterClosing, router]); | ||
|
||
return { navigateHome }; | ||
}; |
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
26 changes: 26 additions & 0 deletions
26
apps/meteor/client/views/account/omnichannel/PreferencesGeneral.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,26 @@ | ||
import { Box, Field, FieldGroup, FieldHint, FieldLabel, FieldRow, ToggleSwitch } from '@rocket.chat/fuselage'; | ||
import { useUniqueId } from '@rocket.chat/fuselage-hooks'; | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import type { ReactElement } from 'react'; | ||
import React from 'react'; | ||
import { useFormContext } from 'react-hook-form'; | ||
|
||
export const PreferencesGeneral = (): ReactElement => { | ||
const t = useTranslation(); | ||
const { register } = useFormContext(); | ||
const omnichannelHideAfterClosing = useUniqueId(); | ||
|
||
return ( | ||
<FieldGroup marginBlockEnd='1.5rem' paddingInline='0.5rem'> | ||
<Field> | ||
<Box display='flex' alignItems='center' flexDirection='row' justifyContent='spaceBetween' flexGrow={1}> | ||
<FieldLabel htmlFor={omnichannelHideAfterClosing}>{t('Omnichannel_hide_conversation_after_closing')}</FieldLabel> | ||
<FieldRow> | ||
<ToggleSwitch id={omnichannelHideAfterClosing} {...register('omnichannelHideConversationAfterClosing')} /> | ||
</FieldRow> | ||
</Box> | ||
<FieldHint>{t('Omnichannel_hide_conversation_after_closing_description')}</FieldHint> | ||
</Field> | ||
</FieldGroup> | ||
); | ||
}; |
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
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