From 1d24f39830d31abe6ed3d6aac5b1f7b8156e7a3f Mon Sep 17 00:00:00 2001 From: Danny Avila <110412045+danny-avila@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:00:57 -0500 Subject: [PATCH] style: update Mobile Nav with new ChatGPT styling; fix: New Chat on Mobile will correctly reset conversation state (#1255) --- client/src/components/Nav/MobileNav.tsx | 60 +++++++++++++------------ client/src/routes/Root.tsx | 4 +- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/client/src/components/Nav/MobileNav.tsx b/client/src/components/Nav/MobileNav.tsx index 8c7650ad27..3edafe8c38 100644 --- a/client/src/components/Nav/MobileNav.tsx +++ b/client/src/components/Nav/MobileNav.tsx @@ -1,37 +1,41 @@ import React from 'react'; import { useRecoilValue } from 'recoil'; -import { useLocalize, useConversation } from '~/hooks'; +import type { Dispatch, SetStateAction } from 'react'; +import { useLocalize, useNewConvo } from '~/hooks'; import store from '~/store'; -export default function MobileNav({ setNavVisible }) { - const conversation = useRecoilValue(store.conversation); - const { newConversation } = useConversation(); - const { title = 'New Chat' } = conversation || {}; +export default function MobileNav({ + setNavVisible, +}: { + setNavVisible: Dispatch>; +}) { const localize = useLocalize(); + const { newConversation } = useNewConvo(0); + const conversation = useRecoilValue(store.conversationByIndex(0)); + const { title = 'New Chat' } = conversation || {}; return ( -
+

@@ -39,19 +43,19 @@ export default function MobileNav({ setNavVisible }) {

diff --git a/client/src/routes/Root.tsx b/client/src/routes/Root.tsx index b9dfd9cdaf..d6619cdd52 100644 --- a/client/src/routes/Root.tsx +++ b/client/src/routes/Root.tsx @@ -72,8 +72,8 @@ export default function Root() { <>