index.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import {
  2. memo,
  3. } from 'react'
  4. import { RiCloseLine } from '@remixicon/react'
  5. import { useTranslation } from 'react-i18next'
  6. import type { GlobalVariable } from '../../types'
  7. import Item from './item'
  8. import { useStore } from '@/app/components/workflow/store'
  9. import cn from '@/utils/classnames'
  10. const Panel = () => {
  11. const { t } = useTranslation()
  12. const setShowPanel = useStore(s => s.setShowGlobalVariablePanel)
  13. const globalVariableList: GlobalVariable[] = [
  14. {
  15. name: 'conversation_id',
  16. value_type: 'string',
  17. description: 'conversation id',
  18. },
  19. ]
  20. return (
  21. <div
  22. className={cn(
  23. 'relative flex flex-col w-[420px] bg-components-panel-bg-alt rounded-l-2xl h-full border border-components-panel-border',
  24. )}
  25. >
  26. <div className='shrink-0 flex items-center justify-between p-4 pb-0 text-text-primary system-xl-semibold'>
  27. Global Variables(Current not show)
  28. <div className='flex items-center'>
  29. <div
  30. className='flex items-center justify-center w-6 h-6 cursor-pointer'
  31. onClick={() => setShowPanel(false)}
  32. >
  33. <RiCloseLine className='w-4 h-4 text-text-tertiary' />
  34. </div>
  35. </div>
  36. </div>
  37. <div className='shrink-0 py-1 px-4 system-sm-regular text-text-tertiary'>...</div>
  38. <div className='grow px-4 rounded-b-2xl overflow-y-auto'>
  39. {globalVariableList.map(item => (
  40. <Item
  41. key={item.name}
  42. payload={item}
  43. />
  44. ))}
  45. </div>
  46. </div>
  47. )
  48. }
  49. export default memo(Panel)