From 618c854b4eed70e89cebdddda65fef87f2817103 Mon Sep 17 00:00:00 2001 From: desperado1802 <124465103+desperado1802@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:53:21 +0200 Subject: [PATCH] Bug/profile avatars when no image url (#1793) * fixed avatars in main page member card * fixed the avatar in profile page * fixed avatar in navigation menu too * fixed avatar in profile page in dark mode * fixed avatar in navbar popover * navbar avatar tooltip position fix --- apps/web/lib/components/tooltip.tsx | 6 ++-- .../team/user-team-card/user-info.tsx | 23 +++++++------- apps/web/lib/features/timer/timer-status.tsx | 4 ++- apps/web/lib/features/user-nav-menu.tsx | 30 ++++++++++++++----- apps/web/pages/profile/[memberId].tsx | 18 +++++++---- 5 files changed, 55 insertions(+), 26 deletions(-) diff --git a/apps/web/lib/components/tooltip.tsx b/apps/web/lib/components/tooltip.tsx index d827d1a07..5961aedf0 100644 --- a/apps/web/lib/components/tooltip.tsx +++ b/apps/web/lib/components/tooltip.tsx @@ -11,6 +11,7 @@ type Props = { placement?: Placement; enabled?: boolean; labelClassName?: string; + labelContainerClassName?: string; } & IClassName; export function Tooltip({ @@ -19,7 +20,8 @@ export function Tooltip({ label, placement = 'top', enabled = true, - labelClassName + labelClassName, + labelContainerClassName }: PropsWithChildren) { const { getArrowProps, getTooltipProps, setTooltipRef, setTriggerRef, visible } = usePopperTooltip({ placement @@ -43,7 +45,7 @@ export function Tooltip({ leaveTo="transform scale-95 opacity-0" ref={setTooltipRef} {...getTooltipProps()} - className="tooltip-container w-1/3 md:w-fit" + className={clsx('tooltip-container w-1/3 md:w-fit', labelContainerClassName)} > {label}
diff --git a/apps/web/lib/features/team/user-team-card/user-info.tsx b/apps/web/lib/features/team/user-team-card/user-info.tsx index bc96a6050..55a0792a2 100644 --- a/apps/web/lib/features/team/user-team-card/user-info.tsx +++ b/apps/web/lib/features/team/user-team-card/user-info.tsx @@ -38,25 +38,26 @@ export function UserInfo({ className, memberInfo, publicTeam = false }: Props) {
{imageUrl && isValidUrl(imageUrl) ? ( - - - + ) : ( - imgTitle(fullname).charAt(0) +
+ {imgTitle(fullname).charAt(0)} +
)} +
diff --git a/apps/web/lib/features/timer/timer-status.tsx b/apps/web/lib/features/timer/timer-status.tsx index d59d6a96e..32737d224 100644 --- a/apps/web/lib/features/timer/timer-status.tsx +++ b/apps/web/lib/features/timer/timer-status.tsx @@ -9,9 +9,10 @@ type Props = { status: ITimerStatusEnum; showIcon?: boolean; tooltipClassName?: string; + labelContainerClassName?: string; } & IClassName; -export function TimerStatus({ status, className, showIcon = true, tooltipClassName }: Props) { +export function TimerStatus({ status, className, showIcon = true, tooltipClassName, labelContainerClassName }: Props) { return (
) : name ? ( - imgTitle(name).charAt(0) +
+ {imgTitle(name).charAt(0)} + +
) : ( '' )} @@ -138,9 +146,9 @@ function UserNavMenu() {
) : name ? ( - imgTitle(name).charAt(0) +
+ {imgTitle(name).charAt(0)} + +
) : ( '' )} diff --git a/apps/web/pages/profile/[memberId].tsx b/apps/web/pages/profile/[memberId].tsx index dc29fad5b..6c17bbbf2 100644 --- a/apps/web/pages/profile/[memberId].tsx +++ b/apps/web/pages/profile/[memberId].tsx @@ -86,10 +86,11 @@ function UserProfileDetail({ member }: { member?: OT_Member }) {
) : ( - imgTitle(userName).charAt(0) + <> + {imgTitle(userName).charAt(0)} + + )}