mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-20 13:05:49 +02:00
proper new chat button redirects (#2074)
This commit is contained in:
@@ -102,17 +102,29 @@ export const HistorySidebar = forwardRef<HTMLDivElement, HistorySidebarProps>(
|
|||||||
page={page}
|
page={page}
|
||||||
toggleSidebar={toggleSidebar}
|
toggleSidebar={toggleSidebar}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{page == "chat" && (
|
{page == "chat" && (
|
||||||
<div className="mx-3 mt-4 gap-y-1 flex-col flex gap-x-1.5 items-center items-center">
|
<div className="mx-3 mt-4 gap-y-1 flex-col flex gap-x-1.5 items-center items-center">
|
||||||
<button
|
<Link
|
||||||
onClick={handleNewChat}
|
|
||||||
className="w-full p-2 bg-white border-border border rounded items-center hover:bg-background-200 cursor-pointer transition-all duration-150 flex gap-x-2"
|
className="w-full p-2 bg-white border-border border rounded items-center hover:bg-background-200 cursor-pointer transition-all duration-150 flex gap-x-2"
|
||||||
|
href={
|
||||||
|
`/${page}` +
|
||||||
|
(NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA &&
|
||||||
|
currentChatSession?.persona_id
|
||||||
|
? `?assistantId=${currentChatSession?.persona_id}`
|
||||||
|
: "")
|
||||||
|
}
|
||||||
|
onClick={(e) => {
|
||||||
|
if (e.metaKey || e.ctrlKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (handleNewChat) {
|
||||||
|
handleNewChat();
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<FiEdit className="flex-none " />
|
<FiEdit className="flex-none " />
|
||||||
<p className="my-auto flex items-center text-sm">New Chat</p>
|
<p className="my-auto flex items-center text-sm">New Chat</p>
|
||||||
</button>
|
</Link>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
createFolder("New Folder")
|
createFolder("New Folder")
|
||||||
|
@@ -71,6 +71,7 @@ export default function FunctionalHeader({
|
|||||||
<div className="pb-6 left-0 sticky top-0 z-20 w-full relative flex">
|
<div className="pb-6 left-0 sticky top-0 z-20 w-full relative flex">
|
||||||
<div className="mt-2 mx-2.5 text-text-700 relative flex w-full">
|
<div className="mt-2 mx-2.5 text-text-700 relative flex w-full">
|
||||||
<LogoType
|
<LogoType
|
||||||
|
assistantId={currentChatSession?.persona_id}
|
||||||
page={page}
|
page={page}
|
||||||
toggleSidebar={toggleSidebar}
|
toggleSidebar={toggleSidebar}
|
||||||
handleNewChat={handleNewChat}
|
handleNewChat={handleNewChat}
|
||||||
|
@@ -2,12 +2,16 @@
|
|||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import { FiSidebar } from "react-icons/fi";
|
import { FiSidebar } from "react-icons/fi";
|
||||||
import { SettingsContext } from "../settings/SettingsProvider";
|
import { SettingsContext } from "../settings/SettingsProvider";
|
||||||
import { NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED } from "@/lib/constants";
|
import {
|
||||||
|
NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED,
|
||||||
|
NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA,
|
||||||
|
} from "@/lib/constants";
|
||||||
import { LefToLineIcon, NewChatIcon, RightToLineIcon } from "../icons/icons";
|
import { LefToLineIcon, NewChatIcon, RightToLineIcon } from "../icons/icons";
|
||||||
import { Tooltip } from "../tooltip/Tooltip";
|
import { Tooltip } from "../tooltip/Tooltip";
|
||||||
import { pageType } from "@/app/chat/sessionSidebar/types";
|
import { pageType } from "@/app/chat/sessionSidebar/types";
|
||||||
import { Logo } from "../Logo";
|
import { Logo } from "../Logo";
|
||||||
import { HeaderTitle } from "./HeaderTitle";
|
import { HeaderTitle } from "./HeaderTitle";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
export default function LogoType({
|
export default function LogoType({
|
||||||
toggleSidebar,
|
toggleSidebar,
|
||||||
@@ -16,6 +20,7 @@ export default function LogoType({
|
|||||||
page,
|
page,
|
||||||
toggled,
|
toggled,
|
||||||
showArrow,
|
showArrow,
|
||||||
|
assistantId,
|
||||||
}: {
|
}: {
|
||||||
hideOnMobile?: boolean;
|
hideOnMobile?: boolean;
|
||||||
toggleSidebar?: () => void;
|
toggleSidebar?: () => void;
|
||||||
@@ -23,6 +28,7 @@ export default function LogoType({
|
|||||||
page: pageType;
|
page: pageType;
|
||||||
toggled?: boolean;
|
toggled?: boolean;
|
||||||
showArrow?: boolean;
|
showArrow?: boolean;
|
||||||
|
assistantId?: number;
|
||||||
}) {
|
}) {
|
||||||
const combinedSettings = useContext(SettingsContext);
|
const combinedSettings = useContext(SettingsContext);
|
||||||
const enterpriseSettings = combinedSettings?.enterpriseSettings;
|
const enterpriseSettings = combinedSettings?.enterpriseSettings;
|
||||||
@@ -62,11 +68,27 @@ export default function LogoType({
|
|||||||
|
|
||||||
{page == "chat" && !showArrow && (
|
{page == "chat" && !showArrow && (
|
||||||
<Tooltip delayDuration={1000} content="New Chat">
|
<Tooltip delayDuration={1000} content="New Chat">
|
||||||
<button className="my-auto mobile:hidden" onClick={handleNewChat}>
|
<Link
|
||||||
|
className="my-auto mobile:hidden"
|
||||||
|
href={
|
||||||
|
`/${page}` +
|
||||||
|
(NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA && assistantId
|
||||||
|
? `?assistantId=${assistantId}`
|
||||||
|
: "")
|
||||||
|
}
|
||||||
|
onClick={(e) => {
|
||||||
|
if (e.metaKey || e.ctrlKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (handleNewChat) {
|
||||||
|
handleNewChat();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div className="cursor-pointer ml-2 flex-none text-text-700 hover:text-text-600 transition-colors duration-300">
|
<div className="cursor-pointer ml-2 flex-none text-text-700 hover:text-text-600 transition-colors duration-300">
|
||||||
<NewChatIcon size={20} />
|
<NewChatIcon size={20} />
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</Link>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
{showArrow && (
|
{showArrow && (
|
||||||
|
Reference in New Issue
Block a user