Files
dance_school/src/app/page.tsx

58 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { prisma } from "@/infrastructure/db/prisma";
import { ScheduleCalendar } from "@/components/ScheduleCalendar";
import Link from "next/link";
import styles from "./page.module.css";
export default async function Home() {
// Calculate start and end of current week
const now = new Date();
const dayOfWeek = now.getDay(); // 0 is Sunday
const diff = now.getDate() - dayOfWeek + (dayOfWeek === 0 ? -6 : 1); // Adjust to Monday
const startOfWeek = new Date(now.setDate(diff));
startOfWeek.setHours(0, 0, 0, 0);
const endOfWeek = new Date(startOfWeek);
endOfWeek.setDate(endOfWeek.getDate() + 7);
const lessons = await prisma.lesson.findMany({
where: {
startTime: {
gte: startOfWeek,
lt: endOfWeek,
},
},
include: {
instructor: true,
branch: true,
class: true,
},
orderBy: {
startTime: 'asc',
},
});
return (
<div className={styles.page}>
<nav className={styles.nav}>
<div className={styles.logo}>Dance School</div>
<Link href="/admin/dashboard" className={styles.adminLink}>
Yönetici Paneli
</Link>
</nav>
<main className={styles.main}>
<section className={styles.hero}>
<h1>Dansın Ritmini Keşfedin</h1>
<p>Haftalık kurs programımızı aşağıdan takip edebilirsiniz.</p>
</section>
<ScheduleCalendar lessons={lessons} />
</main>
<footer className={styles.footer}>
<p>&copy; {new Date().getFullYear()} Dance School Yönetim Sistemi. Tüm hakları saklıdır.</p>
</footer>
</div>
);
}