Spaces:
Running
Running
wuyiqunLu
commited on
feat: show new chat in header (#39)
Browse files<img width="1161" alt="image"
src="https://github.com/landing-ai/vision-agent-ui/assets/132986242/a9d9026f-9bff-4a47-a349-23c96ca85e03">
- app/layout.tsx +1 -1
- components/Header.tsx +10 -0
- components/chat/ChatList.tsx +5 -1
app/layout.tsx
CHANGED
|
@@ -51,7 +51,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|
| 51 |
disableTransitionOnChange
|
| 52 |
>
|
| 53 |
<div className="flex flex-col min-h-screen">
|
| 54 |
-
|
| 55 |
<main className="flex flex-col flex-1 bg-muted/50">{children}</main>
|
| 56 |
</div>
|
| 57 |
<TailwindIndicator />
|
|
|
|
| 51 |
disableTransitionOnChange
|
| 52 |
>
|
| 53 |
<div className="flex flex-col min-h-screen">
|
| 54 |
+
<Header />
|
| 55 |
<main className="flex flex-col flex-1 bg-muted/50">{children}</main>
|
| 56 |
</div>
|
| 57 |
<TailwindIndicator />
|
components/Header.tsx
CHANGED
|
@@ -16,6 +16,16 @@ import { redirect } from 'next/navigation';
|
|
| 16 |
export async function Header() {
|
| 17 |
const session = await auth();
|
| 18 |
const { isAdmin } = await authEmail();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
return (
|
| 20 |
<header className="sticky top-0 z-50 flex items-center justify-end w-full h-16 px-8 border-b shrink-0 bg-gradient-to-b from-background/10 via-background/50 to-background/80 backdrop-blur-xl">
|
| 21 |
{/* <Tooltip>
|
|
|
|
| 16 |
export async function Header() {
|
| 17 |
const session = await auth();
|
| 18 |
const { isAdmin } = await authEmail();
|
| 19 |
+
|
| 20 |
+
if (process.env.NEXT_PUBLIC_IS_HUGGING_FACE) {
|
| 21 |
+
return (
|
| 22 |
+
<header className="sticky top-0 z-50 flex items-center justify-end w-full h-16 px-8 border-b shrink-0 bg-gradient-to-b from-background/10 via-background/50 to-background/80 backdrop-blur-xl">
|
| 23 |
+
<Button variant="link" asChild className="mr-2">
|
| 24 |
+
<Link href="/chat">New Chat</Link>
|
| 25 |
+
</Button>
|
| 26 |
+
</header>
|
| 27 |
+
);
|
| 28 |
+
}
|
| 29 |
return (
|
| 30 |
<header className="sticky top-0 z-50 flex items-center justify-end w-full h-16 px-8 border-b shrink-0 bg-gradient-to-b from-background/10 via-background/50 to-background/80 backdrop-blur-xl">
|
| 31 |
{/* <Tooltip>
|
components/chat/ChatList.tsx
CHANGED
|
@@ -25,7 +25,11 @@ export function ChatList({ messages, session }: ChatList) {
|
|
| 25 |
{!process.env.NEXT_PUBLIC_IS_HUGGING_FACE ? (
|
| 26 |
<p className="text-muted-foreground leading-normal">
|
| 27 |
Please visit and login into{' '}
|
| 28 |
-
<Link
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
our landing website
|
| 30 |
</Link>{' '}
|
| 31 |
to save and revisit your chat history!
|
|
|
|
| 25 |
{!process.env.NEXT_PUBLIC_IS_HUGGING_FACE ? (
|
| 26 |
<p className="text-muted-foreground leading-normal">
|
| 27 |
Please visit and login into{' '}
|
| 28 |
+
<Link
|
| 29 |
+
href="https://va.landing.ai/"
|
| 30 |
+
target="_blank"
|
| 31 |
+
className="underline"
|
| 32 |
+
>
|
| 33 |
our landing website
|
| 34 |
</Link>{' '}
|
| 35 |
to save and revisit your chat history!
|