2025-09-21 11:02:31 -07:00
|
|
|
"use client";
|
2024-11-05 14:16:27 +03:00
|
|
|
|
2025-09-21 11:02:31 -07:00
|
|
|
import Link from "next/link";
|
|
|
|
|
import { memo } from "react";
|
|
|
|
|
import { Button } from "@/components/ui/button";
|
2026-03-13 20:30:52 -07:00
|
|
|
import { VercelIcon } from "./icons";
|
2025-09-21 11:02:31 -07:00
|
|
|
import { VisibilitySelector, type VisibilityType } from "./visibility-selector";
|
2024-10-31 15:39:07 +05:30
|
|
|
|
2024-12-06 13:36:56 +03:00
|
|
|
function PureChatHeader({
|
|
|
|
|
chatId,
|
|
|
|
|
selectedVisibilityType,
|
|
|
|
|
isReadonly,
|
|
|
|
|
}: {
|
|
|
|
|
chatId: string;
|
|
|
|
|
selectedVisibilityType: VisibilityType;
|
|
|
|
|
isReadonly: boolean;
|
|
|
|
|
}) {
|
2024-10-24 16:35:51 -04:00
|
|
|
return (
|
2026-03-13 20:30:52 -07:00
|
|
|
<header className="sticky top-0 flex items-center gap-2 bg-background p-3">
|
2024-12-06 13:36:56 +03:00
|
|
|
{!isReadonly && (
|
|
|
|
|
<VisibilitySelector
|
|
|
|
|
chatId={chatId}
|
2025-09-21 11:02:31 -07:00
|
|
|
selectedVisibilityType={selectedVisibilityType}
|
2024-12-06 13:36:56 +03:00
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
2024-11-05 14:16:27 +03:00
|
|
|
<Button
|
2025-09-21 12:03:29 +01:00
|
|
|
asChild
|
2026-03-13 20:30:52 -07:00
|
|
|
className="hidden bg-neutral-900 px-4 text-neutral-50 hover:bg-neutral-800 md:ml-auto md:flex dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-neutral-200"
|
2024-11-05 14:16:27 +03:00
|
|
|
>
|
|
|
|
|
<Link
|
2026-02-23 17:24:17 -08:00
|
|
|
href={"https://vercel.com/templates/next.js/chatbot"}
|
2025-09-21 12:03:29 +01:00
|
|
|
rel="noreferrer"
|
2025-09-21 11:02:31 -07:00
|
|
|
target="_noblank"
|
2024-11-05 14:16:27 +03:00
|
|
|
>
|
|
|
|
|
<VercelIcon size={16} />
|
|
|
|
|
Deploy with Vercel
|
|
|
|
|
</Link>
|
|
|
|
|
</Button>
|
2024-10-24 16:35:51 -04:00
|
|
|
</header>
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-12-03 17:49:38 +03:00
|
|
|
|
|
|
|
|
export const ChatHeader = memo(PureChatHeader, (prevProps, nextProps) => {
|
2025-09-01 11:07:07 +01:00
|
|
|
return (
|
|
|
|
|
prevProps.chatId === nextProps.chatId &&
|
|
|
|
|
prevProps.selectedVisibilityType === nextProps.selectedVisibilityType &&
|
|
|
|
|
prevProps.isReadonly === nextProps.isReadonly
|
|
|
|
|
);
|
2024-12-03 17:49:38 +03:00
|
|
|
});
|