Fix: hide view chat setting button when no inputs form (#19263)

pull/19278/head
KVOJJJin 1 year ago committed by GitHub
parent 8537abfff8
commit b78846078c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -27,6 +27,7 @@ const HeaderInMobile = () => {
handleDeleteConversation, handleDeleteConversation,
handleRenameConversation, handleRenameConversation,
conversationRenaming, conversationRenaming,
inputsForms,
} = useChatWithHistoryContext() } = useChatWithHistoryContext()
const { t } = useTranslation() const { t } = useTranslation()
const isPin = pinnedConversationList.some(item => item.id === currentConversationId) const isPin = pinnedConversationList.some(item => item.id === currentConversationId)
@ -99,6 +100,7 @@ const HeaderInMobile = () => {
<MobileOperationDropdown <MobileOperationDropdown
handleResetChat={handleNewConversation} handleResetChat={handleNewConversation}
handleViewChatSettings={() => setShowChatSettings(true)} handleViewChatSettings={() => setShowChatSettings(true)}
hideViewChatSettings={inputsForms.length < 1}
/> />
</div> </div>
{showSidebar && ( {showSidebar && (

@ -9,11 +9,13 @@ import ActionButton, { ActionButtonState } from '@/app/components/base/action-bu
type Props = { type Props = {
handleResetChat: () => void handleResetChat: () => void
handleViewChatSettings: () => void handleViewChatSettings: () => void
hideViewChatSettings?: boolean
} }
const MobileOperationDropdown = ({ const MobileOperationDropdown = ({
handleResetChat, handleResetChat,
handleViewChatSettings, handleViewChatSettings,
hideViewChatSettings = false,
}: Props) => { }: Props) => {
const { t } = useTranslation() const { t } = useTranslation()
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
@ -42,9 +44,11 @@ const MobileOperationDropdown = ({
<div className='system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover' onClick={handleResetChat}> <div className='system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover' onClick={handleResetChat}>
<span className='grow'>{t('share.chat.resetChat')}</span> <span className='grow'>{t('share.chat.resetChat')}</span>
</div> </div>
<div className='system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover' onClick={handleViewChatSettings}> {!hideViewChatSettings && (
<span className='grow'>{t('share.chat.viewChatSettings')}</span> <div className='system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover' onClick={handleViewChatSettings}>
</div> <span className='grow'>{t('share.chat.viewChatSettings')}</span>
</div>
)}
</div> </div>
</PortalToFollowElemContent> </PortalToFollowElemContent>
</PortalToFollowElem> </PortalToFollowElem>

Loading…
Cancel
Save