fix: proxy mode description displays incorrectly (#3719)

* fix: proxy mode description display incorrectly

* fix: update language json

---------

Co-authored-by: Tunglies <selenvow+github@gmail.com>
This commit is contained in:
希亚的西红柿
2025-06-15 05:19:30 +08:00
committed by GitHub
parent 032e5bf32e
commit 8bc451ff08
5 changed files with 22 additions and 15 deletions

View File

@@ -23,6 +23,15 @@ export const ClashModeCard = () => {
// 直接使用API返回的模式不维护本地状态
const currentMode = clashConfig?.mode?.toLowerCase();
const modeDescription = useMemo(() => {
if (typeof currentMode === "string" && currentMode.length > 0) {
return t(
`${currentMode[0].toLocaleUpperCase()}${currentMode.slice(1)} Mode Description`,
);
}
return t("Mode Description Not Available");
}, [currentMode]);
// 模式图标映射
const modeIcons = useMemo(
() => ({
@@ -148,9 +157,7 @@ export const ClashModeCard = () => {
}}
>
<Typography variant="caption" component="div" sx={descriptionStyles}>
{t(
`${currentMode?.charAt(0).toUpperCase()}${currentMode?.slice(1)} Mode Description`,
)}
{modeDescription}
</Typography>
</Box>
</Box>