You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

layout.tsx 1.1KB

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