Spaces:
Running
Running
MingruiZhang
commited on
Commit
β’
60612a5
1
Parent(s):
052672d
change chat url and header
Browse files- app/{sign-in β (logout)/sign-in}/page.tsx +0 -1
- app/(logout)/unauthorized/page.tsx +24 -0
- app/{(chat) β chat}/layout.tsx +0 -0
- app/{(chat) β chat}/page.tsx +0 -0
- app/layout.tsx +2 -2
- app/{unauthorized/page.tsx β page.tsx} +4 -2
- app/projects/page.tsx +0 -0
- app/share/[id]/page.tsx +0 -48
- components/header.tsx +16 -20
app/{sign-in β (logout)/sign-in}/page.tsx
RENAMED
@@ -1,7 +1,6 @@
|
|
1 |
import { auth } from '@/auth';
|
2 |
import { LoginButton } from '@/components/LoginButton';
|
3 |
import { redirect } from 'next/navigation';
|
4 |
-
import { ThemeToggle } from '../../components/ThemeToggle';
|
5 |
|
6 |
export default async function SignInPage() {
|
7 |
const session = await auth();
|
|
|
1 |
import { auth } from '@/auth';
|
2 |
import { LoginButton } from '@/components/LoginButton';
|
3 |
import { redirect } from 'next/navigation';
|
|
|
4 |
|
5 |
export default async function SignInPage() {
|
6 |
const session = await auth();
|
app/(logout)/unauthorized/page.tsx
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { auth } from '@/auth';
|
2 |
+
import { redirect } from 'next/navigation';
|
3 |
+
import { Button } from '@/components/ui/Button';
|
4 |
+
import Link from 'next/link';
|
5 |
+
|
6 |
+
export default async function Unauthorized() {
|
7 |
+
const session = await auth();
|
8 |
+
// redirect to home if user is already logged in
|
9 |
+
if (session?.user) {
|
10 |
+
redirect('/');
|
11 |
+
}
|
12 |
+
|
13 |
+
return (
|
14 |
+
<div className="flex flex-col h-[calc(100vh-theme(spacing.16))] items-center justify-center py-10 space-y-2">
|
15 |
+
<div>
|
16 |
+
You are not authorized to view this page. Please sign in with Landing
|
17 |
+
account to continue.
|
18 |
+
</div>
|
19 |
+
<Button asChild className="mt-16">
|
20 |
+
<Link href="/sign-in">Sign in</Link>
|
21 |
+
</Button>
|
22 |
+
</div>
|
23 |
+
);
|
24 |
+
}
|
app/{(chat) β chat}/layout.tsx
RENAMED
File without changes
|
app/{(chat) β chat}/page.tsx
RENAMED
File without changes
|
app/layout.tsx
CHANGED
@@ -11,8 +11,8 @@ import { Header } from '@/components/Header';
|
|
11 |
export const metadata = {
|
12 |
metadataBase: new URL(`https://${process.env.VERCEL_URL}`),
|
13 |
title: {
|
14 |
-
default: '
|
15 |
-
template: `%s -
|
16 |
},
|
17 |
description: 'By Landing AI',
|
18 |
icons: {
|
|
|
11 |
export const metadata = {
|
12 |
metadataBase: new URL(`https://${process.env.VERCEL_URL}`),
|
13 |
title: {
|
14 |
+
default: 'Insight Playground',
|
15 |
+
template: `%s - Insight Playground`,
|
16 |
},
|
17 |
description: 'By Landing AI',
|
18 |
icons: {
|
app/{unauthorized/page.tsx β page.tsx}
RENAMED
@@ -1,7 +1,9 @@
|
|
1 |
-
|
|
|
|
|
2 |
return (
|
3 |
<div className="flex flex-col h-[calc(100vh-theme(spacing.16))] items-center justify-center py-10 space-y-2">
|
4 |
-
|
5 |
</div>
|
6 |
);
|
7 |
}
|
|
|
1 |
+
'use client';
|
2 |
+
|
3 |
+
export default function IndexPage() {
|
4 |
return (
|
5 |
<div className="flex flex-col h-[calc(100vh-theme(spacing.16))] items-center justify-center py-10 space-y-2">
|
6 |
+
Welcome to Insight Playground
|
7 |
</div>
|
8 |
);
|
9 |
}
|
app/projects/page.tsx
ADDED
File without changes
|
app/share/[id]/page.tsx
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
import { type Metadata } from 'next';
|
2 |
-
import { notFound } from 'next/navigation';
|
3 |
-
|
4 |
-
import { formatDate } from '@/lib/utils';
|
5 |
-
import { getSharedChat } from '@/app/actions';
|
6 |
-
import { ChatList } from '@/components/chat/ChatList';
|
7 |
-
|
8 |
-
interface SharePageProps {
|
9 |
-
params: {
|
10 |
-
id: string;
|
11 |
-
};
|
12 |
-
}
|
13 |
-
|
14 |
-
export async function generateMetadata({
|
15 |
-
params,
|
16 |
-
}: SharePageProps): Promise<Metadata> {
|
17 |
-
const chat = await getSharedChat(params.id);
|
18 |
-
|
19 |
-
return {
|
20 |
-
title: chat?.title.slice(0, 50) ?? 'Chat',
|
21 |
-
};
|
22 |
-
}
|
23 |
-
|
24 |
-
export default async function SharePage({ params }: SharePageProps) {
|
25 |
-
const chat = await getSharedChat(params.id);
|
26 |
-
|
27 |
-
if (!chat || !chat?.sharePath) {
|
28 |
-
notFound();
|
29 |
-
}
|
30 |
-
|
31 |
-
return (
|
32 |
-
<>
|
33 |
-
<div className="flex-1 space-y-6">
|
34 |
-
<div className="px-4 py-6 border-b bg-background md:px-6 md:py-8">
|
35 |
-
<div className="max-w-2xl mx-auto md:px-6">
|
36 |
-
<div className="space-y-1 md:-mx-8">
|
37 |
-
<h1 className="text-2xl font-bold">{chat.title}</h1>
|
38 |
-
<div className="text-sm text-muted-foreground">
|
39 |
-
{formatDate(chat.createdAt)} Β· {chat.messages.length} messages
|
40 |
-
</div>
|
41 |
-
</div>
|
42 |
-
</div>
|
43 |
-
</div>
|
44 |
-
{/* <ChatList messages={chat.messages} isLoading={false} /> */}
|
45 |
-
</div>
|
46 |
-
</>
|
47 |
-
);
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
components/header.tsx
CHANGED
@@ -4,31 +4,27 @@ import Link from 'next/link';
|
|
4 |
import { auth } from '@/auth';
|
5 |
import { Button } from '@/components/ui/Button';
|
6 |
import { UserMenu } from '@/components/UserMenu';
|
|
|
7 |
|
8 |
-
async function
|
9 |
const session = await auth();
|
10 |
-
return (
|
11 |
-
<>
|
12 |
-
<div className="flex items-center">
|
13 |
-
{/* <IconSeparator className="size-6 text-muted-foreground/50" /> */}
|
14 |
-
{session?.user ? (
|
15 |
-
<UserMenu user={session.user} />
|
16 |
-
) : (
|
17 |
-
<Button variant="link" asChild className="-ml-2">
|
18 |
-
<Link href="/sign-in?callbackUrl=/">Login</Link>
|
19 |
-
</Button>
|
20 |
-
)}
|
21 |
-
</div>
|
22 |
-
</>
|
23 |
-
);
|
24 |
-
}
|
25 |
|
26 |
-
|
|
|
|
|
|
|
27 |
return (
|
28 |
<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">
|
29 |
-
<
|
30 |
-
<
|
31 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
</header>
|
33 |
);
|
34 |
}
|
|
|
4 |
import { auth } from '@/auth';
|
5 |
import { Button } from '@/components/ui/Button';
|
6 |
import { UserMenu } from '@/components/UserMenu';
|
7 |
+
import { IconSeparator } from './ui/Icons';
|
8 |
|
9 |
+
export async function Header() {
|
10 |
const session = await auth();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
if (!session?.user) {
|
13 |
+
return null;
|
14 |
+
}
|
15 |
+
|
16 |
return (
|
17 |
<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">
|
18 |
+
<Button variant="link" asChild className="mr-2">
|
19 |
+
<Link href="/projects">Projects</Link>
|
20 |
+
</Button>
|
21 |
+
<Button variant="link" asChild className="mr-2">
|
22 |
+
<Link href="/chat">Chat</Link>
|
23 |
+
</Button>
|
24 |
+
<IconSeparator className="size-6 text-muted-foreground/50" />
|
25 |
+
<div className="flex items-center">
|
26 |
+
<UserMenu user={session!.user} />
|
27 |
+
</div>
|
28 |
</header>
|
29 |
);
|
30 |
}
|