diff --git a/web/containers/CardSidebar/index.tsx b/web/containers/CardSidebar/index.tsx index 8d0b42314..a90db3790 100644 --- a/web/containers/CardSidebar/index.tsx +++ b/web/containers/CardSidebar/index.tsx @@ -143,7 +143,7 @@ export default function CardSidebar({ {show && (
{min}
diff --git a/web/screens/Chat/Sidebar/index.tsx b/web/screens/Chat/Sidebar/index.tsx index adb0e348d..a410ccf26 100644 --- a/web/screens/Chat/Sidebar/index.tsx +++ b/web/screens/Chat/Sidebar/index.tsx @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import React, { useContext } from 'react' +import React, { useEffect } from 'react' import { FieldValues, useForm } from 'react-hook-form' import { getUserSpace, openFileExplorer, joinPath } from '@janhq/core' @@ -56,7 +56,6 @@ const Sidebar: React.FC = () => { const threadStates = useAtomValue(threadStatesAtom) const threadId = useAtomValue(getActiveThreadIdAtom) const modelEngineParams = toSettingParams(activeModelParams) - const componentDataEngineSetting = getConfigurationsData(modelEngineParams) const onReviewInFinderClick = async (type: string) => { @@ -181,6 +180,23 @@ const Sidebar: React.FC = () => { } } + const onCancel = () => { + form.reset() + } + + const handleEventClick = () => { + return console.log('click') + } + + // Detect event click after changes value in form to showing tooltip on save button + useEffect(() => { + if (Object.keys(form.formState.dirtyFields).length >= 1) { + window.addEventListener('click', handleEventClick) + return () => window.removeEventListener('click', handleEventClick) + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [form.formState.dirtyFields]) + return (