Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

layout.tsx 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. '/user/payment'
  16. ];
  17. const shouldSkipLayout = skipLayoutPrefixes.some(prefix =>
  18. pathname.startsWith(prefix)
  19. );
  20. if (shouldSkipLayout) {
  21. return <>{children}</>;
  22. }
  23. return (
  24. <Layout className="!w-full !max-w-[430px] !mx-auto !relative !bg-white">
  25. <Flex vertical className='!h-screen'>
  26. <Row>
  27. <Col span={24}>
  28. <Header />
  29. </Col>
  30. </Row>
  31. <Row className='flex-1 overflow-y-scroll overflow-x-hidden'>
  32. <Col span={24}>{children}</Col>
  33. </Row>
  34. <div>
  35. <Navigation />
  36. </div>
  37. </Flex>
  38. </Layout>
  39. );
  40. }
  41. export default AppLayout;