side-bar.tsx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import UserBar from '@/new-components/layout/UserBar';
  2. import Icon, { AppstoreOutlined, BuildOutlined, ConsoleSqlOutlined, ForkOutlined, MessageOutlined, PartitionOutlined, SearchOutlined } from '@ant-design/icons';
  3. import cls from 'classnames';
  4. import 'moment/locale/zh-cn';
  5. import Image from 'next/image';
  6. import Link from 'next/link';
  7. import { useRouter } from 'next/router';
  8. import { ModelSvg } from '@/components/icons';
  9. function SideBar() {
  10. const { pathname } = useRouter();
  11. const menus = [
  12. {
  13. key: 'explore',
  14. name: '探索',
  15. isActive: pathname === '/',
  16. icon: <SearchOutlined />,
  17. path: '/',
  18. },
  19. {
  20. key: 'app',
  21. name: '应用程序',
  22. path: '/construct/app',
  23. isActive: pathname === '/construct/app',
  24. icon: <AppstoreOutlined />,
  25. },
  26. {
  27. key: 'flow',
  28. name: 'AWEL 工作流',
  29. icon: <ForkOutlined />,
  30. isActive: pathname === '/construct/flow',
  31. path: '/construct/flow',
  32. },
  33. {
  34. key: 'models',
  35. name: '模型管理',
  36. path: '/construct/models',
  37. isActive: pathname === '/construct/models',
  38. icon: <Icon component={ModelSvg} />,
  39. },
  40. {
  41. key: 'database',
  42. name: '数据库',
  43. icon: <ConsoleSqlOutlined />,
  44. isActive: pathname === '/construct/database',
  45. path: '/construct/database',
  46. },
  47. {
  48. key: 'knowledge',
  49. name: '知识库',
  50. icon: <PartitionOutlined />,
  51. isActive: pathname === '/construct/knowledge',
  52. path: '/construct/knowledge',
  53. },
  54. {
  55. key: 'prompt',
  56. name: '提示词',
  57. icon: <MessageOutlined />,
  58. isActive: pathname === '/construct/prompt',
  59. path: '/construct/prompt',
  60. },
  61. ];
  62. return (
  63. <div
  64. className={`
  65. flex flex-col
  66. justify-between
  67. h-screen px-4
  68. pt-4 bg-bar
  69. dark:bg-[#232734]
  70. animate-fade
  71. animate-duration-300`}
  72. >
  73. <div>
  74. <Link href='/' className='flex items-center justify-center p-2 pb-4'>
  75. <Image src={'/LOGO_PVC-removebg-preview.png'} alt='PVC-CHAT' width={40} height={40} />
  76. <span className={'ml-2 text-lg font-bold'}>PVC-GPT</span>
  77. </Link>
  78. <div className='gap-2 flex flex-col '>
  79. {menus.map(item => (
  80. <Link
  81. href={item.path}
  82. key={item.path}
  83. style={{
  84. backgroundColor: item.isActive ? '#7288FA' : '',
  85. color: item.isActive ? '#fff' : '',
  86. }}
  87. className={cls(
  88. 'flex items-center w-full h-12 px-4 cursor-pointer hover:bg-[#fff] dark:hover:bg-theme-dark hover:rounded-xl',
  89. {
  90. 'rounded-xl': item.isActive,
  91. },
  92. 'hover:text-[#3d8dfc]',
  93. )}
  94. >
  95. <div className='mr-3'>{item.icon}</div>
  96. <span className='text-sm'>{item.name as any}</span>
  97. </Link>
  98. ))}
  99. </div>
  100. </div>
  101. <div className='mb-4'>
  102. <UserBar />
  103. </div>
  104. </div>
  105. );
  106. }
  107. export default SideBar;