hedgedoc/frontend/src/components/editor-page/sidebar/users-online-sidebar-menu/own-user-line.tsx
Philip Molares 8d497bcfc5 feat(frontend): show own user in UsersOnlineSidebarMenu
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2023-03-25 15:27:38 +01:00

24 lines
902 B
TypeScript

/*
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useApplicationState } from '../../../../hooks/common/use-application-state'
import { SidebarButton } from '../sidebar-button/sidebar-button'
import { UserLine } from '../user-line/user-line'
import React from 'react'
/**
* Renders the users own {@link UserLine userline}.
*/
export const OwnUserLine: React.FC = () => {
const ownUsername = useApplicationState((state) => state.user?.username ?? null)
const ownDisplayname = useApplicationState((state) => state.realtimeStatus.ownUser.displayName)
const ownStyleIndex = useApplicationState((state) => state.realtimeStatus.ownUser.styleIndex)
return (
<SidebarButton>
<UserLine displayName={ownDisplayname} username={ownUsername} color={ownStyleIndex} active={true} />
</SidebarButton>
)
}