Skip to content
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
2 changes: 1 addition & 1 deletion apps/src/components/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export function Header() {
<DisclaimerTicker compact />
<LanguageSwitcher
compact
triggerClassName="w-9 min-w-9 px-0 sm:w-[106px] sm:min-w-[106px] sm:px-3"
triggerClassName="w-10 min-w-10 gap-1 px-0 sm:w-[124px] sm:min-w-[124px] sm:gap-2 sm:px-2.5"
/>

{canLogoutWebSession ? (
Expand Down
24 changes: 15 additions & 9 deletions apps/src/components/layout/language-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,28 @@ export function LanguageSwitcher({
className={cn("h-9 min-w-[116px] gap-2 text-xs", triggerClassName)}
aria-label={t("选择语言")}
>
<div className="flex min-w-0 items-center justify-center gap-2">
<div className="flex min-w-0 flex-1 items-center justify-center gap-2 overflow-hidden">
<Globe className="h-4 w-4 shrink-0 text-muted-foreground" />
<span className={compact ? "hidden min-w-0 sm:inline" : "min-w-0"}>
<SelectValue>
<span
className={
compact
? "hidden min-w-0 flex-1 overflow-hidden sm:flex"
: "flex min-w-0 flex-1 overflow-hidden"
}
>
<SelectValue className="min-w-0 truncate">
{(value) => getLocaleLabel(normalizeLocale(value))}
</SelectValue>
</span>
</div>
</SelectTrigger>
<SelectContent>
<SelectGroup>
{localeOptions.map((item) => (
<SelectItem key={item} value={item}>
{getLocaleLabel(item)}
</SelectItem>
))}
<SelectGroup>
{localeOptions.map((item) => (
<SelectItem key={item} value={item}>
{getLocaleLabel(item)}
</SelectItem>
))}
</SelectGroup>
</SelectContent>
</Select>
Expand Down
2 changes: 1 addition & 1 deletion apps/tests/header-controls.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test("管理员仪表盘保留服务开关和语言选择", async () => {
assert.match(source, /<Switch[\s\S]*?onCheckedChange=\{handleToggleService\}/);
assert.match(
source,
/<LanguageSwitcher[\s\S]*?compact[\s\S]*?triggerClassName="w-9 min-w-9[\s\S]*?sm:w-\[106px\]/,
/<LanguageSwitcher[\s\S]*?compact[\s\S]*?triggerClassName="w-10 min-w-10 gap-1 px-0[\s\S]*?sm:w-\[124px\][\s\S]*?sm:gap-2/,
);
assert.match(source, /<DisclaimerTicker compact \/>/);
assert.match(source, /v\{serviceStatus\.version\}/);
Expand Down
11 changes: 9 additions & 2 deletions apps/tests/ui-responsive-regressions.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ test("mobile shell preserves page titles and compact controls", async () => {
);
assert.match(headerSource, /flex min-w-0 flex-1[\s\S]*overflow-hidden/);
assert.match(headerSource, /truncate text-lg[\s\S]*sm:text-\[21px\]/);
assert.match(headerSource, /triggerClassName="w-9 min-w-9/);
assert.match(languageSource, /compact \? "hidden min-w-0 sm:inline"/);
assert.match(
headerSource,
/triggerClassName="w-10 min-w-10 gap-1 px-0[\s\S]*?sm:w-\[124px\][\s\S]*?sm:gap-2/,
);
assert.match(
languageSource,
/flex min-w-0 flex-1 items-center justify-center gap-2 overflow-hidden/,
);
assert.match(languageSource, /<SelectValue className="min-w-0 truncate">/);
assert.match(workspaceSource, /line-clamp-2[\s\S]*sm:line-clamp-1/);
});

Expand Down