fix(web): stop spurious page refresh on account menu open; plugin log auto-refresh as switch

Two unrelated frontend fixes:

- LanguageSelector mounts each time the sidebar account dropdown opens and
  unconditionally called i18n.changeLanguage() on mount, emitting a
  languageChanged event even when the language was unchanged. That handed
  every useTranslation() consumer a fresh `t` reference, re-running effects
  keyed on `t` (e.g. the plugins page system-status fetch) and surfacing as
  a page "refresh". Guard the call so it only fires on an actual change.

- Plugin logs auto-refresh control changed from a toggle Button to a
  Switch + Label; the on/off button i18n keys are replaced by a single
  static logsAutoRefresh label across all 8 locales.
This commit is contained in:
RockChinQ
2026-06-21 11:58:01 -04:00
parent 9daf22d661
commit 812b1fff4c
10 changed files with 33 additions and 28 deletions
@@ -3,6 +3,8 @@ import { httpClient } from '@/app/infra/http/HttpClient';
import { useTranslation } from 'react-i18next';
import { PluginLogEntry } from '@/app/infra/entities/plugin';
import { Button } from '@/components/ui/button';
import { Switch } from '@/components/ui/switch';
import { Label } from '@/components/ui/label';
import {
Select,
SelectContent,
@@ -116,17 +118,19 @@ export default function PluginLogs({
/>
{t('plugins.logsRefresh')}
</Button>
<Button
type="button"
variant={autoRefresh ? 'default' : 'outline'}
size="sm"
className="h-8"
onClick={() => setAutoRefresh((v) => !v)}
>
{autoRefresh
? t('plugins.logsAutoRefreshOn')
: t('plugins.logsAutoRefreshOff')}
</Button>
<div className="flex items-center gap-2">
<Switch
id="plugin-logs-auto-refresh"
checked={autoRefresh}
onCheckedChange={setAutoRefresh}
/>
<Label
htmlFor="plugin-logs-auto-refresh"
className="cursor-pointer text-sm font-normal text-muted-foreground"
>
{t('plugins.logsAutoRefresh')}
</Label>
</div>
</div>
<div