import { useState } from "react"; import LogoIcon from "./icons/LogoIcon"; import {NAV_BOTTOM, NAV_ITEMS} from "../config/feedConstants"; import {NavIcons} from "./icons/NavIcons"; import { useNavigate } from "react-router-dom"; import { useTheme } from "../context/ThemeContext"; import { useUnread } from "../context/UnreadContext"; import { useTranslation } from 'react-i18next'; import SupportModal from "./SupportModal"; export default function Sidebar({ open, activeNav, onClose, onNavClick, isAuthenticated, onLoginClick, onRulesClick, onReviewsClick, }) { const navigate = useNavigate(); const { theme, toggle: toggleTheme } = useTheme(); const { totalUnread } = useUnread(); const { t, i18n } = useTranslation(); const [supportOpen, setSupportOpen] = useState(false); const toggleLang = () => { const next = i18n.language === 'ru' ? 'en' : 'ru'; i18n.changeLanguage(next); localStorage.setItem('i18nextLng', next); }; return ( <>
{t('app.name')}
{NAV_BOTTOM.map(({ icon, key: itemKey, labelKey }) => { const Ic = NavIcons[icon]; const handleBottomClick = () => { if (itemKey === "rules") { onRulesClick?.(); onClose(); return; } if (itemKey === "reviews") { onReviewsClick?.(); onClose(); return; } onNavClick(itemKey); onClose(); }; return (
{t(labelKey)}
); })}
setSupportOpen(true)}> {t('nav.support')}
{theme === "dark" ? ( ) : ( )} {theme === "dark" ? t('sidebar.lightTheme') : t('sidebar.darkTheme')}
{i18n.language === 'ru' ? 'English' : 'Русский'}
{supportOpen && setSupportOpen(false)} />} ); }