add: wip
This commit is contained in:
72
app/(deploy)/WorkspaceNavigation.tsx
Normal file
72
app/(deploy)/WorkspaceNavigation.tsx
Normal file
@@ -0,0 +1,72 @@
|
||||
'use client';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem } from '@/components/ui/command';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { Workspace } from '@prisma/client';
|
||||
import { CommandList } from 'cmdk';
|
||||
import { Check, ChevronsUpDown } from 'lucide-react';
|
||||
import { usePathname, useRouter } from 'next/navigation';
|
||||
import React from 'react';
|
||||
|
||||
export default function WorkspaceNavigation({ workspaces }: { workspaces: Pick<Workspace, 'id' | 'name' | 'slug'>[] }) {
|
||||
const pathname = usePathname();
|
||||
|
||||
const [open, setOpen] = React.useState<boolean>(false);
|
||||
const [value, setValue] = React.useState<Pick<Workspace, 'id'> | null>(findSelectedWorkspace());
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
function onWorkspaceSelectionChange(workspace: Pick<Workspace, 'id'>) {
|
||||
router.push(`/${workspaces.find((w) => w.id === workspace.id)?.slug}`);
|
||||
}
|
||||
|
||||
function findSelectedWorkspace(): Pick<Workspace, 'id'> | null {
|
||||
const workspace = pathname.split('/')[1];
|
||||
if (!workspace) return null;
|
||||
const w = workspaces.find((w) => w.slug === workspace);
|
||||
if (!w) return null;
|
||||
return { id: w.id };
|
||||
}
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<Button variant="outline" role="combobox" aria-expanded={open} className="w-[200px] justify-between">
|
||||
{value ? workspaces.find((workspace) => workspace.id === value.id)?.name : 'Select workspace...'}
|
||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-[200px] p-0">
|
||||
<Command>
|
||||
<CommandInput placeholder="Search workspace..." />
|
||||
<CommandList>
|
||||
<CommandEmpty>
|
||||
<Button variant="ghost" className="">
|
||||
Create a Workspace
|
||||
</Button>
|
||||
</CommandEmpty>
|
||||
<CommandGroup>
|
||||
{workspaces.map((workspace) => (
|
||||
<CommandItem
|
||||
key={workspace.id}
|
||||
value={workspace.id}
|
||||
keywords={[workspace.name, workspace.slug]}
|
||||
onSelect={(currentValue) => {
|
||||
setValue({ id: currentValue });
|
||||
onWorkspaceSelectionChange({ id: currentValue });
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
<Check className={cn('mr-2 h-4 w-4', value?.id === workspace.id ? 'opacity-100' : 'opacity-0')} />
|
||||
{workspace.name}
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
68
app/(deploy)/[workspace]/CreateApplicationForm.tsx
Normal file
68
app/(deploy)/[workspace]/CreateApplicationForm.tsx
Normal file
@@ -0,0 +1,68 @@
|
||||
'use client';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet';
|
||||
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import Link from 'next/link';
|
||||
|
||||
export const ServiceProviderList = [
|
||||
{
|
||||
name: 'GitHub',
|
||||
value: 'github',
|
||||
image: 'https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png',
|
||||
permission: 'https://github.com/apps/stalin-deploy/installations/new',
|
||||
},
|
||||
{
|
||||
name: 'Registry',
|
||||
value: 'registry',
|
||||
image: '',
|
||||
},
|
||||
{
|
||||
name: 'Github Registry',
|
||||
value: 'github-registry',
|
||||
image: 'https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png',
|
||||
},
|
||||
];
|
||||
|
||||
export default function CreateApplicationForm() {
|
||||
const [serviceProvider, setServiceProvider] = useState<string>('github');
|
||||
|
||||
return (
|
||||
<Sheet>
|
||||
<SheetTrigger asChild>
|
||||
<Button className="flex gap-1 justify-center items-center bg-[#3A7BFE]">
|
||||
<Plus />
|
||||
New Application
|
||||
</Button>
|
||||
</SheetTrigger>
|
||||
<SheetContent className="min-w-[500px]">
|
||||
<SheetHeader>
|
||||
<SheetTitle>New Application</SheetTitle>
|
||||
<SheetDescription>Deploy a new application from source</SheetDescription>
|
||||
</SheetHeader>
|
||||
<div>
|
||||
<h3>Select Provider</h3>
|
||||
<RadioGroup defaultValue="github" className="flex flex-col gap-4" onValueChange={setServiceProvider}>
|
||||
{ServiceProviderList.map((provider) => (
|
||||
<div key={provider.value} className={cn('flex flex-row items-center gap-4 border-[1px] rounded-lg py-2 px-4', provider.value == serviceProvider ? 'border-[#3A7BFE]' : 'border-gray-300')}>
|
||||
<RadioGroupItem value={provider.value} id={provider.value} />
|
||||
<label htmlFor={provider.value} className="flex flex-row items-center gap-4">
|
||||
<img src={provider.image} alt={provider.name} className="w-8 h-8 rounded-full" />
|
||||
{provider.name}
|
||||
</label>
|
||||
</div>
|
||||
))}
|
||||
</RadioGroup>
|
||||
{(serviceProvider == 'github' || serviceProvider == 'github-registry') && (
|
||||
<p>
|
||||
Not seeing the repositories you expected here? <Link href={ServiceProviderList.find((s) => s.value == serviceProvider)?.permission || ''}>Edit Your GitHub Permissions</Link>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
);
|
||||
}
|
||||
41
app/(deploy)/[workspace]/Navigation.tsx
Normal file
41
app/(deploy)/[workspace]/Navigation.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
'use client';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
let links = [
|
||||
{ href: '', label: 'Applications' },
|
||||
{ href: 'databases', label: 'Databases' },
|
||||
{ href: 'registry', label: 'Registry' },
|
||||
{ href: 'settings', label: 'Settings' },
|
||||
];
|
||||
|
||||
export default function Navigation() {
|
||||
let pathname = usePathname();
|
||||
|
||||
return (
|
||||
<nav>
|
||||
<ul className="flex flex-row justify-start mt-4 mb-2 gap-8">
|
||||
{links.map(({ href, label }) => (
|
||||
<li key={label}>
|
||||
<a className={cn('px-3 py-2 rounded-md text-black font-medium text-sm', checkPathname(pathname, href) && 'bg-[#3A7BFE] text-white')} href={setHref(pathname, href)}>
|
||||
{label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
function checkPathname(pathname: string, href: string): boolean {
|
||||
const route = pathname.split('/')[2] || '';
|
||||
if (route === href) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function setHref(pathname: string, href: string): string {
|
||||
const route = pathname.split('/')[1];
|
||||
if (!route) return '';
|
||||
return `/${route}/${href}`;
|
||||
}
|
||||
21
app/(deploy)/[workspace]/databases/page.tsx
Normal file
21
app/(deploy)/[workspace]/databases/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Database, Plus } from 'lucide-react';
|
||||
|
||||
export default async function Databases() {
|
||||
return (
|
||||
<div className="mt-12">
|
||||
<h1 className="text-3xl font-semibold">Databases</h1>
|
||||
<div className="bg-white py-6 flex flex-col items-center rounded-lg mt-6 gap-4">
|
||||
<Database size={64} className="text-gray-300" />
|
||||
<div className="text-center">
|
||||
<h3 className="font-semibold">No database</h3>
|
||||
<p className="text-gray-700">Get started by creating a new database.</p>
|
||||
</div>
|
||||
<Button className="flex gap-1 justify-center items-center bg-[#3A7BFE]">
|
||||
<Plus />
|
||||
New Database
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
18
app/(deploy)/[workspace]/layout.tsx
Normal file
18
app/(deploy)/[workspace]/layout.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import Navigation from './Navigation';
|
||||
|
||||
export default async function WorkspaceLayout({ children }: Readonly<{ children: React.ReactNode }>) {
|
||||
return (
|
||||
<>
|
||||
<div className="bg-white flex justify-center py-2 pt-4 border-b-2 border-b-gray-200">
|
||||
<div className="container">
|
||||
<div className="border-t-[1px] border-t-gray-200">
|
||||
<Navigation />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-[#ECEFF1] overflow-y-auto flex-grow">
|
||||
<div className="container">{children}</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
59
app/(deploy)/[workspace]/page.tsx
Normal file
59
app/(deploy)/[workspace]/page.tsx
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Button } from '@/components/ui/button';
|
||||
import prisma from '@/lib/prisma';
|
||||
import { PackagePlus, Plus } from 'lucide-react';
|
||||
import CreateApplicationForm from './CreateApplicationForm';
|
||||
import { getSession } from 'next-auth/react';
|
||||
|
||||
export default async function Workspace({ params }: { params: { workspace: string } }) {
|
||||
const applications = await prisma.application.findMany({
|
||||
where: {
|
||||
Workspace: {
|
||||
name: params.workspace,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const session = await getSession();
|
||||
const account = await prisma.account.findFirst({
|
||||
where: {
|
||||
userId: session?.user.id as string,
|
||||
},
|
||||
});
|
||||
|
||||
fetch('https://api.github.com/users/fayorg/repos', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${account?.access_token}`,
|
||||
},
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then(console.log);
|
||||
|
||||
if (applications.length == 0) {
|
||||
return (
|
||||
<div className="mt-12">
|
||||
<h1 className="text-3xl font-semibold">Applications</h1>
|
||||
<div className="bg-white py-6 flex flex-col items-center rounded-lg mt-6 gap-4">
|
||||
<PackagePlus size={64} className="text-gray-300" />
|
||||
<div className="text-center">
|
||||
<h3 className="font-semibold">No applications</h3>
|
||||
<p className="text-gray-700">Get started by creating a new app.</p>
|
||||
</div>
|
||||
<CreateApplicationForm />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mt-12">
|
||||
<div className="flex flex-row justify-between">
|
||||
<h1 className="text-3xl font-semibold">Applications</h1>
|
||||
<Button className="flex gap-1 justify-center items-center bg-[#3A7BFE]">
|
||||
<Plus />
|
||||
New Application
|
||||
</Button>
|
||||
</div>
|
||||
<div className="bg-white py-6 flex flex-col items-center rounded-lg mt-6 gap-4"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
43
app/(deploy)/layout.tsx
Normal file
43
app/(deploy)/layout.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import Image from 'next/image';
|
||||
import '../globals.css';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { redirect } from 'next/navigation';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import prisma from '@/lib/prisma';
|
||||
import WorkspaceNavigation from './WorkspaceNavigation';
|
||||
|
||||
export default async function DashboardLayout({ children }: Readonly<{ children: React.ReactNode }>) {
|
||||
const session = await getServerSession();
|
||||
|
||||
if (!session) {
|
||||
redirect('/sign-in');
|
||||
}
|
||||
|
||||
const workspaces = await prisma.workspace.findMany({
|
||||
where: {
|
||||
ownerId: session.user.id as string,
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="bg-white flex justify-center pt-4">
|
||||
<div className="container">
|
||||
<div className="flex flex-row justify-between items-center">
|
||||
<div>
|
||||
<Image src="/stalin-deploy.png" alt="AkeTechnology" width={200} height={35} />
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<WorkspaceNavigation workspaces={workspaces} />
|
||||
<Avatar>
|
||||
<AvatarImage src={session.user.image as string} alt={session.user.name as string} />
|
||||
<AvatarFallback>{session.user.name.at(0) as string}</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{children}
|
||||
</>
|
||||
);
|
||||
}
|
||||
19
app/(deploy)/page.tsx
Normal file
19
app/(deploy)/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import prisma from '@/lib/prisma';
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
// This component should never render
|
||||
export default async function NoWorkspace() {
|
||||
const session = await getServerSession();
|
||||
const workspace = await prisma.workspace.findFirst({
|
||||
where: {
|
||||
ownerId: session?.user.id as string,
|
||||
},
|
||||
});
|
||||
|
||||
if (workspace) {
|
||||
redirect(`/${workspace.slug}`);
|
||||
}
|
||||
|
||||
return <div>You don't </div>;
|
||||
}
|
||||
6
app/Providers.tsx
Normal file
6
app/Providers.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
'use client';
|
||||
import { SessionProvider } from 'next-auth/react';
|
||||
|
||||
export default function Providers({ children }: { children: React.ReactNode }) {
|
||||
return <SessionProvider>{children}</SessionProvider>;
|
||||
}
|
||||
6
app/api/auth/[...nextauth]/route.ts
Normal file
6
app/api/auth/[...nextauth]/route.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import NextAuth from "next-auth"
|
||||
import { authOptions } from "@/lib/nextauth"
|
||||
|
||||
const handler = NextAuth(authOptions)
|
||||
|
||||
export { handler as GET, handler as POST }
|
||||
@@ -1,33 +1,76 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
:root {
|
||||
--foreground-rgb: 0, 0, 0;
|
||||
--background-start-rgb: 214, 219, 220;
|
||||
--background-end-rgb: 255, 255, 255;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
|
||||
@layer base {
|
||||
:root {
|
||||
--foreground-rgb: 255, 255, 255;
|
||||
--background-start-rgb: 0, 0, 0;
|
||||
--background-end-rgb: 0, 0, 0;
|
||||
--background: 0 0% 100%;
|
||||
--foreground: 222.2 84% 4.9%;
|
||||
|
||||
--card: 0 0% 100%;
|
||||
--card-foreground: 222.2 84% 4.9%;
|
||||
|
||||
--popover: 0 0% 100%;
|
||||
--popover-foreground: 222.2 84% 4.9%;
|
||||
|
||||
--primary: 222.2 47.4% 11.2%;
|
||||
--primary-foreground: 210 40% 98%;
|
||||
|
||||
--secondary: 210 40% 96.1%;
|
||||
--secondary-foreground: 222.2 47.4% 11.2%;
|
||||
|
||||
--muted: 210 40% 96.1%;
|
||||
--muted-foreground: 215.4 16.3% 46.9%;
|
||||
|
||||
--accent: 210 40% 96.1%;
|
||||
--accent-foreground: 222.2 47.4% 11.2%;
|
||||
|
||||
--destructive: 0 84.2% 60.2%;
|
||||
--destructive-foreground: 210 40% 98%;
|
||||
|
||||
--border: 214.3 31.8% 91.4%;
|
||||
--input: 214.3 31.8% 91.4%;
|
||||
--ring: 222.2 84% 4.9%;
|
||||
|
||||
--radius: 0.5rem;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: 222.2 84% 4.9%;
|
||||
--foreground: 210 40% 98%;
|
||||
|
||||
--card: 222.2 84% 4.9%;
|
||||
--card-foreground: 210 40% 98%;
|
||||
|
||||
--popover: 222.2 84% 4.9%;
|
||||
--popover-foreground: 210 40% 98%;
|
||||
|
||||
--primary: 210 40% 98%;
|
||||
--primary-foreground: 222.2 47.4% 11.2%;
|
||||
|
||||
--secondary: 217.2 32.6% 17.5%;
|
||||
--secondary-foreground: 210 40% 98%;
|
||||
|
||||
--muted: 217.2 32.6% 17.5%;
|
||||
--muted-foreground: 215 20.2% 65.1%;
|
||||
|
||||
--accent: 217.2 32.6% 17.5%;
|
||||
--accent-foreground: 210 40% 98%;
|
||||
|
||||
--destructive: 0 62.8% 30.6%;
|
||||
--destructive-foreground: 210 40% 98%;
|
||||
|
||||
--border: 217.2 32.6% 17.5%;
|
||||
--input: 217.2 32.6% 17.5%;
|
||||
--ring: 212.7 26.8% 83.9%;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
color: rgb(var(--foreground-rgb));
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
transparent,
|
||||
rgb(var(--background-end-rgb))
|
||||
)
|
||||
rgb(var(--background-start-rgb));
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
.text-balance {
|
||||
text-wrap: balance;
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border;
|
||||
}
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Inter } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import type { Metadata } from 'next';
|
||||
import { Inter } from 'next/font/google';
|
||||
import './globals.css';
|
||||
import Providers from './Providers';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
const inter = Inter({ subsets: ['latin'] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
title: 'Create Next App',
|
||||
description: 'Generated by create next app',
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.className}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={cn(inter.className, 'min-h-screen flex flex-col')}>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
113
app/page.tsx
113
app/page.tsx
@@ -1,113 +0,0 @@
|
||||
import Image from "next/image";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<main className="flex min-h-screen flex-col items-center justify-between p-24">
|
||||
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
|
||||
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
|
||||
Get started by editing
|
||||
<code className="font-mono font-bold">app/page.tsx</code>
|
||||
</p>
|
||||
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
|
||||
<a
|
||||
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
|
||||
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
By{" "}
|
||||
<Image
|
||||
src="/vercel.svg"
|
||||
alt="Vercel Logo"
|
||||
className="dark:invert"
|
||||
width={100}
|
||||
height={24}
|
||||
priority
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="relative flex place-items-center before:absolute before:h-[300px] before:w-full sm:before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-full sm:after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px] z-[-1]">
|
||||
<Image
|
||||
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js Logo"
|
||||
width={180}
|
||||
height={37}
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-32 grid text-center lg:max-w-5xl lg:w-full lg:mb-0 lg:grid-cols-4 lg:text-left">
|
||||
<a
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<h2 className={`mb-3 text-2xl font-semibold`}>
|
||||
Docs{" "}
|
||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
||||
->
|
||||
</span>
|
||||
</h2>
|
||||
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
|
||||
Find in-depth information about Next.js features and API.
|
||||
</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<h2 className={`mb-3 text-2xl font-semibold`}>
|
||||
Learn{" "}
|
||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
||||
->
|
||||
</span>
|
||||
</h2>
|
||||
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
|
||||
Learn about Next.js in an interactive course with quizzes!
|
||||
</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<h2 className={`mb-3 text-2xl font-semibold`}>
|
||||
Templates{" "}
|
||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
||||
->
|
||||
</span>
|
||||
</h2>
|
||||
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
|
||||
Explore starter templates for Next.js.
|
||||
</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<h2 className={`mb-3 text-2xl font-semibold`}>
|
||||
Deploy{" "}
|
||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
||||
->
|
||||
</span>
|
||||
</h2>
|
||||
<p className={`m-0 max-w-[30ch] text-sm opacity-50 text-balance`}>
|
||||
Instantly deploy your Next.js site to a shareable URL with Vercel.
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
16
app/sign-in/layout.tsx
Normal file
16
app/sign-in/layout.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
export const metadata = {
|
||||
title: 'Next.js',
|
||||
description: 'Generated by Next.js',
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
21
app/sign-in/page.tsx
Normal file
21
app/sign-in/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
'use client';
|
||||
|
||||
import { signIn, signOut, useSession } from 'next-auth/react';
|
||||
|
||||
export default function SignInPage() {
|
||||
const { data: session } = useSession();
|
||||
if (session) {
|
||||
return (
|
||||
<>
|
||||
Signed in as {session.user?.email} <br />
|
||||
<button onClick={() => signOut()}>Sign out</button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
Not signed in <br />
|
||||
<button onClick={() => signIn('github')}>Sign in</button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user