feat: Implement a weekly schedule calendar on the homepage and extend branch management with hall count and phone fields.

This commit is contained in:
kertenkerem
2026-01-08 01:57:54 +03:00
parent 6880c738f9
commit 091435c8b4
10 changed files with 324 additions and 182 deletions

View File

@@ -1,66 +1,57 @@
import Image from "next/image";
import { prisma } from "@/infrastructure/db/prisma";
import { ScheduleCalendar } from "@/components/ScheduleCalendar";
import Link from "next/link";
import styles from "./page.module.css";
export default function Home() {
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}>
<Image
className={styles.logo}
src="/next.svg"
alt="Next.js logo"
width={100}
height={20}
priority
/>
<div className={styles.intro}>
<h1>To get started, edit the page.tsx file.</h1>
<p>
Looking for a starting point or more instructions? Head over to{" "}
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Templates
</a>{" "}
or the{" "}
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Learning
</a>{" "}
center.
</p>
</div>
<div className={styles.ctas}>
<a
className={styles.primary}
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className={styles.logo}
src="/vercel.svg"
alt="Vercel logomark"
width={16}
height={16}
/>
Deploy Now
</a>
<a
className={styles.secondary}
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Documentation
</a>
</div>
<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>
);
}