fix(web): make sidebar navigation items reactive to locale changes

The sidebar was using t() which references a module-level currentLocale variable
that doesn't trigger re-renders when the locale changes. Updated to use the
LocaleContext and tLocale() so sidebar navigation items update immediately
when the user selects a different language.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
argenis de la rosa 2026-03-09 16:48:07 -04:00
parent c280ae5045
commit 183069d87f

View File

@ -14,7 +14,8 @@ import {
Stethoscope,
X,
} from 'lucide-react';
import { t } from '@/lib/i18n';
import { tLocale } from '@/lib/i18n';
import { useLocaleContext } from '@/App';
const COLLAPSE_BUTTON_DELAY_MS = 1000;
@ -45,6 +46,9 @@ export default function Sidebar({
onToggleCollapse,
}: SidebarProps) {
const [showCollapseButton, setShowCollapseButton] = useState(false);
const { locale } = useLocaleContext();
const t = (key: string) => tLocale(key, locale);
useEffect(() => {
const id = setTimeout(() => setShowCollapseButton(true), COLLAPSE_BUTTON_DELAY_MS);