-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
114 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { auth } from "@clerk/nextjs/server"; | ||
import { redirect } from "next/navigation"; | ||
import { Button } from "~/components/ui/button"; | ||
import { MUTATIONS, QUERIES } from "~/server/db/queries"; | ||
|
||
export default async function DrivePage() { | ||
const session = await auth(); | ||
|
||
if (!session.userId) { | ||
return redirect("/sign-in"); | ||
} | ||
|
||
const rootFolder = await QUERIES.getRootFolderForUser(session.userId); | ||
|
||
if (!rootFolder) { | ||
return ( | ||
<form | ||
action={async () => { | ||
"use server"; | ||
const session = await auth(); | ||
|
||
if (!session.userId) { | ||
return redirect("/sign-in"); | ||
} | ||
|
||
const rootFolderId = await MUTATIONS.onboardUser(session.userId); | ||
|
||
return redirect(`/f/${rootFolderId}`); | ||
}} | ||
> | ||
<Button>Create new Drive</Button> | ||
</form> | ||
); | ||
} | ||
|
||
return redirect(`/f/${rootFolder.id}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function HomePage(props: { children: React.ReactNode }) { | ||
return ( | ||
<div className="flex min-h-screen flex-col items-center justify-center bg-gradient-to-br from-black via-neutral-900 to-neutral-800 p-4 text-white"> | ||
<main className="text-center">{props.children}</main> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,40 @@ | ||
import { auth } from "@clerk/nextjs/server"; | ||
import { redirect } from "next/navigation"; | ||
import Link from "next/link"; | ||
import { Button } from "~/components/ui/button"; | ||
|
||
export default function HomePage() { | ||
return ( | ||
<div className="flex min-h-screen flex-col items-center justify-center bg-gradient-to-br from-black via-neutral-900 to-neutral-800 p-4 text-white"> | ||
<main className="text-center"> | ||
<h1 className="mb-4 bg-gradient-to-r from-neutral-200 to-neutral-400 bg-clip-text text-5xl font-bold text-transparent md:text-6xl"> | ||
T3 Drive | ||
</h1> | ||
<p className="mx-auto mb-8 max-w-md text-xl text-neutral-400 md:text-2xl"> | ||
Secure, fast, and easy file storage for the modern web | ||
</p> | ||
<form | ||
action={async () => { | ||
"use server"; | ||
<> | ||
<h1 className="mb-4 bg-gradient-to-r from-neutral-200 to-neutral-400 bg-clip-text text-5xl font-bold text-transparent md:text-6xl"> | ||
T3 Drive | ||
</h1> | ||
<p className="mx-auto mb-8 max-w-md text-xl text-neutral-400 md:text-2xl"> | ||
Secure, fast, and easy file storage for the modern web | ||
</p> | ||
<form | ||
action={async () => { | ||
"use server"; | ||
|
||
const session = await auth(); | ||
const session = await auth(); | ||
|
||
if (!session.userId) { | ||
return redirect("/sign-in"); | ||
} | ||
if (!session.userId) { | ||
return redirect("/sign-in"); | ||
} | ||
|
||
return redirect("/drive"); | ||
}} | ||
return redirect("/drive"); | ||
}} | ||
> | ||
<Button | ||
size="lg" | ||
type="submit" | ||
className="border border-neutral-700 bg-neutral-800 text-white transition-colors hover:bg-neutral-700" | ||
> | ||
<Button | ||
size="lg" | ||
type="submit" | ||
className="border border-neutral-700 bg-neutral-800 text-white transition-colors hover:bg-neutral-700" | ||
> | ||
Get Started | ||
</Button> | ||
</form> | ||
</main> | ||
Get Started | ||
</Button> | ||
</form> | ||
<footer className="mt-16 text-sm text-neutral-500"> | ||
© {new Date().getFullYear()} T3 Drive. All rights reserved. | ||
</footer> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { SignInButton } from "@clerk/nextjs"; | ||
|
||
export default function HomePage() { | ||
return ( | ||
<> | ||
<SignInButton forceRedirectUrl={"/drive"} /> | ||
<footer className="mt-16 text-sm text-neutral-500"> | ||
© {new Date().getFullYear()} T3 Drive. All rights reserved. | ||
</footer> | ||
</> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters