import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import cn from 'classnames'; import { REPOSITORY, PRIVACY_POLICY_LINK, THEMES } from '../../helpers/constants'; import { LANGUAGES } from '../../helpers/twosky'; import i18n from '../../i18n'; import Version from './Version'; import './Footer.css'; import './Select.css'; import { setHtmlLangAttr, setUITheme } from '../../helpers/helpers'; import { changeTheme } from '../../actions'; import { RootState } from '../../initialState'; const linksData = [ { href: REPOSITORY.URL, name: 'homepage', }, { href: PRIVACY_POLICY_LINK, name: 'privacy_policy', }, { href: REPOSITORY.ISSUES, className: 'btn btn-outline-primary btn-sm footer__link--report', name: 'report_an_issue', }, ]; const Footer = () => { const { t } = useTranslation(); const dispatch = useDispatch(); const currentTheme = useSelector((state: RootState) => (state.dashboard ? state.dashboard.theme : THEMES.auto)); const profileName = useSelector((state: RootState) => (state.dashboard ? state.dashboard.name : '')); const isLoggedIn = profileName !== ''; const [currentThemeLocal, setCurrentThemeLocal] = useState(THEMES.auto); const getYear = () => { const today = new Date(); return today.getFullYear(); }; const changeLanguage = (event: any) => { const { value } = event.target; i18n.changeLanguage(value); setHtmlLangAttr(value); }; const onThemeChange = (value: any) => { if (isLoggedIn) { dispatch(changeTheme(value)); } else { setUITheme(value); setCurrentThemeLocal(value); } }; const renderCopyright = () => (