header.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import type { FC } from 'react'
  2. import React from 'react'
  3. import { useTranslation } from 'react-i18next'
  4. // import AppIcon from '@/app/components/base/app-icon'
  5. import { ReplayIcon } from '@/app/components/app/chat/icon-component'
  6. import Tooltip from '@/app/components/base/tooltip'
  7. export type IHeaderProps = {
  8. isMobile?: boolean
  9. customerIcon?: React.ReactNode
  10. title: string
  11. // icon: string
  12. // icon_background: string
  13. onCreateNewChat?: () => void
  14. }
  15. const Header: FC<IHeaderProps> = ({
  16. isMobile,
  17. customerIcon,
  18. title,
  19. // icon,
  20. // icon_background,
  21. onCreateNewChat,
  22. }) => {
  23. const { t } = useTranslation()
  24. if (!isMobile)
  25. return null
  26. return (
  27. <div
  28. className={`
  29. shrink-0 flex items-center justify-between h-14 px-4 bg-gray-100
  30. bg-gradient-to-r from-blue-600 to-sky-500
  31. `}
  32. >
  33. <div className="flex items-center space-x-2">
  34. {customerIcon}
  35. <div
  36. className={'text-sm font-bold text-white'}
  37. >
  38. {title}
  39. </div>
  40. </div>
  41. <Tooltip
  42. selector={'embed-scene-restart-button'}
  43. htmlContent={t('share.chat.resetChat')}
  44. position='top'
  45. >
  46. <div className='flex cursor-pointer hover:rounded-lg hover:bg-black/5 w-8 h-8 items-center justify-center' onClick={() => {
  47. onCreateNewChat?.()
  48. }}>
  49. <ReplayIcon className="h-4 w-4 text-sm font-bold text-white" />
  50. </div>
  51. </Tooltip>
  52. </div>
  53. )
  54. }
  55. export default React.memo(Header)