mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 21:31:36 +02:00
[web] Tear down old editor toolbar GitOrigin-RevId: 8ba74abcc56e7bd476a9d6cae72f38486168c2ed
28 lines
857 B
TypeScript
28 lines
857 B
TypeScript
import { useEditorManagerContext } from '@/features/ide-react/context/editor-manager-context'
|
|
import {
|
|
OnlineUser,
|
|
useOnlineUsersContext,
|
|
} from '@/features/ide-react/context/online-users-context'
|
|
import { useCallback } from 'react'
|
|
import { OnlineUsersWidget } from '@/features/editor-navigation-toolbar/components/online-users-widget'
|
|
|
|
export const OnlineUsers = () => {
|
|
const { openDoc } = useEditorManagerContext()
|
|
const { onlineUsersArray } = useOnlineUsersContext()
|
|
|
|
const goToUser = useCallback(
|
|
async (user: OnlineUser) => {
|
|
if (user.doc && typeof user.row === 'number') {
|
|
return await openDoc(user.doc, { gotoLine: user.row + 1 })
|
|
}
|
|
},
|
|
[openDoc]
|
|
)
|
|
|
|
return (
|
|
<div className="ide-redesign-online-users">
|
|
<OnlineUsersWidget onlineUsers={onlineUsersArray} goToUser={goToUser} />
|
|
</div>
|
|
)
|
|
}
|