diff --git a/frontend/src/components/ChatBubble/index.jsx b/frontend/src/components/ChatBubble/index.jsx index 610f9037..f5e9475e 100644 --- a/frontend/src/components/ChatBubble/index.jsx +++ b/frontend/src/components/ChatBubble/index.jsx @@ -13,7 +13,7 @@ export default function ChatBubble({ message, type, popMsg }) { return (
@@ -69,7 +69,7 @@ export default function DefaultChatContainer() { className={`flex justify-center items-end w-full ${AI_BACKGROUND_COLOR}`} >
@@ -92,7 +92,7 @@ export default function DefaultChatContainer() { className={`flex justify-center items-end w-full ${AI_BACKGROUND_COLOR}`} >
@@ -126,7 +126,7 @@ export default function DefaultChatContainer() { className={`flex justify-center items-end w-full ${USER_BACKGROUND_COLOR}`} >
@@ -185,7 +185,7 @@ export default function DefaultChatContainer() { className={`flex justify-center items-end w-full ${USER_BACKGROUND_COLOR}`} >
@@ -248,7 +248,7 @@ export default function DefaultChatContainer() { className={`flex justify-center items-end w-full ${USER_BACKGROUND_COLOR}`} >
@@ -335,7 +335,7 @@ export default function DefaultChatContainer() { return (
{isMobile && } {fetchedMessages.length === 0 diff --git a/frontend/src/components/Modals/MangeWorkspace/Documents/UploadFile/FileUploadProgress/index.jsx b/frontend/src/components/Modals/MangeWorkspace/Documents/UploadFile/FileUploadProgress/index.jsx index 66d71441..31cf5794 100644 --- a/frontend/src/components/Modals/MangeWorkspace/Documents/UploadFile/FileUploadProgress/index.jsx +++ b/frontend/src/components/Modals/MangeWorkspace/Documents/UploadFile/FileUploadProgress/index.jsx @@ -45,7 +45,7 @@ function FileUploadProgressComponent({ if (rejected) { return (
-
+
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") && ( + */}
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 (
{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 && (