refactor: remove name tooltip from user avatar

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2023-10-07 18:12:48 +02:00
parent c8d654e700
commit 9a81e3ae18
2 changed files with 3 additions and 16 deletions

View file

@ -6,9 +6,7 @@
import { useTranslatedText } from '../../../hooks/common/use-translated-text' import { useTranslatedText } from '../../../hooks/common/use-translated-text'
import { ShowIf } from '../show-if/show-if' import { ShowIf } from '../show-if/show-if'
import styles from './user-avatar.module.scss' import styles from './user-avatar.module.scss'
import React, { useCallback, useMemo } from 'react' import React, { useMemo } from 'react'
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
import type { OverlayInjectedProps } from 'react-bootstrap/Overlay'
import { useAvatarUrl } from './hooks/use-avatar-url' import { useAvatarUrl } from './hooks/use-avatar-url'
export interface UserAvatarProps { export interface UserAvatarProps {
@ -55,15 +53,6 @@ export const UserAvatar: React.FC<UserAvatarProps> = ({
) )
const imgDescription = useTranslatedText('common.avatarOf', imageTranslateOptions) const imgDescription = useTranslatedText('common.avatarOf', imageTranslateOptions)
const tooltip = useCallback(
(overlayInjectedProps: OverlayInjectedProps) => (
<Tooltip id={displayName} {...overlayInjectedProps}>
{displayName}
</Tooltip>
),
[displayName]
)
return ( return (
<span className={'d-inline-flex align-items-center ' + additionalClasses}> <span className={'d-inline-flex align-items-center ' + additionalClasses}>
{/* eslint-disable-next-line @next/next/no-img-element */} {/* eslint-disable-next-line @next/next/no-img-element */}
@ -76,9 +65,7 @@ export const UserAvatar: React.FC<UserAvatarProps> = ({
width={imageSize} width={imageSize}
/> />
<ShowIf condition={showName}> <ShowIf condition={showName}>
<OverlayTrigger overlay={tooltip}> <span className={`ms-2 me-1 ${styles['user-line-name']}`}>{displayName}</span>
<span className={`ms-2 me-1 ${styles['user-line-name']}`}>{displayName}</span>
</OverlayTrigger>
</ShowIf> </ShowIf>
</span> </span>
) )

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */