mirror of https://github.com/vector-im/riot-web
Do not render tooltip when RA is displayed on TAC (#12472)
parent
5dc3ad546c
commit
ad7f626e22
|
@ -82,6 +82,7 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen
|
|||
closeLabel={_t("action|ok")}
|
||||
>
|
||||
<ThreadsActivityCentreButton
|
||||
disableTooltip={true}
|
||||
displayLabel={displayButtonLabel}
|
||||
notificationLevel={roomsAndNotifications.greatestNotificationLevel}
|
||||
/>
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
@ -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}>
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue