Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

TAC: hide tooltip when the release announcement is displayed #12472

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading