diff --git a/src/components/sideBar/index.tsx b/src/components/sideBar/index.tsx index 884fd0e..9928a2c 100644 --- a/src/components/sideBar/index.tsx +++ b/src/components/sideBar/index.tsx @@ -7,8 +7,12 @@ import { db } from '../../service/firebase/firebase'; import ChatRow from './ChatRow'; import Setting from '../setting'; import { useI18n } from '@/hook/useI18n'; +import BasicInput from '../Input'; +import { useState } from 'react'; function SideBar() { + const [searchValue, setSearchValue] = useState(''); + const { data: session } = useSession(); const { t } = useI18n(); @@ -37,14 +41,34 @@ function SideBar() { ) : ( <> +
+ +
+ {chats?.docs?.map((doc) => { - return ( - - ); + const { title } = doc.data(); + if (searchValue) { + if (title && title.includes(searchValue)) { + return ( + + ); + } + } else { + return ( + + ); + } })} )} diff --git a/src/i18n/en/common.json b/src/i18n/en/common.json index d2c54a1..c3e0737 100644 --- a/src/i18n/en/common.json +++ b/src/i18n/en/common.json @@ -43,5 +43,6 @@ "promptContent": "Enter your prompt here", "addPrompt": "Add Prompt", "cancelAddPrompt": "Cancel", - "noCustomPrompt": "You don't have custom prompts, add one first" + "noCustomPrompt": "You don't have custom prompts, add one first", + "searchTitle": "Enter title" } diff --git a/src/i18n/zh/common.json b/src/i18n/zh/common.json index b4f070f..061a385 100644 --- a/src/i18n/zh/common.json +++ b/src/i18n/zh/common.json @@ -43,5 +43,6 @@ "promptContent": "输入你的 Prompt", "addPrompt": "添加 Prompt", "cancelAddPrompt": "取消", - "noCustomPrompt": "你没有自定义的 Prompts,先添加一个吧~" + "noCustomPrompt": "你没有自定义的 Prompts,先添加一个吧~", + "searchTitle": "输入要查找的标题" }