Skip to content

Commit

Permalink
chore: on language change when active tab is general, active tab is p…
Browse files Browse the repository at this point in the history
…ersisted as general
  • Loading branch information
utin-francis-peter committed Jun 23, 2024
1 parent 68c71ad commit 651eb33
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/src/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Doc } from '../preferences/preferenceApi';
import ArrowLeft from '../assets/arrow-left.svg';
import ArrowRight from '../assets/arrow-right.svg';
import { useTranslation } from 'react-i18next';
import i18n from '../locale/i18n';

const apiHost = import.meta.env.VITE_API_HOST || 'https://docsapi.arc53.com';

Expand Down Expand Up @@ -48,6 +49,11 @@ const Settings: React.FC = () => {
})
.catch((error) => console.error(error));
};

// persist active tab as the translated version of 'general' per language change
React.useEffect(() => {
setActiveTab(t('settings.general.label'));
}, [i18n.language]);
return (
<div className="wa p-4 pt-20 md:p-12">
<p className="text-2xl font-bold text-eerie-black dark:text-bright-gray">
Expand Down

0 comments on commit 651eb33

Please sign in to comment.