From 70202cceba6e4761c8278d3e27ae2baef1d30f1c Mon Sep 17 00:00:00 2001 From: NamH Date: Sat, 7 Oct 2023 21:41:07 -0700 Subject: [PATCH] fix #283: small ui fixes (#299) Signed-off-by: James Co-authored-by: James --- .../ConfirmDeleteConversationModal/index.tsx | 4 ++-- web/app/_components/LoginButton/index.tsx | 2 +- web/app/_components/ModelSelector/index.tsx | 12 ++++++------ web/app/_components/PrimaryButton/index.tsx | 2 +- web/app/_components/SendButton/index.tsx | 2 +- web/app/_components/SimpleTextMessage/index.tsx | 2 +- web/app/_hooks/useDeleteConversation.ts | 16 ++++++++++------ 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/web/app/_components/ConfirmDeleteConversationModal/index.tsx b/web/app/_components/ConfirmDeleteConversationModal/index.tsx index 4904bc454..42160a1ce 100644 --- a/web/app/_components/ConfirmDeleteConversationModal/index.tsx +++ b/web/app/_components/ConfirmDeleteConversationModal/index.tsx @@ -63,8 +63,8 @@ const ConfirmDeleteConversationModal: React.FC = () => {

Are you sure you want to delete this conversation? All - of messages will be permanently removed from our servers - forever. This action cannot be undone. + of messages will be permanently removed. This action + cannot be undone.

diff --git a/web/app/_components/LoginButton/index.tsx b/web/app/_components/LoginButton/index.tsx index c6f09ef70..5f4725cbd 100644 --- a/web/app/_components/LoginButton/index.tsx +++ b/web/app/_components/LoginButton/index.tsx @@ -12,7 +12,7 @@ const LoginButton: React.FC = () => { // diff --git a/web/app/_components/ModelSelector/index.tsx b/web/app/_components/ModelSelector/index.tsx index 0b527117a..b32cd7c4e 100644 --- a/web/app/_components/ModelSelector/index.tsx +++ b/web/app/_components/ModelSelector/index.tsx @@ -36,7 +36,7 @@ const SelectModels: React.FC = () => { Select a Model:
- + { key={model.id} className={({ active }) => classNames( - active ? "bg-indigo-600 text-white" : "text-gray-900", - "relative cursor-default select-none py-2 pl-3 pr-9" + active ? "bg-blue-600 text-white" : "text-gray-900", + "relative cursor-default select-none py-2 pl-3 pr-9", ) } value={model} @@ -85,7 +85,7 @@ const SelectModels: React.FC = () => { {model.name} @@ -95,8 +95,8 @@ const SelectModels: React.FC = () => { {selected ? (
)) ) : ( - {text} + {text} )} diff --git a/web/app/_hooks/useDeleteConversation.ts b/web/app/_hooks/useDeleteConversation.ts index 61a3c3653..dc1fd2c41 100644 --- a/web/app/_hooks/useDeleteConversation.ts +++ b/web/app/_hooks/useDeleteConversation.ts @@ -19,12 +19,13 @@ import { export default function useDeleteConversation() { const [userConversations, setUserConversations] = useAtom( - userConversationsAtom + userConversationsAtom, ); const setCurrentPrompt = useSetAtom(currentPromptAtom); const setShowingProductDetail = useSetAtom(showingProductDetailAtom); const setShowingAdvancedPrompt = useSetAtom(showingAdvancedPromptAtom); const activeConvoId = useAtomValue(getActiveConvoIdAtom); + const setActiveConvoId = useSetAtom(setActiveConvoIdAtom); const deleteMessages = useSetAtom(deleteConversationMessage); const setMainViewState = useSetAtom(setMainViewStateAtom); @@ -34,14 +35,17 @@ export default function useDeleteConversation() { try { await execute(DataService.DELETE_CONVERSATION, activeConvoId); const currentConversations = userConversations.filter( - (c) => c.id !== activeConvoId + (c) => c.id !== activeConvoId, ); setUserConversations(currentConversations); - if (currentConversations.length === 0) { - setMainViewState(MainViewState.Welcome); - } deleteMessages(activeConvoId); - setActiveConvoId(undefined); + + if (currentConversations.length > 0) { + setActiveConvoId(currentConversations[0].id); + } else { + setMainViewState(MainViewState.Welcome); + setActiveConvoId(undefined); + } setCurrentPrompt(""); setShowingProductDetail(false); setShowingAdvancedPrompt(false);