diff --git a/apps/web/Components/Layout/index.jsx b/apps/web/Components/Layout/index.jsx index 3001ee9..0e26523 100644 --- a/apps/web/Components/Layout/index.jsx +++ b/apps/web/Components/Layout/index.jsx @@ -1,8 +1,5 @@ import Header from './Header'; import { AppMenu } from './Menu'; -import { NavigationBar } from './Navigation'; -import { NavigationProvider } from '@/context/navigation'; -import { Media } from '@/styles/media'; import { max, min } from '@/styles/mq'; import styled from 'styled-components'; @@ -20,13 +17,10 @@ const Main = styled.main` export default function Layout({ children, user }) { return ( - + <>
{user?.admin ? : false}
{children}
- - - - + ); } diff --git a/apps/web/pages/index.jsx b/apps/web/pages/index.jsx index 23ff133..d57191a 100644 --- a/apps/web/pages/index.jsx +++ b/apps/web/pages/index.jsx @@ -1,8 +1,8 @@ import initializeApollo from '@/apollo/client'; import * as Calculation from '@/Components/Calculation'; import { Error } from '@/Components/Common/Error'; -import { Tabs } from '@/Components/Layout/Navigation'; -import { NavigationContext } from '@/context/navigation'; +import { NavigationBar, Tabs } from '@/Components/Layout/Navigation'; +import { NavigationContext, NavigationProvider } from '@/context/navigation'; import * as hooks from '@/process/hooks'; import { Media } from '@/styles/media'; import { getPageTitle } from '@/utils/page'; @@ -13,28 +13,24 @@ import { useContext, useEffect } from 'react'; export const tabs = [ { - Component: () => , + Component: Calculation.Form, + key: 'form', + title: 'Параметры', + }, + { + Component: Calculation.Settings, key: 'settings', title: 'Расчет', }, { - Component: () => , - key: 'form', - title: 'Параметры', - }, - - { - Component: () => , + Component: Calculation.Output, key: 'output', title: 'Результаты', }, ]; -function Content() { - hooks.useSentryScope(); - hooks.useMainData(); - hooks.useInsuranceData(); - hooks.useReactions(); +export function Content({ initHooks, title }) { + initHooks(); const { setCurrentTab, setTabsList } = useContext(NavigationContext); @@ -46,16 +42,17 @@ function Content() { return ( <> - {getPageTitle()} + {getPageTitle(title)} + - - - + {tabs.map(({ Component, key }) => ( + + ))} @@ -65,7 +62,18 @@ function Content() { export default function Page(props) { if (props.statusCode !== 200) return ; - return ; + return ( + + { + hooks.useSentryScope(); + hooks.useMainData(); + hooks.useInsuranceData(); + hooks.useReactions(); + }} + /> + + ); } /** @type {import('next').GetServerSideProps} */ diff --git a/apps/web/pages/unlimited.jsx b/apps/web/pages/unlimited.jsx index e610477..6fe8d12 100644 --- a/apps/web/pages/unlimited.jsx +++ b/apps/web/pages/unlimited.jsx @@ -1,54 +1,28 @@ -import { tabs } from '.'; +import { Content } from '.'; import initializeApollo from '@/apollo/client'; -import * as Calculation from '@/Components/Calculation'; import { Error } from '@/Components/Common/Error'; -import { Tabs } from '@/Components/Layout/Navigation'; -import { NavigationContext } from '@/context/navigation'; +import { NavigationProvider } from '@/context/navigation'; import * as hooks from '@/process/hooks'; -import { Media } from '@/styles/media'; -import { getPageTitle } from '@/utils/page'; import { makeGetUserType } from '@/utils/user'; import { dehydrate, QueryClient } from '@tanstack/react-query'; -import Head from 'next/head'; -import { useContext, useEffect } from 'react'; - -function Content() { - hooks.useSentryScope(); - hooks.useMainData(); - hooks.useGetUsers(); - hooks.useInsuranceData(); - hooks.useReactions(); - - const { setCurrentTab, setTabsList } = useContext(NavigationContext); - - useEffect(() => { - setTabsList(tabs); - setCurrentTab('settings'); - }, [setCurrentTab, setTabsList]); - - return ( - <> - - {getPageTitle('Без ограничений')} - - - - - - - - - - - - - ); -} export default function Page(props) { if (props.statusCode !== 200) return ; - return ; + return ( + + { + hooks.useSentryScope(); + hooks.useMainData(); + hooks.useGetUsers(); + hooks.useInsuranceData(); + hooks.useReactions(); + }} + /> + + ); } /** @type {import('next').GetServerSideProps} */