import Link from "next/link";
import { DetailBackLink } from "@/components/detail-back-link";
import { MoodTrackerView } from "@/modules/journal/components/mood-tracker-view";
import { listJournalEntries } from "@/modules/journal/server/queries";

export default async function JournalMoodPage() {
  const entries = await listJournalEntries({ limit: 500 });

  return (
    <div className="mx-auto grid w-full max-w-5xl gap-4 min-w-0">
      <DetailBackLink href="/journal" label="Journal" />
      <div className="flex items-center justify-between gap-3">
        <h2 className="serif text-[22px] tracking-tight">Mood tracker</h2>
        <Link href="/journal/insights" className="text-[13px] text-[var(--accent)] hover:underline">
          View insights
        </Link>
      </div>
      <MoodTrackerView entries={entries} />
    </div>
  );
}
