Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

layout.tsx 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use client'
  2. import React from 'react'
  3. import { Layout, Flex, Row, Col } from 'antd'
  4. import Header from '@/components/layout/Header'
  5. import Navigation from '@/components/layout/Navigation'
  6. import { usePathname } from 'next/navigation'
  7. const AppLayout = ({ children }: { children: React.ReactNode }) => {
  8. const pathname = usePathname()
  9. const skipLayoutPrefixes = [
  10. '/user/chat/',
  11. '/user/persona/create',
  12. '/user/knowledge/create',
  13. '/user/settings/profile',
  14. '/user/payment'
  15. ];
  16. const shouldSkipLayout = skipLayoutPrefixes.some(prefix =>
  17. pathname.startsWith(prefix)
  18. );
  19. if (shouldSkipLayout) {
  20. return <>{children}</>;
  21. }
  22. return (
  23. <Layout className="!w-full !max-w-[430px] !mx-auto !relative !bg-white">
  24. <Flex vertical className='!h-screen'>
  25. <Row>
  26. <Col span={24}>
  27. <Header />
  28. </Col>
  29. </Row>
  30. <Row className='flex-1 overflow-y-scroll overflow-x-hidden'>
  31. <Col span={24}>{children}</Col>
  32. </Row>
  33. <div>
  34. <Navigation />
  35. </div>
  36. </Flex>
  37. </Layout>
  38. );
  39. }
  40. export default AppLayout;