diff --git a/apps/web/app/(main)/contacts/page.tsx b/apps/web/app/(main)/contacts/page.tsx index 86e7091..2048f87 100644 --- a/apps/web/app/(main)/contacts/page.tsx +++ b/apps/web/app/(main)/contacts/page.tsx @@ -1,12 +1,12 @@ import { ContactsList } from '@/components/contacts/contacts-list'; import { ContactsFilter } from '@/components/contacts/dropdown-filter'; -import { NavigationMeta } from '@/components/navigation'; +import { PageHeader } from '@/components/navigation'; import { ContactsFilterProvider } from '@/context/contacts-filter'; export default function ContactsPage() { return ( - +
diff --git a/apps/web/app/(main)/layout.tsx b/apps/web/app/(main)/layout.tsx index 145d0fc..b3c37f7 100644 --- a/apps/web/app/(main)/layout.tsx +++ b/apps/web/app/(main)/layout.tsx @@ -1,13 +1,11 @@ -import { BottomNav, PageHeader } from '@/components/navigation'; -import { NavigationProvider } from '@/context/navigation'; +import { BottomNav } from '@/components/navigation'; import { type PropsWithChildren } from 'react'; export default async function Layout({ children }: Readonly) { return ( - - + <>
{children}
-
+ ); } diff --git a/apps/web/app/(main)/profile/[telegramId]/page.tsx b/apps/web/app/(main)/profile/[telegramId]/page.tsx index c28c768..c94b1b4 100644 --- a/apps/web/app/(main)/profile/[telegramId]/page.tsx +++ b/apps/web/app/(main)/profile/[telegramId]/page.tsx @@ -1,12 +1,9 @@ import { getProfile } from '@/actions/profile'; +import { PageHeader } from '@/components/navigation'; import { ProfileCard } from '@/components/profile/profile-card'; import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query'; -type Props = { - params: Promise<{ - telegramId: string; - }>; -}; +type Props = { params: Promise<{ telegramId: string }> }; export default async function ProfilePage(props: Readonly) { const parameters = await props.params; @@ -21,6 +18,7 @@ export default async function ProfilePage(props: Readonly) { return ( + ); diff --git a/apps/web/app/(main)/profile/page.tsx b/apps/web/app/(main)/profile/page.tsx index ad11357..72e89cb 100644 --- a/apps/web/app/(main)/profile/page.tsx +++ b/apps/web/app/(main)/profile/page.tsx @@ -1,5 +1,5 @@ import { getProfile } from '@/actions/profile'; -import { NavigationMeta } from '@/components/navigation/meta'; +import { PageHeader } from '@/components/navigation'; import { ProfileCard } from '@/components/profile/profile-card'; import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query'; @@ -13,7 +13,7 @@ export default async function ProfilePage() { return ( - + ); diff --git a/apps/web/components/navigation/header/index.tsx b/apps/web/components/navigation/header/index.tsx index a8aad82..1dbc698 100644 --- a/apps/web/components/navigation/header/index.tsx +++ b/apps/web/components/navigation/header/index.tsx @@ -2,11 +2,13 @@ import { BackButton } from './back-button'; import { PageTitle } from './page-title'; -export function PageHeader() { +type Props = { title: string | undefined }; + +export function PageHeader(props: Readonly) { return (
- +
); } diff --git a/apps/web/components/navigation/header/page-title.tsx b/apps/web/components/navigation/header/page-title.tsx index 3d02637..967c468 100644 --- a/apps/web/components/navigation/header/page-title.tsx +++ b/apps/web/components/navigation/header/page-title.tsx @@ -1,8 +1,5 @@ -import { NavigationContext } from '@/context/navigation'; -import { use } from 'react'; +type Props = { readonly title: string | undefined }; -export function PageTitle() { - const context = use(NavigationContext); - - return {context?.title}; +export function PageTitle(props: Readonly) { + return {props?.title}; } diff --git a/apps/web/components/navigation/index.tsx b/apps/web/components/navigation/index.tsx index d6a42ad..bb1137c 100644 --- a/apps/web/components/navigation/index.tsx +++ b/apps/web/components/navigation/index.tsx @@ -1,3 +1,2 @@ export * from './header'; -export * from './meta'; export * from './navbar'; diff --git a/apps/web/components/navigation/meta.tsx b/apps/web/components/navigation/meta.tsx deleted file mode 100644 index edb6039..0000000 --- a/apps/web/components/navigation/meta.tsx +++ /dev/null @@ -1,13 +0,0 @@ -'use client'; -import { NavigationContext } from '@/context/navigation'; -import { use, useEffect } from 'react'; - -export function NavigationMeta(props: Readonly<{ title: string }>) { - const navigation = use(NavigationContext); - - useEffect(() => { - navigation?.setTitle(props.title); - }, [navigation, props.title]); - - return false; -} diff --git a/apps/web/context/navigation.tsx b/apps/web/context/navigation.tsx deleted file mode 100644 index 11a3fc8..0000000 --- a/apps/web/context/navigation.tsx +++ /dev/null @@ -1,17 +0,0 @@ -'use client'; -import { createContext, type PropsWithChildren, useMemo, useState } from 'react'; - -type ContextType = { - setTitle: (title: null | string) => void; - title: null | string; -}; - -export const NavigationContext = createContext(null); - -export function NavigationProvider({ children }: Readonly) { - const [title, setTitle] = useState(null); - - const value = useMemo(() => ({ setTitle, title }), [setTitle, title]); - - return {children}; -}