-
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
185d7d8
commit 7726eea
Showing
7 changed files
with
100 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
32 changes: 32 additions & 0 deletions
32
apps/meteor/client/sidebar/header/actions/hooks/useAdministrationHighlight.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,32 @@ | ||
import { css } from '@rocket.chat/css-in-js'; | ||
import { Palette } from '@rocket.chat/fuselage'; | ||
|
||
import { useOmnichannelHighlight } from '../../../../../ee/client/omnichannel/hooks/useOmnichannelHighlight'; | ||
|
||
const highlightDot = css` | ||
position: relative; | ||
&::after { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
display: block; | ||
flex: none; | ||
width: 8px; | ||
height: 8px; | ||
background-color: ${Palette.badge['badge-background-level-4'].toString()}; | ||
border-radius: 50%; | ||
} | ||
`; | ||
|
||
export const useAdministrationHighlight = () => { | ||
const { isHighlit: isOmnichannelHighlit } = useOmnichannelHighlight(); | ||
|
||
return { | ||
isHighlit: isOmnichannelHighlit, | ||
get className() { | ||
return this.isHighlit ? highlightDot : undefined; | ||
}, | ||
}; | ||
}; |
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
14 changes: 14 additions & 0 deletions
14
apps/meteor/ee/client/omnichannel/components/OmnichannelHighlight/index.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,14 @@ | ||
import { Box, Palette } from '@rocket.chat/fuselage'; | ||
import React from 'react'; | ||
|
||
import { useOmnichannelHighlight } from '../../hooks/useOmnichannelHighlight'; | ||
|
||
export const OmnichannelHighlight = () => { | ||
const { isHighlit } = useOmnichannelHighlight(); | ||
|
||
if (!isHighlit) { | ||
return null; | ||
} | ||
|
||
return <Box width={8} height={8} borderRadius='50%' backgroundColor={Palette.badge['badge-background-level-4'].toString()} />; | ||
}; |
29 changes: 29 additions & 0 deletions
29
apps/meteor/ee/client/omnichannel/hooks/useCurrentChatsHighlight.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,29 @@ | ||
import { useLocalStorage } from '@rocket.chat/fuselage-hooks'; | ||
import { useRouter } from '@rocket.chat/ui-contexts'; | ||
import { useEffect } from 'react'; | ||
|
||
import { useIsOverMacLimit } from '../../../../client/hooks/omnichannel/useIsOverMacLimit'; | ||
|
||
export const useCurrentChatsHighlight = () => { | ||
const isOverMacLimit = useIsOverMacLimit(); | ||
const [isHighlit, setHighlight] = useLocalStorage<boolean>('omnichannel-current-chats-highlight', isOverMacLimit); | ||
const router = useRouter(); | ||
|
||
useEffect(() => { | ||
if (!isHighlit) { | ||
return; | ||
} | ||
|
||
return router.subscribeToRouteChange(() => { | ||
if (router.getRouteName() !== 'omnichannel-current-chats') { | ||
return; | ||
} | ||
|
||
setHighlight(false); | ||
}); | ||
}, [isHighlit, router, setHighlight]); | ||
|
||
return { | ||
isHighlit, | ||
}; | ||
}; |
7 changes: 7 additions & 0 deletions
7
apps/meteor/ee/client/omnichannel/hooks/useOmnichannelHighlight.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,7 @@ | ||
import { useCurrentChatsHighlight } from './useCurrentChatsHighlight'; | ||
|
||
export const useOmnichannelHighlight = () => { | ||
const { isHighlit } = useCurrentChatsHighlight(); | ||
|
||
return { isHighlit }; | ||
}; |