diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index c3bf0a93..4a65c6f8 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -7,9 +7,7 @@ import DocumentationDark from './assets/documentation-dark.svg'; import Discord from './assets/discord.svg'; import DiscordDark from './assets/discord-dark.svg'; -import Arrow2 from './assets/dropdown-arrow.svg'; import Expand from './assets/expand.svg'; -import Trash from './assets/trash.svg'; import Github from './assets/github.svg'; import GithubDark from './assets/github-dark.svg'; import Hamburger from './assets/hamburger.svg'; @@ -42,27 +40,23 @@ import { Doc, getConversations } from './preferences/preferenceApi'; import SelectDocsModal from './preferences/SelectDocsModal'; import ConversationTile from './conversation/ConversationTile'; import { useDarkTheme } from './hooks'; +import SourceDropdown from './components/SourceDropdown'; interface NavigationProps { navOpen: boolean; setNavOpen: React.Dispatch>; } -const NavImage: React.FC<{ Light: string, Dark: string }> = ({ Light, Dark }) => { +const NavImage: React.FC<{ Light: string; Dark: string }> = ({ + Light, + Dark, +}) => { return ( <> - icon - icon + icon + icon - ) -} + ); +}; export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { const dispatch = useDispatch(); const docs = useSelector(selectSourceDocs); @@ -86,9 +80,6 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { const navRef = useRef(null); const apiHost = import.meta.env.VITE_API_HOST || 'https://docsapi.arc53.com'; - const embeddingsName = - import.meta.env.VITE_EMBEDDINGS_NAME || - 'huggingface_sentence-transformers/all-mpnet-base-v2'; const navigate = useNavigate(); @@ -203,15 +194,17 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { menu toggle )}
@@ -245,8 +239,9 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { ); }} className={({ isActive }) => - `${isActive ? 'bg-gray-3000 dark:bg-transparent' : '' - } group sticky mx-4 mt-4 flex cursor-pointer gap-2.5 rounded-3xl border border-silver p-3 hover:border-rainy-gray dark:border-purple-taupe dark:text-white dark:hover:bg-transparent hover:bg-gray-3000` + `${ + isActive ? 'bg-gray-3000 dark:bg-transparent' : '' + } group sticky mx-4 mt-4 flex cursor-pointer gap-2.5 rounded-3xl border border-silver p-3 hover:border-rainy-gray hover:bg-gray-3000 dark:border-purple-taupe dark:text-white dark:hover:bg-transparent` } > -
+
{conversations && (

Chats

@@ -282,88 +277,44 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
-
setIsDocsListOpen(!isDocsListOpen)} - > - {selectedDocs && ( -

- {selectedDocs.name} {selectedDocs.version} -

- )} - arrow -
+ setUploadModalState('ACTIVE')} > - {isDocsListOpen && ( -
- {docs ? ( - docs.map((doc, index) => { - if (doc.model === embeddingsName) { - return ( -
{ - dispatch(setSelectedDocs(doc)); - setIsDocsListOpen(false); - }} - className="flex h-10 w-full cursor-pointer items-center justify-between border-x-2 border-b-[1px] dark:border-purple-taupe hover:bg-gray-100 dark:hover:bg-purple-taupe" - > -

- {doc.name} {doc.version} -

- {doc.location === 'local' && ( - Delete { - event.stopPropagation(); - handleDeleteClick(index, doc); - }} - /> - )} -
- ); - } - }) - ) : ( -
-

No default documentation.

-
- )} -
- )}

Source Docs

-
+
- `my-auto mx-4 flex h-9 cursor-pointer gap-4 rounded-3xl hover:bg-gray-100 dark:hover:bg-purple-taupe ${isActive ? 'bg-gray-3000 dark:bg-transparent' : '' + `my-auto mx-4 flex h-9 cursor-pointer gap-4 rounded-3xl hover:bg-gray-100 dark:hover:bg-purple-taupe ${ + isActive ? 'bg-gray-3000 dark:bg-transparent' : '' }` } > -

Settings

+

+ Settings +

-
+
- `my-auto mx-4 flex h-9 cursor-pointer gap-4 rounded-3xl hover:bg-gray-100 dark:hover:bg-purple-taupe ${isActive ? 'bg-gray-3000 dark:bg-purple-taupe' : '' + `my-auto mx-4 flex h-9 cursor-pointer gap-4 rounded-3xl hover:bg-gray-100 dark:hover:bg-purple-taupe ${ + isActive ? 'bg-gray-3000 dark:bg-purple-taupe' : '' }` } > @@ -388,31 +339,31 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { > {/* discord-link */} -

- Visit our Discord -

+

Visit our Discord

-

- Visit our Github -

+

Visit our Github

-
+
{ method: 'GET', }) .then((response) => { - if(response.ok && documents){ - const updatedDocuments = [...documents.slice(0, index), ...documents.slice(index + 1)]; + if (response.ok && documents) { + const updatedDocuments = [ + ...documents.slice(0, index), + ...documents.slice(index + 1), + ]; dispatch(setSourceDocs(updatedDocuments)); } }) @@ -96,8 +100,10 @@ const Setting: React.FC = () => { }; return ( -
-

Settings

+
+

+ Settings +

@@ -188,7 +195,9 @@ const General: React.FC = () => { const themes = ['Light', 'Dark']; const languages = ['English']; const [isDarkTheme, toggleTheme] = useDarkTheme(); - const [selectedTheme, setSelectedTheme] = useState(isDarkTheme ? 'Dark' : 'Light'); + const [selectedTheme, setSelectedTheme] = useState( + isDarkTheme ? 'Dark' : 'Light', + ); const [selectedLanguage, setSelectedLanguage] = useState(languages[0]); return (
@@ -197,14 +206,16 @@ const General: React.FC = () => { { - setSelectedTheme(option); - option !==selectedTheme && toggleTheme(); - }} + onSelect={(option: string) => { + setSelectedTheme(option); + option !== selectedTheme && toggleTheme(); + }} />
-

Select Language

+

+ Select Language +

= ({

Active Prompt

- = ({
-

Prompt name

{' '} +

Prompt name

{' '}

start by editing name

@@ -372,7 +383,7 @@ const Prompts: React.FC = ({

Prompt content