From c77107500eab6a52becdb026f93492879bea1118 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 9 May 2025 15:44:03 -0600 Subject: [PATCH] setup warning --- .../HomePage/HomePageController.tsx | 31 +++++++++++++------ web/src/controllers/HomePage/NewChatInput.tsx | 17 ++++------ .../controllers/HomePage/NewChatWarning.tsx | 20 +++++++----- .../controllers/HomePage/useNewChatWarning.ts | 1 - 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/web/src/controllers/HomePage/HomePageController.tsx b/web/src/controllers/HomePage/HomePageController.tsx index 158b3472f..679eedbda 100644 --- a/web/src/controllers/HomePage/HomePageController.tsx +++ b/web/src/controllers/HomePage/HomePageController.tsx @@ -4,8 +4,13 @@ import React, { useMemo } from 'react'; import { Title } from '@/components/ui/typography'; import { useUserConfigContextSelector } from '@/context/Users'; import { NewChatInput } from './NewChatInput'; +import { useNewChatWarning } from './useNewChatWarning'; +import { NewChatWarning } from './NewChatWarning'; export const HomePageController: React.FC<{}> = () => { + const newChatWarningProps = useNewChatWarning(); + const { showWarning } = newChatWarningProps; + const user = useUserConfigContextSelector((state) => state.user); const userName = user?.name; @@ -24,18 +29,24 @@ export const HomePageController: React.FC<{}> = () => { return (
-
-
- - {greeting} - - - How can I help you today? - + {showWarning ? ( +
+
+ ) : ( +
+
+ + {greeting} + + + How can I help you today? + +
- -
+ +
+ )}
); }; diff --git a/web/src/controllers/HomePage/NewChatInput.tsx b/web/src/controllers/HomePage/NewChatInput.tsx index 31f911016..8b31f1167 100644 --- a/web/src/controllers/HomePage/NewChatInput.tsx +++ b/web/src/controllers/HomePage/NewChatInput.tsx @@ -20,12 +20,10 @@ export const NewChatInput: React.FC<{}> = () => { const [inputValue, setInputValue] = useState(''); const [loading, setLoading] = useState(false); const textAreaRef = useRef(null); - const newChatWarningProps = useNewChatWarning(); - const { showWarning } = newChatWarningProps; const disabledSubmit = useMemo(() => { - return !inputHasText(inputValue) || showWarning; - }, [inputValue, showWarning]); + return !inputHasText(inputValue); + }, [inputValue]); const onSubmit = useMemoizedFn(async (value: string) => { if (disabledSubmit) return; @@ -54,23 +52,20 @@ export const NewChatInput: React.FC<{}> = () => { }); return ( -
+ <> - {newChatWarningProps.showWarning && } -
+ ); }; diff --git a/web/src/controllers/HomePage/NewChatWarning.tsx b/web/src/controllers/HomePage/NewChatWarning.tsx index 51dd2ab21..c21c7a133 100644 --- a/web/src/controllers/HomePage/NewChatWarning.tsx +++ b/web/src/controllers/HomePage/NewChatWarning.tsx @@ -16,20 +16,24 @@ export const NewChatWarning = React.memo(({}: ReturnType -
+
+
Setup Checklist
{progress}/2 completed
-
+
+ + In order to ask questions, you need to connect a data source and create a dataset. + +
{status ? : number}
@@ -111,7 +115,7 @@ const SetupItem = ({ number, status, title, description, link, linkText }: Setup
{title} {status && ( - + Complete )} diff --git a/web/src/controllers/HomePage/useNewChatWarning.ts b/web/src/controllers/HomePage/useNewChatWarning.ts index 8cddb5249..a6154e28f 100644 --- a/web/src/controllers/HomePage/useNewChatWarning.ts +++ b/web/src/controllers/HomePage/useNewChatWarning.ts @@ -7,7 +7,6 @@ export const useNewChatWarning = () => { const { data: datasources, isFetched: isDatasourcesFetched } = useListDatasources(); const showWarning = useMemo(() => { - return true; if (!isDatasetsFetched || !isDatasourcesFetched) return false; if (datasets?.length === 0) return true; if (datasources?.length === 0) return true;