2024-04-16 16:25:21 -04:00
|
|
|
import Navbar from "@/components/editor/navbar"
|
2024-04-18 15:32:27 -04:00
|
|
|
import { User } from "@/lib/types"
|
|
|
|
import { currentUser } from "@clerk/nextjs"
|
2024-04-09 00:26:22 -04:00
|
|
|
import dynamic from "next/dynamic"
|
2024-04-18 15:32:27 -04:00
|
|
|
import { redirect } from "next/navigation"
|
2024-04-09 00:26:22 -04:00
|
|
|
|
|
|
|
const CodeEditor = dynamic(() => import("@/components/editor"), {
|
|
|
|
ssr: false,
|
|
|
|
})
|
|
|
|
|
2024-04-18 15:32:27 -04:00
|
|
|
export default async function CodePage() {
|
|
|
|
const user = await currentUser()
|
|
|
|
|
|
|
|
if (!user) {
|
|
|
|
redirect("/")
|
|
|
|
}
|
|
|
|
|
|
|
|
const userRes = await fetch(`http://localhost:8787/api/user?id=${user.id}`)
|
|
|
|
const userData = (await userRes.json()) as User
|
2024-04-11 03:34:58 -04:00
|
|
|
|
2024-04-09 00:26:22 -04:00
|
|
|
return (
|
2024-04-09 00:50:48 -04:00
|
|
|
<div className="overflow-hidden overscroll-none w-screen flex flex-col h-screen bg-background">
|
2024-04-18 15:32:27 -04:00
|
|
|
<Navbar userData={userData} />
|
2024-04-09 00:26:22 -04:00
|
|
|
<div className="w-screen flex grow">
|
2024-04-18 15:32:27 -04:00
|
|
|
<CodeEditor />
|
2024-04-09 00:26:22 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|