diff --git a/apps/web/Components/Calculation/index.tsx b/apps/web/Components/Calculation/index.tsx index 0c3f819..ebf87f7 100644 --- a/apps/web/Components/Calculation/index.tsx +++ b/apps/web/Components/Calculation/index.tsx @@ -9,7 +9,10 @@ import { NavigationProvider } from '@/context/navigation'; import { useErrors } from '@/stores/hooks'; import { Media } from '@/styles/media'; import { getPageTitle } from '@/utils/page'; +import { observer } from 'mobx-react-lite'; import Head from 'next/head'; +import styled from 'styled-components'; +import { Badge } from 'ui/elements'; import { BarChartOutlined, CalculatorOutlined, @@ -19,35 +22,42 @@ import { const defaultIconStyle = { fontSize: '1.2rem' }; +const StyledBadge = styled(Badge)` + color: unset !important; +`; + export const tabs = [ { Component: Settings, - icon: , + Icon: () => , key: 'settings', title: 'Интерес/Расчет', }, { Component: Form, - icon: , + Icon: () => , key: 'form', title: 'Параметры', }, { Component: Output, - icon: , + Icon: () => , key: 'output', title: 'Результаты', }, { Component: Validation, - icon: , - key: 'errors', - title: 'Ошибки', - useShowBadge: () => { + Icon: observer(() => { const { hasErrors } = useErrors(); - return hasErrors; - }, + return ( + + + + ); + }), + key: 'errors', + title: 'Ошибки', }, ]; diff --git a/apps/web/Components/Layout/Navigation.jsx b/apps/web/Components/Layout/Navigation.jsx index 30d34ee..26848ae 100644 --- a/apps/web/Components/Layout/Navigation.jsx +++ b/apps/web/Components/Layout/Navigation.jsx @@ -1,7 +1,6 @@ import { NavigationContext } from '@/context/navigation'; import { useContext, useEffect } from 'react'; import styled from 'styled-components'; -import { Badge } from 'ui/elements'; import { Flex } from 'ui/grid'; const Container = styled.div` @@ -29,19 +28,15 @@ const TabButton = styled.button` font-size: 0.75rem; `; -const StyledBadge = styled(Badge)` - color: unset !important; -`; - export function NavigationBar() { const { currentTab, setCurrentTab, tabsList } = useContext(NavigationContext); return ( - {tabsList.map(({ icon, key, title, useShowBadge }) => ( + {tabsList.map(({ Icon, key, title }) => ( setCurrentTab(key)}> - {icon} + {title}