side-bar.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. key: 'app',
  20. name: '应用程序',
  21. path: '/construct/app',
  22. isActive: pathname === '/construct/app',
  23. icon: <AppstoreOutlined />,
  24. },
  25. {
  26. key: 'flow',
  27. name: 'AWEL 工作流',
  28. icon: <ForkOutlined />,
  29. isActive: pathname === '/construct/flow',
  30. path: '/construct/flow',
  31. },
  32. {
  33. key: 'models',
  34. name: '模型管理',
  35. path: '/construct/models',
  36. isActive: pathname === '/construct/models',
  37. icon: <Icon component={ModelSvg} />,
  38. },
  39. {
  40. key: 'database',
  41. name: '数据库',
  42. icon: <ConsoleSqlOutlined />,
  43. isActive: pathname === '/construct/database',
  44. path: '/construct/database',
  45. },
  46. {
  47. key: 'knowledge',
  48. name: '知识库',
  49. icon: <PartitionOutlined />,
  50. isActive: pathname === '/construct/knowledge',
  51. path: '/construct/knowledge',
  52. },
  53. {
  54. key: 'prompt',
  55. name: '提示词',
  56. icon: <MessageOutlined />,
  57. isActive: pathname === '/construct/prompt',
  58. path: '/construct/prompt',
  59. }
  60. ]
  61. return (
  62. <div
  63. className={`
  64. flex flex-col
  65. justify-between
  66. h-screen px-4
  67. pt-4
  68. bg-[#fff]
  69. animate-fade
  70. animate-duration-300`
  71. }
  72. >
  73. <div>
  74. <Link href='/' className=' flex items-center justify-center p-2 pb-4'>
  75. <Image src={'/LOGO_PVC.png'} alt='PVC-CHAT' width={40} height={40} />
  76. PVC-CHAT
  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 dark:hover:bg-theme-dark hover:rounded-xl',
  89. {
  90. 'rounded-xl': item.isActive,
  91. 'hover:bg-[#d8d8d8]': !item.isActive,
  92. 'hover:text-[#3d8dfc]': !item.isActive,
  93. }
  94. )}
  95. >
  96. <div className='mr-3'>{item.icon}</div>
  97. <span className='text-sm'>{(item.name as any)}</span>
  98. </Link>
  99. )
  100. )}
  101. </div>
  102. </div>
  103. <div className='mb-4'>
  104. <UserBar />
  105. </div>
  106. </div>
  107. );
  108. }
  109. export default SideBar;