mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #25249 from overleaf/dp-chat-message-read
Mark messages as read when opening chat tab GitOrigin-RevId: d0e3290cad72716cbbdf5b6cc92f6c1d387a92c7
This commit is contained in:
@@ -20,6 +20,8 @@ import { useIdeContext } from '@/shared/context/ide-context'
|
||||
import getMeta from '@/utils/meta'
|
||||
import { debugConsole } from '@/utils/debugging'
|
||||
import { User } from '../../../../../types/user'
|
||||
import { useRailContext } from '@/features/ide-redesign/contexts/rail-context'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
const PAGE_SIZE = 50
|
||||
|
||||
@@ -200,7 +202,12 @@ export const ChatProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
||||
const user = useUserContext()
|
||||
const { _id: projectId } = useProjectContext()
|
||||
|
||||
const { chatIsOpen } = useLayoutContext()
|
||||
const { chatIsOpen: chatIsOpenOldEditor } = useLayoutContext()
|
||||
const { selectedTab: selectedRailTab, isOpen: railIsOpen } = useRailContext()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const chatIsOpen = newEditor
|
||||
? selectedRailTab === 'chat' && railIsOpen
|
||||
: chatIsOpenOldEditor
|
||||
|
||||
const {
|
||||
hasFocus: windowHasFocus,
|
||||
|
||||
@@ -32,6 +32,7 @@ import { HistorySidebar } from '@/features/ide-react/components/history-sidebar'
|
||||
import DictionarySettingsModal from './settings/editor-settings/dictionary-settings-modal'
|
||||
import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
|
||||
import OLIconButton from '@/features/ui/components/ol/ol-icon-button'
|
||||
import { useChatContext } from '@/features/chat/context/chat-context'
|
||||
|
||||
type RailElement = {
|
||||
icon: AvailableUnfilledIcon
|
||||
@@ -91,6 +92,8 @@ export const RailLayout = () => {
|
||||
|
||||
const { view, setLeftMenuShown } = useLayoutContext()
|
||||
|
||||
const { markMessagesAsRead } = useChatContext()
|
||||
|
||||
const isHistoryView = view === 'history'
|
||||
|
||||
const railTabs: RailElement[] = useMemo(
|
||||
@@ -163,9 +166,13 @@ export const RailLayout = () => {
|
||||
}
|
||||
// Change the selected tab and make sure it's open
|
||||
openTab((key ?? 'file-tree') as RailTabKey)
|
||||
|
||||
if (key === 'chat') {
|
||||
markMessagesAsRead()
|
||||
}
|
||||
}
|
||||
},
|
||||
[openTab, togglePane, selectedTab, railTabs]
|
||||
[openTab, togglePane, selectedTab, railTabs, markMessagesAsRead]
|
||||
)
|
||||
|
||||
const isReviewPanelOpen = selectedTab === 'review-panel'
|
||||
|
||||
Reference in New Issue
Block a user