Files
no-copy-frontend/src/app/pages/layout.tsx
T

31 lines
848 B
TypeScript
Raw Normal View History

2025-11-25 17:13:16 +07:00
import NavLinks from '@/app/ui/nav-links'
2025-12-09 16:35:47 +07:00
import styles from '@/app/styles/page.module.scss'
2025-11-26 14:01:35 +07:00
import HeaderPanel from '../ui/header/headerPanel';
2025-12-02 17:11:53 +07:00
import { getQueryClient } from '@/app/providers/getQueryClient';
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
2025-12-09 16:35:47 +07:00
import { getUserData } from '@/app/actions/action';
2025-11-29 14:40:26 +07:00
export default async function Layout({ children }: { children: React.ReactNode }) {
2025-12-02 17:11:53 +07:00
const queryClient = getQueryClient();
2025-11-29 14:40:26 +07:00
2025-12-02 17:11:53 +07:00
await Promise.all([
queryClient.prefetchQuery({
queryKey: ['userData'],
queryFn: () => getUserData()
})
])
2025-11-25 17:13:16 +07:00
return (
2025-12-02 17:11:53 +07:00
<div className="flex">
<HydrationBoundary state={dehydrate(queryClient)}>
2025-11-29 14:40:26 +07:00
<NavLinks />
2025-12-09 16:35:47 +07:00
<div className={`${styles['main-containter']}`}>
2025-11-29 14:40:26 +07:00
<HeaderPanel />
<main>
{children}
</main>
</div>
2025-12-02 17:11:53 +07:00
</HydrationBoundary>
</div>
2025-11-25 17:13:16 +07:00
);
}