mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-28 21:05:17 +02:00
update toggling states (#3519)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import React, { memo } from "react";
|
||||||
import { HeaderTitle } from "@/components/header/HeaderTitle";
|
import { HeaderTitle } from "@/components/header/HeaderTitle";
|
||||||
import { Logo } from "@/components/logo/Logo";
|
import { Logo } from "@/components/logo/Logo";
|
||||||
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
||||||
@@ -11,7 +12,7 @@ import { LogoType } from "@/components/logo/Logo";
|
|||||||
import { EnterpriseSettings } from "@/app/admin/settings/interfaces";
|
import { EnterpriseSettings } from "@/app/admin/settings/interfaces";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
export function LogoComponent({
|
export const LogoComponent = memo(function LogoComponent({
|
||||||
enterpriseSettings,
|
enterpriseSettings,
|
||||||
backgroundToggled,
|
backgroundToggled,
|
||||||
show,
|
show,
|
||||||
@@ -23,12 +24,13 @@ export function LogoComponent({
|
|||||||
isAdmin?: boolean;
|
isAdmin?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
onClick={isAdmin ? () => router.push("/chat") : () => {}}
|
onClick={isAdmin ? () => router.push("/chat") : () => {}}
|
||||||
className={`max-w-[200px] ${
|
className={`max-w-[200px]
|
||||||
!show && "mobile:hidden"
|
${!show && "mobile:hidden"}
|
||||||
} flex items-center gap-x-1`}
|
flex items-center gap-x-1`}
|
||||||
>
|
>
|
||||||
{enterpriseSettings && enterpriseSettings.application_name ? (
|
{enterpriseSettings && enterpriseSettings.application_name ? (
|
||||||
<>
|
<>
|
||||||
@@ -40,7 +42,9 @@ export function LogoComponent({
|
|||||||
{enterpriseSettings.application_name}
|
{enterpriseSettings.application_name}
|
||||||
</HeaderTitle>
|
</HeaderTitle>
|
||||||
{!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && (
|
{!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && (
|
||||||
<p className="text-xs text-left text-subtle">Powered by Onyx</p>
|
<p className="text-xs text-left text-subtle whitespace-nowrap overflow-hidden text-ellipsis">
|
||||||
|
Powered by Onyx
|
||||||
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -49,7 +53,7 @@ export function LogoComponent({
|
|||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
|
||||||
export default function FixedLogo({
|
export default function FixedLogo({
|
||||||
backgroundToggled,
|
backgroundToggled,
|
||||||
|
@@ -11,7 +11,9 @@ export function HeaderTitle({
|
|||||||
}) {
|
}) {
|
||||||
const isString = typeof children === "string";
|
const isString = typeof children === "string";
|
||||||
const textSize =
|
const textSize =
|
||||||
isString && children.length > 10 ? "text-lg mb-[4px] " : "text-2xl";
|
isString && children.length > 10
|
||||||
|
? "text-lg pb-[4px] "
|
||||||
|
: "pb-[2px] text-2xl";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<h1
|
<h1
|
||||||
|
@@ -40,7 +40,7 @@ export default function LogoWithText({
|
|||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
hideOnMobile && "mobile:hidden"
|
hideOnMobile && "mobile:hidden"
|
||||||
} z-[100] ml-2 mt-1 h-8 mb-auto shrink-0 flex gap-x-0 items-center text-xl`}
|
} z-[100] ml-2 mt-1 h-8 mb-auto shrink-0 flex gap-x-0 items-center text-xl`}
|
||||||
>
|
>
|
||||||
{toggleSidebar && page == "chat" ? (
|
{toggleSidebar && page == "chat" ? (
|
||||||
<button
|
<button
|
||||||
@@ -59,27 +59,29 @@ export default function LogoWithText({
|
|||||||
|
|
||||||
<FiSidebar
|
<FiSidebar
|
||||||
size={20}
|
size={20}
|
||||||
className={`text-text-mobile-sidebar ${toggled && "mobile:hidden"}`}
|
className={`text-text-mobile-sidebar desktop:hidden ${
|
||||||
|
toggled && "mobile:hidden"
|
||||||
|
}`}
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<div className="mr-1 invisible mb-auto h-6 w-6">
|
<div className="mr-1 invisible mb-auto h-6 w-6">
|
||||||
<Logo height={24} width={24} />
|
<Logo height={24} width={24} />
|
||||||
lll
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div
|
{!toggled && (
|
||||||
className={`${
|
<div
|
||||||
showArrow ? "desktop:invisible" : "invisible"
|
className={`${
|
||||||
} break-words inline-block w-fit text-text-700 text-xl`}
|
showArrow ? "desktop:hidden" : "invisible"
|
||||||
>
|
} break-words inline-block w-fit text-text-700 text-xl`}
|
||||||
<LogoComponent
|
>
|
||||||
enterpriseSettings={enterpriseSettings!}
|
<LogoComponent
|
||||||
backgroundToggled={toggled}
|
enterpriseSettings={enterpriseSettings!}
|
||||||
/>
|
backgroundToggled={toggled}
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{page == "chat" && !showArrow && (
|
{page == "chat" && !showArrow && (
|
||||||
<TooltipProvider delayDuration={1000}>
|
<TooltipProvider delayDuration={1000}>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
@@ -111,6 +113,7 @@ export default function LogoWithText({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showArrow && toggleSidebar && (
|
{showArrow && toggleSidebar && (
|
||||||
<TooltipProvider delayDuration={0}>
|
<TooltipProvider delayDuration={0}>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
|
@@ -48,12 +48,15 @@ export function Logo({
|
|||||||
export function LogoType() {
|
export function LogoType() {
|
||||||
return (
|
return (
|
||||||
<Image
|
<Image
|
||||||
|
priority
|
||||||
className="max-h-8 w-full mr-auto "
|
className="max-h-8 w-full mr-auto "
|
||||||
src="/logotype.png"
|
src="/logotype.png"
|
||||||
alt="Logo"
|
alt="Logo"
|
||||||
width={2640}
|
width={2640}
|
||||||
height={733}
|
height={733}
|
||||||
style={{ objectFit: "contain", width: "100%", height: "100%" }}
|
style={{ objectFit: "contain", width: "100%", height: "100%" }}
|
||||||
|
loading="eager"
|
||||||
|
unoptimized={true}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user