Skip to content

Commit 1dc169a

Browse files
committed
refactor: integrate cloud plan logic into language switch component
- Added useCloudPlan to LangSwitch for enhanced language handling based on cloud plan status. - Updated language button disabling logic to account for essential cloud plan, improving user experience.
1 parent 890a951 commit 1dc169a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/Layout/HeaderAction.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { Locale, BuildType } from "shared/interface";
2121
import { ActionButton } from "components/Card/FeedbackSection/components";
2222
import { Link } from "gatsby";
2323
import { useIsAutoTranslation } from "shared/useIsAutoTranslation";
24+
import { useCloudPlan } from "shared/useCloudPlan";
2425

2526
const useTiDBAIStatus = () => {
2627
const [showTiDBAIButton, setShowTiDBAIButton] = React.useState(true);
@@ -123,6 +124,7 @@ const LangSwitch = (props: {
123124
supportedLocales: Locale[];
124125
}) => {
125126
const { supportedLocales } = props;
127+
const { isEssential } = useCloudPlan();
126128

127129
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
128130

@@ -223,7 +225,7 @@ const LangSwitch = (props: {
223225
onClick={toggleLanguage(Locale.ja)}
224226
disableRipple
225227
selected={language === Locale.ja}
226-
disabled={!supportedLocales.includes(Locale.ja)}
228+
disabled={!supportedLocales.includes(Locale.ja) || isEssential}
227229
>
228230
<Typography component="span" color={theme.palette.carbon[900]}>
229231
<Trans i18nKey="lang.ja" />

0 commit comments

Comments
 (0)