Skip to content

Commit

Permalink
Do not render tooltip when RA is displayed on TAC (#12472)
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros authored May 1, 2024
1 parent 5dc3ad5 commit ad7f626
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen
closeLabel={_t("action|ok")}
>
<ThreadsActivityCentreButton
disableTooltip={true}
displayLabel={displayButtonLabel}
notificationLevel={roomsAndNotifications.greatestNotificationLevel}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import { NotificationLevel } from "../../../../stores/notifications/Notification
import { notificationLevelToIndicator } from "../../../../utils/notifications";

interface ThreadsActivityCentreButtonProps extends ComponentProps<typeof IconButton> {
/**
* Whether to disable the tooltip.
*/
disableTooltip?: boolean;
/**
* Display the `Threads` label next to the icon.
*/
Expand All @@ -40,9 +44,12 @@ interface ThreadsActivityCentreButtonProps extends ComponentProps<typeof IconBut
* A button to open the thread activity centre.
*/
export const ThreadsActivityCentreButton = forwardRef<HTMLButtonElement, ThreadsActivityCentreButtonProps>(
function ThreadsActivityCentreButton({ displayLabel, notificationLevel, ...props }, ref): React.JSX.Element {
function ThreadsActivityCentreButton(
{ displayLabel, notificationLevel, disableTooltip, ...props },
ref,
): React.JSX.Element {
// Disable tooltip when the label is displayed
const openTooltip = displayLabel ? false : undefined;
const openTooltip = disableTooltip || displayLabel ? false : undefined;

return (
<Tooltip label={_t("common|threads")} placement="right" open={openTooltip}>
Expand Down
11 changes: 11 additions & 0 deletions test/components/views/spaces/ThreadsActivityCentre-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ describe("ThreadsActivityCentre", () => {
expect(document.body).toMatchSnapshot();
});

it("should render not display the tooltip when the release announcement is displayed", async () => {
// Enable release announcement
await SettingsStore.setValue("feature_release_announcement", null, SettingLevel.DEVICE, true);

renderTAC();

// The tooltip should not be displayed
await userEvent.hover(getTACButton());
expect(screen.queryByRole("tooltip")).toBeNull();
});

it("should render the threads activity centre button and the display label", async () => {
renderTAC({ displayButtonLabel: true });
expect(getTACButton()).toBeInTheDocument();
Expand Down

0 comments on commit ad7f626

Please sign in to comment.