mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 20:29:02 +08:00
Fix/new conversation in mobile phone (#593)
This commit is contained in:
parent
3e1d5ac51b
commit
a6af8e5d8f
@ -1,6 +1,11 @@
|
|||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import {
|
||||||
|
Bars3Icon,
|
||||||
|
PencilSquareIcon,
|
||||||
|
} from '@heroicons/react/24/solid'
|
||||||
import AppIcon from '@/app/components/base/app-icon'
|
import AppIcon from '@/app/components/base/app-icon'
|
||||||
|
|
||||||
export type IHeaderProps = {
|
export type IHeaderProps = {
|
||||||
title: string
|
title: string
|
||||||
customerIcon?: React.ReactNode
|
customerIcon?: React.ReactNode
|
||||||
@ -8,6 +13,8 @@ export type IHeaderProps = {
|
|||||||
icon_background: string
|
icon_background: string
|
||||||
isMobile?: boolean
|
isMobile?: boolean
|
||||||
isEmbedScene?: boolean
|
isEmbedScene?: boolean
|
||||||
|
onShowSideBar?: () => void
|
||||||
|
onCreateNewChat?: () => void
|
||||||
}
|
}
|
||||||
const Header: FC<IHeaderProps> = ({
|
const Header: FC<IHeaderProps> = ({
|
||||||
title,
|
title,
|
||||||
@ -16,22 +23,25 @@ const Header: FC<IHeaderProps> = ({
|
|||||||
icon,
|
icon,
|
||||||
icon_background,
|
icon_background,
|
||||||
isEmbedScene = false,
|
isEmbedScene = false,
|
||||||
|
onShowSideBar,
|
||||||
|
onCreateNewChat,
|
||||||
}) => {
|
}) => {
|
||||||
return !isMobile
|
if (!isMobile)
|
||||||
? null
|
return null
|
||||||
: (
|
|
||||||
|
if (isEmbedScene) {
|
||||||
|
return (
|
||||||
<div
|
<div
|
||||||
className={`shrink-0 flex items-center justify-between h-12 px-3 bg-gray-100 ${
|
className={`
|
||||||
isEmbedScene ? 'bg-gradient-to-r from-blue-600 to-sky-500' : ''
|
shrink-0 flex items-center justify-between h-12 px-3 bg-gray-100
|
||||||
}`}
|
bg-gradient-to-r from-blue-600 to-sky-500
|
||||||
|
`}
|
||||||
>
|
>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
{customerIcon || <AppIcon size="small" icon={icon} background={icon_background} />}
|
{customerIcon || <AppIcon size="small" icon={icon} background={icon_background} />}
|
||||||
<div
|
<div
|
||||||
className={`text-sm text-gray-800 font-bold ${
|
className={'text-sm font-bold text-white'}
|
||||||
isEmbedScene ? 'text-white' : ''
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
</div>
|
</div>
|
||||||
@ -39,6 +49,27 @@ const Header: FC<IHeaderProps> = ({
|
|||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="shrink-0 flex items-center justify-between h-12 px-3 bg-gray-100">
|
||||||
|
<div
|
||||||
|
className='flex items-center justify-center h-8 w-8 cursor-pointer'
|
||||||
|
onClick={() => onShowSideBar?.()}
|
||||||
|
>
|
||||||
|
<Bars3Icon className="h-4 w-4 text-gray-500" />
|
||||||
|
</div>
|
||||||
|
<div className='flex items-center space-x-2'>
|
||||||
|
<AppIcon size="small" icon={icon} background={icon_background} />
|
||||||
|
<div className=" text-sm text-gray-800 font-bold">{title}</div>
|
||||||
|
</div>
|
||||||
|
<div className='flex items-center justify-center h-8 w-8 cursor-pointer'
|
||||||
|
onClick={() => onCreateNewChat?.()}
|
||||||
|
>
|
||||||
|
<PencilSquareIcon className="h-4 w-4 text-gray-500" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default React.memo(Header)
|
export default React.memo(Header)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user