Skip to content

Commit 543b90c

Browse files
committed
fix #7785 -- Language dropdown button: hide the tooltip when the menu is open
- also, don't show redundant default language when it is the same (in parens)
1 parent 3555d92 commit 543b90c

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/packages/frontend/account/account-page.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ for different account related information
1010
and configuration.
1111
*/
1212

13+
import { useState } from "react";
1314
import { DownOutlined } from "@ant-design/icons";
1415
import { Button, Dropdown, MenuProps, Modal, Space, Tooltip } from "antd";
1516
import { useIntl } from "react-intl";
16-
1717
import { SignOut } from "@cocalc/frontend/account/sign-out";
1818
import { AntdTabItem, Col, Row, Tabs } from "@cocalc/frontend/antd-bootstrap";
1919
import {
@@ -86,6 +86,7 @@ export const AccountPage: React.FC = () => {
8686
const is_commercial = useTypedRedux("customize", "is_commercial");
8787
const get_api_key = useTypedRedux("page", "get_api_key");
8888
const i18n_enabled = useTypedRedux("customize", "i18n");
89+
const [langOpen, setLangOpen] = useState<boolean>(false);
8990

9091
// for each exclusive domain, tell the user which strategy to use
9192
const exclusive_sso_domains = React.useMemo(() => {
@@ -351,13 +352,21 @@ Thank you for your patience and understanding as we work to make our application
351352
{cur}
352353
<br />
353354
{msg}
354-
<br />({labels.account_language_tooltip.defaultMessage})
355+
{labels.account_language_tooltip.defaultMessage != msg ? (
356+
<>
357+
<br />({labels.account_language_tooltip.defaultMessage})
358+
</>
359+
) : undefined}
355360
</>
356361
);
357362

358363
return (
359-
<Tooltip title={tooltip} trigger={["hover"]}>
360-
<Dropdown menu={menu} trigger={["click"]}>
364+
<Tooltip title={langOpen ? undefined : tooltip} trigger={["hover"]}>
365+
<Dropdown
366+
menu={menu}
367+
trigger={["click"]}
368+
onOpenChange={(open) => setLangOpen(open)}
369+
>
361370
<Button>
362371
<Space>
363372
{lang_icon}

src/packages/frontend/i18n/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const labels = defineMessages({
5151
},
5252
account_language_tooltip: {
5353
id: "labels.account.language_tooltip",
54-
defaultMessage: "Change the language of the user-interface.",
54+
defaultMessage: "Change the language of the user interface.",
5555
description: "Tooltip text of dropdown to change the UI language",
5656
},
5757
email_address: {

0 commit comments

Comments
 (0)