mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-19 20:24:32 +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}
|
||||
toggleSidebar={toggleSidebar}
|
||||
/>
|
||||
|
||||
{page == "chat" && (
|
||||
<div className="mx-3 mt-4 gap-y-1 flex-col flex gap-x-1.5 items-center items-center">
|
||||
<button
|
||||
onClick={handleNewChat}
|
||||
<Link
|
||||
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 " />
|
||||
<p className="my-auto flex items-center text-sm">New Chat</p>
|
||||
</button>
|
||||
|
||||
</Link>
|
||||
<button
|
||||
onClick={() =>
|
||||
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="mt-2 mx-2.5 text-text-700 relative flex w-full">
|
||||
<LogoType
|
||||
assistantId={currentChatSession?.persona_id}
|
||||
page={page}
|
||||
toggleSidebar={toggleSidebar}
|
||||
handleNewChat={handleNewChat}
|
||||
|
@@ -2,12 +2,16 @@
|
||||
import { useContext } from "react";
|
||||
import { FiSidebar } from "react-icons/fi";
|
||||
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 { Tooltip } from "../tooltip/Tooltip";
|
||||
import { pageType } from "@/app/chat/sessionSidebar/types";
|
||||
import { Logo } from "../Logo";
|
||||
import { HeaderTitle } from "./HeaderTitle";
|
||||
import Link from "next/link";
|
||||
|
||||
export default function LogoType({
|
||||
toggleSidebar,
|
||||
@@ -16,6 +20,7 @@ export default function LogoType({
|
||||
page,
|
||||
toggled,
|
||||
showArrow,
|
||||
assistantId,
|
||||
}: {
|
||||
hideOnMobile?: boolean;
|
||||
toggleSidebar?: () => void;
|
||||
@@ -23,6 +28,7 @@ export default function LogoType({
|
||||
page: pageType;
|
||||
toggled?: boolean;
|
||||
showArrow?: boolean;
|
||||
assistantId?: number;
|
||||
}) {
|
||||
const combinedSettings = useContext(SettingsContext);
|
||||
const enterpriseSettings = combinedSettings?.enterpriseSettings;
|
||||
@@ -62,11 +68,27 @@ export default function LogoType({
|
||||
|
||||
{page == "chat" && !showArrow && (
|
||||
<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">
|
||||
<NewChatIcon size={20} />
|
||||
</div>
|
||||
</button>
|
||||
</Link>
|
||||
</Tooltip>
|
||||
)}
|
||||
{showArrow && (
|
||||
|
Reference in New Issue
Block a user