diff --git a/frontend/src/components/Modals/NewWorkspace.jsx b/frontend/src/components/Modals/NewWorkspace.jsx
index bba86599..5b8ecb8f 100644
--- a/frontend/src/components/Modals/NewWorkspace.jsx
+++ b/frontend/src/components/Modals/NewWorkspace.jsx
@@ -1,6 +1,7 @@
import React, { useRef, useState } from "react";
import { X } from "@phosphor-icons/react";
import Workspace from "../../models/workspace";
+import paths from "../../utils/paths";
const noop = () => false;
export default function NewWorkspaceModal({ hideModal = noop }) {
@@ -13,7 +14,9 @@ export default function NewWorkspaceModal({ hideModal = noop }) {
const form = new FormData(formEl.current);
for (var [key, value] of form.entries()) data[key] = value;
const { workspace, message } = await Workspace.new(data);
- if (!!workspace) window.location.reload();
+ if (!!workspace){
+ window.location.href = paths.workspace.chat(workspace.slug);
+ }
setError(message);
};
@@ -26,7 +29,7 @@ export default function NewWorkspaceModal({ hideModal = noop }) {
-
+
New Workspace
{error && (
-
+
Error: {error}
)}
diff --git a/frontend/src/components/SettingsSidebar/index.jsx b/frontend/src/components/SettingsSidebar/index.jsx
index 887f8af3..89c71df3 100644
--- a/frontend/src/components/SettingsSidebar/index.jsx
+++ b/frontend/src/components/SettingsSidebar/index.jsx
@@ -167,9 +167,9 @@ export default function SettingsSidebar() {
className="h-5 w-5 stroke-slate-200 group-hover:stroke-slate-200"
/>
-
*/}
diff --git a/frontend/src/components/Sidebar/ActiveWorkspaces/index.jsx b/frontend/src/components/Sidebar/ActiveWorkspaces/index.jsx
index b32d2b02..4e423a6d 100644
--- a/frontend/src/components/Sidebar/ActiveWorkspaces/index.jsx
+++ b/frontend/src/components/Sidebar/ActiveWorkspaces/index.jsx
@@ -57,7 +57,7 @@ export default function ActiveWorkspaces() {
href={isActive ? null : paths.workspace.chat(workspace.slug)}
className={`
transition-all duration-[200ms]
- flex flex-grow w-[75%] gap-x-2 py-[9px] px-[12px] rounded-lg text-slate-200 justify-start items-center border
+ flex flex-grow w-[75%] gap-x-2 py-[6px] px-[12px] rounded-lg text-slate-200 justify-start items-center border
hover:bg-workspace-item-selected-gradient hover:border-slate-100 hover:border-opacity-50
${
isActive
diff --git a/frontend/src/components/Sidebar/index.jsx b/frontend/src/components/Sidebar/index.jsx
index 95f232d7..cbee14ae 100644
--- a/frontend/src/components/Sidebar/index.jsx
+++ b/frontend/src/components/Sidebar/index.jsx
@@ -54,12 +54,12 @@ export default function Sidebar() {
{/* Primary Body */}
-
+
{(!user || user?.role !== "default") && (
@@ -114,9 +114,9 @@ export default function Sidebar() {
className="h-5 w-5 stroke-slate-200 group-hover:stroke-slate-200"
/>
-
+ {/*
-
+ */}
diff --git a/frontend/src/components/UserMenu/index.jsx b/frontend/src/components/UserMenu/index.jsx
index 95537bbb..deb303fb 100644
--- a/frontend/src/components/UserMenu/index.jsx
+++ b/frontend/src/components/UserMenu/index.jsx
@@ -1,9 +1,9 @@
-import { useState } from "react";
-import { isMobile } from "react-device-detect";
-import paths from "../../utils/paths";
-import { AUTH_TIMESTAMP, AUTH_TOKEN, AUTH_USER } from "../../utils/constants";
-import { Person, SignOut } from "@phosphor-icons/react";
-import { userFromStorage } from "../../utils/request";
+import React, { useState, useEffect, useRef } from 'react';
+import { isMobile } from 'react-device-detect';
+import paths from '../../utils/paths';
+import { AUTH_TIMESTAMP, AUTH_TOKEN, AUTH_USER } from '../../utils/constants';
+import { Person, SignOut } from '@phosphor-icons/react';
+import { userFromStorage } from '../../utils/request';
export default function UserMenu({ children }) {
if (isMobile) return <>{children}>;
@@ -20,33 +20,56 @@ function useLoginMode() {
const user = !!window.localStorage.getItem(AUTH_USER);
const token = !!window.localStorage.getItem(AUTH_TOKEN);
- if (user && token) return "multi";
- if (!user && token) return "single";
+ if (user && token) return 'multi';
+ if (!user && token) return 'single';
return null;
}
function userDisplay() {
const user = userFromStorage();
- return user?.username?.slice(0, 2) || "AA";
+ return user?.username?.slice(0, 2) || 'AA';
}
function UserButton() {
const [showMenu, setShowMenu] = useState(false);
const mode = useLoginMode();
+ const menuRef = useRef();
+ const buttonRef = useRef();
+ const handleClose = (event) => {
+ if (
+ menuRef.current &&
+ !menuRef.current.contains(event.target) &&
+ !buttonRef.current.contains(event.target)
+ ) {
+ setShowMenu(false);
+ }
+ };
+
+ useEffect(() => {
+ if (showMenu) {
+ document.addEventListener('mousedown', handleClose);
+ }
+ return () => document.removeEventListener('mousedown', handleClose);
+ }, [showMenu]);
if (mode === null) return null;
+
return (
setShowMenu(!showMenu)}
type="button"
className="uppercase transition-all duration-300 w-[35px] h-[35px] text-base font-semibold rounded-full flex items-center bg-sidebar-button hover:bg-menu-item-selected-gradient justify-center text-white p-2 hover:border-slate-100 hover:border-opacity-50 border-transparent border"
>
- {mode === "multi" ? userDisplay() : }
+ {mode === 'multi' ? userDisplay() : }
{showMenu && (
-
+
-
+
-
+
-
+
{isMobile && }
diff --git a/frontend/src/components/WorkspaceChat/LoadingChat/index.jsx b/frontend/src/components/WorkspaceChat/LoadingChat/index.jsx
index c93aed1d..b189e015 100644
--- a/frontend/src/components/WorkspaceChat/LoadingChat/index.jsx
+++ b/frontend/src/components/WorkspaceChat/LoadingChat/index.jsx
@@ -8,7 +8,7 @@ export default function LoadingChat() {
return (
}
{isMobile &&
}
diff --git a/frontend/src/pages/Admin/System/index.jsx b/frontend/src/pages/Admin/System/index.jsx
index d9ea370e..4f77ba24 100644
--- a/frontend/src/pages/Admin/System/index.jsx
+++ b/frontend/src/pages/Admin/System/index.jsx
@@ -45,7 +45,7 @@ export default function AdminSystem() {
{!isMobile &&
}
{isMobile &&
}
}
{isMobile &&
}
diff --git a/frontend/src/pages/Admin/Workspaces/index.jsx b/frontend/src/pages/Admin/Workspaces/index.jsx
index c9b9096c..e2217e4b 100644
--- a/frontend/src/pages/Admin/Workspaces/index.jsx
+++ b/frontend/src/pages/Admin/Workspaces/index.jsx
@@ -17,7 +17,7 @@ export default function AdminWorkspaces() {
{!isMobile &&
}
{isMobile &&
}
diff --git a/frontend/src/pages/GeneralSettings/ApiKeys/index.jsx b/frontend/src/pages/GeneralSettings/ApiKeys/index.jsx
index 130c6f25..66026ed5 100644
--- a/frontend/src/pages/GeneralSettings/ApiKeys/index.jsx
+++ b/frontend/src/pages/GeneralSettings/ApiKeys/index.jsx
@@ -19,7 +19,7 @@ export default function AdminApiKeys() {
{!isMobile &&
}
{isMobile &&
}
diff --git a/frontend/src/pages/GeneralSettings/Appearance/index.jsx b/frontend/src/pages/GeneralSettings/Appearance/index.jsx
index 6964c128..107e57ca 100644
--- a/frontend/src/pages/GeneralSettings/Appearance/index.jsx
+++ b/frontend/src/pages/GeneralSettings/Appearance/index.jsx
@@ -113,7 +113,7 @@ export default function Appearance() {
{!isMobile &&
}
{isMobile &&
}
@@ -184,7 +184,7 @@ export default function Appearance() {
-
+
Custom Messages
@@ -238,7 +238,7 @@ export default function Appearance() {
{hasChanges && (
Save Messages
diff --git a/frontend/src/pages/GeneralSettings/Chats/index.jsx b/frontend/src/pages/GeneralSettings/Chats/index.jsx
index 3b2a1e95..fbf041a0 100644
--- a/frontend/src/pages/GeneralSettings/Chats/index.jsx
+++ b/frontend/src/pages/GeneralSettings/Chats/index.jsx
@@ -37,7 +37,7 @@ export default function WorkspaceChats() {
{!isMobile && }
{isMobile &&
}
diff --git a/frontend/src/pages/GeneralSettings/EmbeddingPreference/index.jsx b/frontend/src/pages/GeneralSettings/EmbeddingPreference/index.jsx
index 9a53ac82..beff0c29 100644
--- a/frontend/src/pages/GeneralSettings/EmbeddingPreference/index.jsx
+++ b/frontend/src/pages/GeneralSettings/EmbeddingPreference/index.jsx
@@ -83,7 +83,7 @@ export default function GeneralEmbeddingPreference() {
{loading ? (
@@ -92,7 +92,7 @@ export default function GeneralEmbeddingPreference() {
) : (
{isMobile &&
}
}
{isMobile &&
}
@@ -55,7 +55,7 @@ export default function GeneralExportImport() {
{!isMobile &&
}
{isMobile &&
}
diff --git a/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx b/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
index 0e83f655..b3b1bdf4 100644
--- a/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
+++ b/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
@@ -62,7 +62,7 @@ export default function GeneralLLMPreference() {
{loading ? (
@@ -71,7 +71,7 @@ export default function GeneralLLMPreference() {
) : (
{isMobile &&
}
}
{isMobile &&
}
@@ -78,7 +78,7 @@ function MultiUserMode() {
if (loading) {
return (
-
+
@@ -242,7 +242,7 @@ function PasswordProtection() {
if (loading) {
return (
-
+
diff --git a/frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx b/frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx
index 0d0e6afb..f8b43743 100644
--- a/frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx
+++ b/frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx
@@ -78,7 +78,7 @@ export default function GeneralVectorDatabase() {
{loading ? (
@@ -87,7 +87,7 @@ export default function GeneralVectorDatabase() {
) : (
{isMobile && }