Highlight language change in composer

This commit is contained in:
Lim Chee Aun 2023-03-19 15:04:42 +08:00
parent ef874dd347
commit 15551ec3c9

View file

@ -141,6 +141,7 @@ function Compose({
const [language, setLanguage] = useState( const [language, setLanguage] = useState(
store.session.get('currentLanguage') || DEFAULT_LANG, store.session.get('currentLanguage') || DEFAULT_LANG,
); );
const prevLanguage = useRef(language);
const [mediaAttachments, setMediaAttachments] = useState([]); const [mediaAttachments, setMediaAttachments] = useState([]);
const [poll, setPoll] = useState(null); const [poll, setPoll] = useState(null);
@ -1032,7 +1033,11 @@ function Compose({
{uiState !== 'loading' && ( {uiState !== 'loading' && (
<CharCountMeter maxCharacters={maxCharacters} /> <CharCountMeter maxCharacters={maxCharacters} />
)} )}
<label class="toolbar-button"> <label
class={`toolbar-button ${
language !== prevLanguage.current ? 'highlight' : ''
}`}
>
<span class="icon-text"> <span class="icon-text">
{supportedLanguagesMap[language]?.native} {supportedLanguagesMap[language]?.native}
</span> </span>