diff --git a/client/src/components/Messages/MessageHeader.jsx b/client/src/components/Messages/MessageHeader.jsx index b63b5f0d28..a907cefbe7 100644 --- a/client/src/components/Messages/MessageHeader.jsx +++ b/client/src/components/Messages/MessageHeader.jsx @@ -2,20 +2,9 @@ import React, { useState } from 'react'; import { useRecoilValue } from 'recoil'; import EndpointOptionsDialog from '../Endpoints/EndpointOptionsDialog'; import { cn } from '~/utils/'; -import { Button } from '../ui/Button.tsx'; import store from '~/store'; -const clipPromptPrefix = (str) => { - if (typeof str !== 'string') { - return null; - } else if (str.length > 10) { - return str.slice(0, 10) + '...'; - } else { - return str; - } -}; - const MessageHeader = ({ isSearchView = false }) => { const [saveAsDialogShow, setSaveAsDialogShow] = useState(false); const conversation = useRecoilValue(store.conversation); @@ -56,7 +45,7 @@ const MessageHeader = ({ isSearchView = false }) => { <>
(endpoint === 'chatGPTBrowser' ? null : setSaveAsDialogShow(true))} diff --git a/client/src/components/Nav/SearchBar.jsx b/client/src/components/Nav/SearchBar.jsx index 4ce02b52b5..afe9032d55 100644 --- a/client/src/components/Nav/SearchBar.jsx +++ b/client/src/components/Nav/SearchBar.jsx @@ -19,7 +19,7 @@ export default function SearchBar({ clearSearch }) { }; return ( -
+
{} + +fullConfig.theme.screens[value].slice(0, fullConfig.theme.screens[value].indexOf('px')); + +export const getCurrentBreakpoint = () => { + let currentBreakpoint; + let biggestBreakpointValue = 0; + for (const breakpoint of Object.keys(fullConfig.theme.screens)) { + const breakpointValue = getBreakpointValue(breakpoint); + if (breakpointValue > biggestBreakpointValue && window.innerWidth >= breakpointValue) { + biggestBreakpointValue = breakpointValue; + currentBreakpoint = breakpoint; + } + } + return currentBreakpoint; +}; export default function Nav({ navVisible, setNavVisible }) { const [isHovering, setIsHovering] = useState(false); const { isAuthenticated } = useAuthContext(); + const { theme, } = useContext(ThemeContext); const containerRef = useRef(null); const scrollPositionRef = useRef(null); @@ -75,6 +98,13 @@ export default function Nav({ navVisible, setNavVisible }) { } }; + const moveToTop = () => { + const container = containerRef.current; + if (container) { + scrollPositionRef.current = container.scrollTop; + } + }; + const nextPage = async () => { moveToTop(); setPageNumber(pageNumber + 1); @@ -111,19 +141,17 @@ export default function Nav({ navVisible, setNavVisible }) { } }, [pageNumber, conversationId, refreshConversationsHint]); - const moveToTop = () => { - const container = containerRef.current; - if (container) { - scrollPositionRef.current = container.scrollTop; - } - }; - const toggleNavVisible = () => { setNavVisible((prev) => !prev); }; useEffect(() => { - setNavVisible(false); + let currentBreakpoint = getCurrentBreakpoint(); + if (currentBreakpoint === 'sm') { + setNavVisible(false); + } else { + setNavVisible(true); + } }, [conversationId, setNavVisible]); const containerClasses = @@ -133,12 +161,7 @@ export default function Nav({ navVisible, setNavVisible }) { return ( <> -
+
+ {!navVisible && ( + + )} +
); diff --git a/client/src/components/ui/AlertDialog.tsx b/client/src/components/ui/AlertDialog.tsx index 98e09319d3..bc0e7f43f8 100644 --- a/client/src/components/ui/AlertDialog.tsx +++ b/client/src/components/ui/AlertDialog.tsx @@ -100,7 +100,7 @@ const AlertDialogAction = React.forwardRef< (({ className, ...props }, ref) => ( )); diff --git a/client/src/mobile.css b/client/src/mobile.css index 8ee1e0e0a5..bc6bf02235 100644 --- a/client/src/mobile.css +++ b/client/src/mobile.css @@ -1,95 +1,98 @@ -.nav-mask { - position: fixed; - z-index: 996; - left: 0; - right: 0; - top: 0; - bottom: 0; - background-color: rgba(86, 88, 105, 0.75); - padding-left: 420px; - padding-top: 12px; - opacity: 0; - transition: all 0.5s; - pointer-events: none; -} - -.nav { - transition: all 0.5s; -} - -.nav-close-button { +.switch-container { display: none; } -@media (min-width: 1024px) { - .switch-container { - display: none; - } +.switch-result { + display: block !important; + visibility: visible; } +/* .sibling-switch { + left: 114px; + top: unset; + bottom: 4px; + visibility: visible; + z-index: 2; + } */ +.sibling-switch { + display: none; +} - .switch-result { - display: block !important; - visibility: visible; - } +.hover-button { + display: block; + visibility: visible; +} -@media (max-width: 1024px) { - /* .sibling-switch { - left: 114px; - top: unset; - bottom: 4px; - visibility: visible; - z-index: 2; - } */ - .sibling-switch { - display: none; - } +.input-panel-button { + border: 0; +} - .hover-button { - display: block; - visibility: visible; - } +.input-panel-button svg { + width: 16px; + height: 16px; +} + +.input-panel { +} + +.nav-close-button { + display: block; + position: absolute; + left: 100%; + top: 12px; + margin-left: 20px; +} + +.nav { + position: fixed; + z-index: 999; + left: calc(-100%); + top: 0; + width: calc(100% - 60px); + + max-width: 260px; + + bottom: 0; + opacity: 0; +} + +.nav.active { + position: relative; + left: 0; + opacity: 1; +} + +.nav-mask.active { + opacity: 1; + pointer-events: auto; } @media (max-width: 767px) { - .input-panel-button { - border: 0; - } - - .input-panel-button svg { - width: 16px; - height: 16px; - } - - .input-panel { - } - - .nav-close-button { - display: block; - position: absolute; - left: 100%; - top: 12px; - margin-left: 20px; - } - .nav { + width: calc(100% - 60px) ; + transition: all 0.5s; + } + .nav-mask { position: fixed; - z-index: 999; - left: calc(-100%); + z-index: 996; + left: 0; + right: 0; top: 0; bottom: 0; - max-width: 320px; - width: calc(100% - 60px); + background-color: rgba(86, 88, 105, 0.75); + padding-left: 420px; + padding-top: 12px; opacity: 0; - } - - .nav.active { - left: 0; - opacity: 1; + transition: all 0.5s; + pointer-events: none; } .nav-mask.active { opacity: 1; pointer-events: auto; } + + .nav.active { + position: fixed; + } } diff --git a/client/src/routes/Root.jsx b/client/src/routes/Root.jsx index b2f00e5fc8..bcede0dbd4 100644 --- a/client/src/routes/Root.jsx +++ b/client/src/routes/Root.jsx @@ -51,7 +51,7 @@ export default function Root() { <>