From 162fe26cba596a0e3018a01830fec513fd95d7e3 Mon Sep 17 00:00:00 2001 From: pablonyx Date: Mon, 16 Dec 2024 18:13:45 -0800 Subject: [PATCH] Use logotypes where feasible (#3478) * Use logotypes where feasible * quick nit * minor cleanup --- .../admin/connectors/[connector]/Sidebar.tsx | 2 +- web/src/app/auth/verify-email/Verify.tsx | 2 +- .../app/auth/waiting-on-verification/page.tsx | 2 +- web/src/app/chat/ChatPage.tsx | 5 +- .../chat/sessionSidebar/HistorySidebar.tsx | 24 +++---- .../app/chat/shared_chat_search/FixedLogo.tsx | 69 +++++++++++------- web/src/app/layout.tsx | 13 ++-- web/src/components/LogoType.tsx | 38 ---------- web/src/components/OnyxInitializingLoader.tsx | 2 +- .../admin/connectors/AdminSidebar.tsx | 31 +++----- web/src/components/auth/AuthFlowContainer.tsx | 2 +- web/src/components/chat_search/Header.tsx | 25 +++---- .../components/embedding/EmbeddingSidebar.tsx | 2 +- web/src/components/header/HeaderTitle.tsx | 7 +- .../header/{LogoType.tsx => LogoWithText.tsx} | 70 ++++++++----------- web/src/components/{ => logo}/Logo.tsx | 6 +- 16 files changed, 127 insertions(+), 173 deletions(-) delete mode 100644 web/src/components/LogoType.tsx rename web/src/components/header/{LogoType.tsx => LogoWithText.tsx} (68%) rename web/src/components/{ => logo}/Logo.tsx (89%) diff --git a/web/src/app/admin/connectors/[connector]/Sidebar.tsx b/web/src/app/admin/connectors/[connector]/Sidebar.tsx index bae555ffe67..5980decc9c4 100644 --- a/web/src/app/admin/connectors/[connector]/Sidebar.tsx +++ b/web/src/app/admin/connectors/[connector]/Sidebar.tsx @@ -2,7 +2,7 @@ import { useFormContext } from "@/components/context/FormContext"; import { HeaderTitle } from "@/components/header/HeaderTitle"; import { SettingsIcon } from "@/components/icons/icons"; -import { Logo } from "@/components/Logo"; +import { Logo } from "@/components/logo/Logo"; import { SettingsContext } from "@/components/settings/SettingsProvider"; import { credentialTemplates } from "@/lib/connectors/credentials"; import Link from "next/link"; diff --git a/web/src/app/auth/verify-email/Verify.tsx b/web/src/app/auth/verify-email/Verify.tsx index 3da421e6c1d..5b478296a24 100644 --- a/web/src/app/auth/verify-email/Verify.tsx +++ b/web/src/app/auth/verify-email/Verify.tsx @@ -6,7 +6,7 @@ import { useCallback, useEffect, useState } from "react"; import Text from "@/components/ui/text"; import { RequestNewVerificationEmail } from "../waiting-on-verification/RequestNewVerificationEmail"; import { User } from "@/lib/types"; -import { Logo } from "@/components/Logo"; +import { Logo } from "@/components/logo/Logo"; export function Verify({ user }: { user: User | null }) { const searchParams = useSearchParams(); diff --git a/web/src/app/auth/waiting-on-verification/page.tsx b/web/src/app/auth/waiting-on-verification/page.tsx index 3cd8035ae17..3b684cd56fd 100644 --- a/web/src/app/auth/waiting-on-verification/page.tsx +++ b/web/src/app/auth/waiting-on-verification/page.tsx @@ -8,7 +8,7 @@ import { HealthCheckBanner } from "@/components/health/healthcheck"; import { User } from "@/lib/types"; import Text from "@/components/ui/text"; import { RequestNewVerificationEmail } from "./RequestNewVerificationEmail"; -import { Logo } from "@/components/Logo"; +import { Logo } from "@/components/logo/Logo"; export default async function Page() { // catch cases where the backend is completely unreachable here diff --git a/web/src/app/chat/ChatPage.tsx b/web/src/app/chat/ChatPage.tsx index 16ea70615e4..bcc790e56fe 100644 --- a/web/src/app/chat/ChatPage.tsx +++ b/web/src/app/chat/ChatPage.tsx @@ -2123,7 +2123,7 @@ export function ChatPage({ page="chat" ref={innerSidebarElementRef} toggleSidebar={toggleSidebar} - toggled={toggledSidebar && !settings?.isMobile} + toggled={toggledSidebar} backgroundToggled={toggledSidebar || showHistorySidebar} existingChats={chatSessions} currentChatSession={selectedChatSession} @@ -2194,8 +2194,6 @@ export function ChatPage({ {liveAssistant && ( setUserSettingsToggled(true)} - liveAssistant={liveAssistant} - onAssistantChange={onAssistantChange} sidebarToggled={toggledSidebar} reset={() => setMessage("")} page="chat" @@ -2207,7 +2205,6 @@ export function ChatPage({ toggleSidebar={toggleSidebar} currentChatSession={selectedChatSession} documentSidebarToggled={documentSidebarToggled} - llmOverrideManager={llmOverrideManager} /> )} diff --git a/web/src/app/chat/sessionSidebar/HistorySidebar.tsx b/web/src/app/chat/sessionSidebar/HistorySidebar.tsx index 3ab76d49959..c3c4a098fe0 100644 --- a/web/src/app/chat/sessionSidebar/HistorySidebar.tsx +++ b/web/src/app/chat/sessionSidebar/HistorySidebar.tsx @@ -11,13 +11,10 @@ import { createFolder } from "../folders/FolderManagement"; import { usePopup } from "@/components/admin/connectors/Popup"; import { SettingsContext } from "@/components/settings/SettingsProvider"; -import { - AssistantsIconSkeleton, - ClosedBookIcon, -} from "@/components/icons/icons"; +import { AssistantsIconSkeleton } from "@/components/icons/icons"; import { PagesTab } from "./PagesTab"; import { pageType } from "./types"; -import LogoType from "@/components/header/LogoType"; +import LogoWithText from "@/components/header/LogoWithText"; interface HistorySidebarProps { page: pageType; @@ -100,16 +97,19 @@ export const HistorySidebar = forwardRef( flex flex-col relative h-screen + pt-2 transition-transform `} > - +
+ +
{page == "chat" && (
+ {enterpriseSettings && enterpriseSettings.application_name ? ( + <> +
+ +
+
+ + {enterpriseSettings.application_name} + + {!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && ( +

Powered by Onyx

+ )} +
+ + ) : ( + + )} +
+ ); +} export default function FixedLogo({ - // Whether the sidebar is toggled or not backgroundToggled, }: { backgroundToggled?: boolean; }) { const combinedSettings = useContext(SettingsContext); - const settings = combinedSettings?.settings; const enterpriseSettings = combinedSettings?.enterpriseSettings; return ( <> -
-
- -
-
- {enterpriseSettings && enterpriseSettings.application_name ? ( -
- - {enterpriseSettings.application_name} - - {!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && ( -

Powered by Onyx

- )} -
- ) : ( - - Onyx - - )} -
-
+
- Onyx - +
@@ -124,7 +123,8 @@ export default async function RootLayout({

Your Onyx instance was not configured properly and your settings could not be loaded. This could be due to an admin configuration - issue or an incomplete setup. + issue, an incomplete setup, or backend services that may not be up + and running yet.

If you're an admin, please check{" "} @@ -144,7 +144,7 @@ export default async function RootLayout({ community on{" "} @@ -160,8 +160,7 @@ export default async function RootLayout({ return getPageContent(

- Onyx - +

diff --git a/web/src/components/LogoType.tsx b/web/src/components/LogoType.tsx deleted file mode 100644 index b789686dd2e..00000000000 --- a/web/src/components/LogoType.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED } from "@/lib/constants"; -import { HeaderTitle } from "./header/HeaderTitle"; -import LogoType, { Logo } from "./Logo"; -import { EnterpriseSettings } from "@/app/admin/settings/interfaces"; - -export default function LogoTypeContainer({ - enterpriseSettings, -}: { - enterpriseSettings: EnterpriseSettings | null; -}) { - const onlyLogo = - !enterpriseSettings || - !enterpriseSettings.use_custom_logo || - !enterpriseSettings.application_name; - - return ( -
-
- {onlyLogo ? : } -
- - {!onlyLogo && ( -
- {enterpriseSettings && enterpriseSettings.application_name ? ( -
- {enterpriseSettings.application_name} - {!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && ( -

Powered by Onyx

- )} -
- ) : ( - Onyx - )} -
- )} -
- ); -} diff --git a/web/src/components/OnyxInitializingLoader.tsx b/web/src/components/OnyxInitializingLoader.tsx index 18fc024f6c6..a13947d4a43 100644 --- a/web/src/components/OnyxInitializingLoader.tsx +++ b/web/src/components/OnyxInitializingLoader.tsx @@ -1,4 +1,4 @@ -import { Logo } from "./Logo"; +import { Logo } from "./logo/Logo"; import { useContext } from "react"; import { SettingsContext } from "./settings/SettingsProvider"; diff --git a/web/src/components/admin/connectors/AdminSidebar.tsx b/web/src/components/admin/connectors/AdminSidebar.tsx index 81f229682bc..11c786167f7 100644 --- a/web/src/components/admin/connectors/AdminSidebar.tsx +++ b/web/src/components/admin/connectors/AdminSidebar.tsx @@ -2,7 +2,7 @@ "use client"; import React, { useContext } from "react"; import Link from "next/link"; -import { Logo } from "@/components/Logo"; +import { Logo } from "@/components/logo/Logo"; import { NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED } from "@/lib/constants"; import { HeaderTitle } from "@/components/header/HeaderTitle"; import { SettingsContext } from "@/components/settings/SettingsProvider"; @@ -14,6 +14,8 @@ import { TooltipTrigger, } from "@/components/ui/tooltip"; import { CgArrowsExpandUpLeft } from "react-icons/cg"; +import LogoWithText from "@/components/header/LogoWithText"; +import { LogoComponent } from "@/app/chat/shared_chat_search/FixedLogo"; interface Item { name: string | JSX.Element; @@ -32,32 +34,17 @@ export function AdminSidebar({ collections }: { collections: Collection[] }) { return null; } - const settings = combinedSettings.settings; const enterpriseSettings = combinedSettings.enterpriseSettings; return (