From 085e1b6c41856ebd2692de1a0b1445c9f0cf92c4 Mon Sep 17 00:00:00 2001 From: JeevaRamanathan Date: Fri, 4 Oct 2024 21:34:40 +0530 Subject: [PATCH 1/2] fix: share button available in mobile view Signed-off-by: JeevaRamanathan --- frontend/src/Navigation.tsx | 45 +++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 87cbbe514..12b0a7412 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import { NavLink, useNavigate } from 'react-router-dom'; - +import { ShareConversationModal } from './modals/ShareConversationModal'; import conversationService from './api/services/conversationService'; import userService from './api/services/userService'; import Add from './assets/add.svg'; @@ -10,7 +10,6 @@ import DocsGPT3 from './assets/cute_docsgpt3.svg'; import Discord from './assets/discord.svg'; import Expand from './assets/expand.svg'; import Github from './assets/github.svg'; -import Hamburger from './assets/hamburger.svg'; import Info from './assets/info.svg'; import SettingGear from './assets/settingGear.svg'; import Twitter from './assets/TwitterX.svg'; @@ -41,6 +40,7 @@ import { setSourceDocs, } from './preferences/preferenceSlice'; import Upload from './upload/Upload'; +import ShareIcon from './assets/share.svg'; interface NavigationProps { navOpen: boolean; @@ -73,7 +73,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { const [isDarkTheme] = useDarkTheme(); const [isDocsListOpen, setIsDocsListOpen] = useState(false); const { t } = useTranslation(); - + const [isShareModalOpen, setShareModalState] = useState(false); const isApiKeySet = useSelector(selectApiKeyStatus); const [apiKeyModalState, setApiKeyModalState] = useState('INACTIVE'); @@ -383,15 +383,46 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
+ + {conversationId && ( + <> + {' '} + + {isShareModalOpen && ( + { + setShareModalState(false); + }} + conversationId={conversationId} + /> + )} + + )}
Date: Sun, 13 Oct 2024 15:32:17 +0530 Subject: [PATCH 2/2] fixed overlapping --- frontend/src/Navigation.tsx | 31 ++----------------- frontend/src/components/ShareButton.tsx | 36 ++++++++++++++++++++++ frontend/src/conversation/Conversation.tsx | 31 +++---------------- 3 files changed, 42 insertions(+), 56 deletions(-) create mode 100644 frontend/src/components/ShareButton.tsx diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index fe52001ac..0bf3e3409 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -2,7 +2,6 @@ import { useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import { NavLink, useNavigate } from 'react-router-dom'; -import { ShareConversationModal } from './modals/ShareConversationModal'; import conversationService from './api/services/conversationService'; import userService from './api/services/userService'; import Add from './assets/add.svg'; @@ -40,7 +39,7 @@ import { setSourceDocs, } from './preferences/preferenceSlice'; import Upload from './upload/Upload'; -import ShareIcon from './assets/share.svg'; +import ShareButton from './components/ShareButton'; interface NavigationProps { navOpen: boolean; @@ -73,7 +72,6 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { const [isDarkTheme] = useDarkTheme(); const [isDocsListOpen, setIsDocsListOpen] = useState(false); const { t } = useTranslation(); - const [isShareModalOpen, setShareModalState] = useState(false); const isApiKeySet = useSelector(selectApiKeyStatus); const [apiKeyModalState, setApiKeyModalState] = useState('INACTIVE'); @@ -441,32 +439,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { /> - {conversationId && ( - <> - {' '} - - {isShareModalOpen && ( - { - setShareModalState(false); - }} - conversationId={conversationId} - /> - )} - - )} + {conversationId && } (false); + return ( + <> + + {isShareModalOpen && ( + { + setShareModalState(false); + }} + conversationId={conversationId} + /> + )} + + ); +} diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index fb8199222..ae4ed7a92 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -5,13 +5,11 @@ import { useDispatch, useSelector } from 'react-redux'; import ArrowDown from '../assets/arrow-down.svg'; import Send from '../assets/send.svg'; import SendDark from '../assets/send_dark.svg'; -import ShareIcon from '../assets/share.svg'; import SpinnerDark from '../assets/spinner-dark.svg'; import Spinner from '../assets/spinner.svg'; import RetryIcon from '../components/RetryIcon'; import Hero from '../Hero'; import { useDarkTheme, useMediaQuery } from '../hooks'; -import { ShareConversationModal } from '../modals/ShareConversationModal'; import { selectConversationId } from '../preferences/preferenceSlice'; import { AppDispatch } from '../store'; import ConversationBubble from './ConversationBubble'; @@ -24,6 +22,7 @@ import { selectStatus, updateQuery, } from './conversationSlice'; +import ShareButton from '../components/ShareButton'; export default function Conversation() { const queries = useSelector(selectQueries); @@ -37,7 +36,6 @@ export default function Conversation() { const fetchStream = useRef(null); const [eventInterrupt, setEventInterrupt] = useState(false); const [lastQueryReturnedErr, setLastQueryReturnedErr] = useState(false); - const [isShareModalOpen, setShareModalState] = useState(false); const { t } = useTranslation(); const { isMobile } = useMediaQuery(); @@ -199,30 +197,9 @@ export default function Conversation() { return (
{conversationId && ( - <> - {' '} - - {isShareModalOpen && ( - { - setShareModalState(false); - }} - conversationId={conversationId} - /> - )} - +
+ +
)}