mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-20 02:16:39 +00:00
fixed overlapping
This commit is contained in:
1 parent
706bd6126a
commit
c440e6f8fa
3 files changed
+42
-56
No files matched your search
@@ -2,7 +2,6 @@ import { useEffect, useRef, useState } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { NavLink, useNavigate } from 'react-router-dom';
|
import { NavLink, useNavigate } from 'react-router-dom';
|
||||||
import { ShareConversationModal } from './modals/ShareConversationModal';
|
|
||||||
import conversationService from './api/services/conversationService';
|
import conversationService from './api/services/conversationService';
|
||||||
import userService from './api/services/userService';
|
import userService from './api/services/userService';
|
||||||
import Add from './assets/add.svg';
|
import Add from './assets/add.svg';
|
||||||
@@ -40,7 +39,7 @@ import {
|
|||||||
setSourceDocs,
|
setSourceDocs,
|
||||||
} from './preferences/preferenceSlice';
|
} from './preferences/preferenceSlice';
|
||||||
import Upload from './upload/Upload';
|
import Upload from './upload/Upload';
|
||||||
import ShareIcon from './assets/share.svg';
|
import ShareButton from './components/ShareButton';
|
||||||
|
|
||||||
interface NavigationProps {
|
interface NavigationProps {
|
||||||
navOpen: boolean;
|
navOpen: boolean;
|
||||||
@@ -73,7 +72,6 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
|||||||
const [isDarkTheme] = useDarkTheme();
|
const [isDarkTheme] = useDarkTheme();
|
||||||
const [isDocsListOpen, setIsDocsListOpen] = useState(false);
|
const [isDocsListOpen, setIsDocsListOpen] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [isShareModalOpen, setShareModalState] = useState<boolean>(false);
|
|
||||||
const isApiKeySet = useSelector(selectApiKeyStatus);
|
const isApiKeySet = useSelector(selectApiKeyStatus);
|
||||||
const [apiKeyModalState, setApiKeyModalState] =
|
const [apiKeyModalState, setApiKeyModalState] =
|
||||||
useState<ActiveState>('INACTIVE');
|
useState<ActiveState>('INACTIVE');
|
||||||
@@ -441,32 +439,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{conversationId && (
|
{conversationId && <ShareButton conversationId={conversationId} />}
|
||||||
<>
|
|
||||||
{' '}
|
|
||||||
<button
|
|
||||||
title="Share"
|
|
||||||
onClick={() => {
|
|
||||||
setShareModalState(true);
|
|
||||||
}}
|
|
||||||
className="absolute top-4 right-20 z-20 rounded-full hover:bg-bright-gray dark:hover:bg-[#28292E]"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
className="m-2 h-5 w-5 filter dark:invert"
|
|
||||||
alt="share"
|
|
||||||
src={ShareIcon}
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
{isShareModalOpen && (
|
|
||||||
<ShareConversationModal
|
|
||||||
close={() => {
|
|
||||||
setShareModalState(false);
|
|
||||||
}}
|
|
||||||
conversationId={conversationId}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<APIKeyModal
|
<APIKeyModal
|
||||||
modalState={apiKeyModalState}
|
modalState={apiKeyModalState}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import ShareIcon from '../assets/share.svg';
|
||||||
|
import { ShareConversationModal } from '../modals/ShareConversationModal';
|
||||||
|
|
||||||
|
type ShareButtonProps = {
|
||||||
|
conversationId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function ShareButton({ conversationId }: ShareButtonProps) {
|
||||||
|
const [isShareModalOpen, setShareModalState] = useState<boolean>(false);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
title="Share"
|
||||||
|
onClick={() => {
|
||||||
|
setShareModalState(true);
|
||||||
|
}}
|
||||||
|
className="absolute top-4 right-20 z-20 rounded-full hover:bg-bright-gray dark:hover:bg-[#28292E]"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
className="m-2 h-5 w-5 filter dark:invert"
|
||||||
|
alt="share"
|
||||||
|
src={ShareIcon}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
{isShareModalOpen && (
|
||||||
|
<ShareConversationModal
|
||||||
|
close={() => {
|
||||||
|
setShareModalState(false);
|
||||||
|
}}
|
||||||
|
conversationId={conversationId}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -5,13 +5,11 @@ import { useDispatch, useSelector } from 'react-redux';
|
|||||||
import ArrowDown from '../assets/arrow-down.svg';
|
import ArrowDown from '../assets/arrow-down.svg';
|
||||||
import Send from '../assets/send.svg';
|
import Send from '../assets/send.svg';
|
||||||
import SendDark from '../assets/send_dark.svg';
|
import SendDark from '../assets/send_dark.svg';
|
||||||
import ShareIcon from '../assets/share.svg';
|
|
||||||
import SpinnerDark from '../assets/spinner-dark.svg';
|
import SpinnerDark from '../assets/spinner-dark.svg';
|
||||||
import Spinner from '../assets/spinner.svg';
|
import Spinner from '../assets/spinner.svg';
|
||||||
import RetryIcon from '../components/RetryIcon';
|
import RetryIcon from '../components/RetryIcon';
|
||||||
import Hero from '../Hero';
|
import Hero from '../Hero';
|
||||||
import { useDarkTheme, useMediaQuery } from '../hooks';
|
import { useDarkTheme, useMediaQuery } from '../hooks';
|
||||||
import { ShareConversationModal } from '../modals/ShareConversationModal';
|
|
||||||
import { selectConversationId } from '../preferences/preferenceSlice';
|
import { selectConversationId } from '../preferences/preferenceSlice';
|
||||||
import { AppDispatch } from '../store';
|
import { AppDispatch } from '../store';
|
||||||
import ConversationBubble from './ConversationBubble';
|
import ConversationBubble from './ConversationBubble';
|
||||||
@@ -24,6 +22,7 @@ import {
|
|||||||
selectStatus,
|
selectStatus,
|
||||||
updateQuery,
|
updateQuery,
|
||||||
} from './conversationSlice';
|
} from './conversationSlice';
|
||||||
|
import ShareButton from '../components/ShareButton';
|
||||||
|
|
||||||
export default function Conversation() {
|
export default function Conversation() {
|
||||||
const queries = useSelector(selectQueries);
|
const queries = useSelector(selectQueries);
|
||||||
@@ -37,7 +36,6 @@ export default function Conversation() {
|
|||||||
const fetchStream = useRef<any>(null);
|
const fetchStream = useRef<any>(null);
|
||||||
const [eventInterrupt, setEventInterrupt] = useState(false);
|
const [eventInterrupt, setEventInterrupt] = useState(false);
|
||||||
const [lastQueryReturnedErr, setLastQueryReturnedErr] = useState(false);
|
const [lastQueryReturnedErr, setLastQueryReturnedErr] = useState(false);
|
||||||
const [isShareModalOpen, setShareModalState] = useState<boolean>(false);
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { isMobile } = useMediaQuery();
|
const { isMobile } = useMediaQuery();
|
||||||
|
|
||||||
@@ -199,30 +197,9 @@ export default function Conversation() {
|
|||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-1 h-full justify-end">
|
<div className="flex flex-col gap-1 h-full justify-end">
|
||||||
{conversationId && (
|
{conversationId && (
|
||||||
<>
|
<div className="hidden md:block">
|
||||||
{' '}
|
<ShareButton conversationId={conversationId} />
|
||||||
<button
|
</div>
|
||||||
title="Share"
|
|
||||||
onClick={() => {
|
|
||||||
setShareModalState(true);
|
|
||||||
}}
|
|
||||||
className="absolute top-4 right-20 z-20 rounded-full hover:bg-bright-gray dark:hover:bg-[#28292E]"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
className="m-2 h-5 w-5 filter dark:invert"
|
|
||||||
alt="share"
|
|
||||||
src={ShareIcon}
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
{isShareModalOpen && (
|
|
||||||
<ShareConversationModal
|
|
||||||
close={() => {
|
|
||||||
setShareModalState(false);
|
|
||||||
}}
|
|
||||||
conversationId={conversationId}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
<div
|
<div
|
||||||
ref={conversationRef}
|
ref={conversationRef}
|
||||||
|
|||||||
Reference in new issue
Block a user