import Link from "next/link";
import { redirect } from "next/navigation";
import { getAuth } from "@/app/actions/auth";
import NoteEditor from "@/components/editor/NoteEditor";

export default async function Home() {
  const auth = await getAuth();
  if (auth) {
    redirect("/notes");
  }

  return (
    <div className="flex flex-col items-center gap-8">
      <NoteEditor isUnauthorized />
      <i className="text-center text-sm text-neutral-400">
        Changes are not saved!<br />
        <Link href="/auth" className="font-bold hover:underline">Log in</Link> to save your notes.
      </i>
    </div>
  );
}
