diff --git a/packages/shared/src/components/profile/ProfileButton.spec.tsx b/packages/shared/src/components/profile/ProfileButton.spec.tsx index 2ae80077ab..8bb0049edf 100644 --- a/packages/shared/src/components/profile/ProfileButton.spec.tsx +++ b/packages/shared/src/components/profile/ProfileButton.spec.tsx @@ -54,10 +54,14 @@ it('should show "Profile settings" tooltip on the profile picture', () => { ).toBeInTheDocument(); }); -it('should show "Reputation" tooltip on the reputation badge', () => { +it('should render the reputation reward target inside the profile button', () => { renderComponent(); - expect(screen.getByLabelText('Reputation')).toBeInTheDocument(); + expect( + screen + .getByRole('button', { name: 'Profile settings' }) + .querySelector('[data-reward-target="reputation"]'), + ).not.toBeNull(); }); it('should show settings option that opens modal', async () => { diff --git a/packages/shared/src/components/profile/ProfileButton.tsx b/packages/shared/src/components/profile/ProfileButton.tsx index e21c5a2dbf..f51da8086f 100644 --- a/packages/shared/src/components/profile/ProfileButton.tsx +++ b/packages/shared/src/components/profile/ProfileButton.tsx @@ -4,8 +4,10 @@ import classNames from 'classnames'; import dynamic from 'next/dynamic'; import { useAuthContext } from '../../contexts/AuthContext'; import { ProfilePictureWithIndicator } from './ProfilePictureWithIndicator'; +import { ProfileImageSize } from '../ProfilePicture'; import { CoreIcon, ReputationIcon, SettingsIcon } from '../icons'; import { Button, ButtonSize, ButtonVariant } from '../buttons/Button'; +import { IconSize } from '../Icon'; import { useInteractivePopup } from '../../hooks/utils/useInteractivePopup'; import { ReadingStreakButton } from '../streak/ReadingStreakButton'; import { useReadingStreak } from '../../hooks/streaks'; @@ -48,7 +50,7 @@ export default function ProfileButton({ Partial> >({}); const coresCounterRef = useRef(null); - const reputationCounterRef = useRef(null); + const reputationCounterRef = useRef(null); const displayedBalance = typeof animatedCores === 'number' ? animatedCores @@ -195,6 +197,8 @@ export default function ProfileButton({ return <>; } + // The pill groups streak / cores / reputation / avatar into one + // bordered control with edge-to-edge hover slots. return ( <> {settingsIconOnly ? ( @@ -204,12 +208,13 @@ export default function ProfileButton({ icon={} /> ) : ( -
+
{isStreaksEnabled && streak && ( )} {hasCoresAccess && ( @@ -233,7 +238,7 @@ export default function ProfileButton({ tag="a" variant={ButtonVariant.Tertiary} size={ButtonSize.Small} - className="!px-1.5" + className="!h-full !rounded-none !pl-1.5 !pr-2" > {largeNumberFormat(displayedBalance)} @@ -241,36 +246,38 @@ export default function ProfileButton({
)} - -
- -
-
- + + {largeNumberFormat(displayedReputation ?? 0)} + + +
)} diff --git a/packages/shared/src/components/streak/ReadingStreakButton.tsx b/packages/shared/src/components/streak/ReadingStreakButton.tsx index 903bb22e85..30dfe8976b 100644 --- a/packages/shared/src/components/streak/ReadingStreakButton.tsx +++ b/packages/shared/src/components/streak/ReadingStreakButton.tsx @@ -141,7 +141,7 @@ export function ReadingStreakButton({ : ButtonVariant.Float } onClick={handleToggle} - className={classnames('gap-1', compact && '!px-1.5', className)} + className={classnames('gap-1', className)} size={!compact && !isMobile ? ButtonSize.Medium : ButtonSize.Small} > {streak?.current}