import type React from "react"
import type { Metadata } from "next"
//import { Inter } from "next/font/google"
import { cookies } from "next/headers"
import "../globals.css"

import { SidebarProvider } from "@/components/ui/sidebar"
import { DashboardSidebar } from "./components/dashboard-sidebar"

export const metadata: Metadata = {
  title: "BK Pro League",
  description: "",
}

export default async function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode
}>) {
  const cookieStore = cookies()
  const defaultOpen = cookieStore.get("sidebar:state")?.value === "true"

  // const { token } = await getValidAuthTokens();

  // if (!token) {
  //   redirect("/"); // 👈 redirect if not authenticated
  // }


  return (
    <SidebarProvider defaultOpen={defaultOpen}>
      <DashboardSidebar />
      <div className="flex w-full flex-col sm:gap-12 sm:py-4 sm:pl-14">{children}</div>
    </SidebarProvider>
  )
}
