Skip to content

Commit

Permalink
add Schedule UI for Club Pages, complete Schedule Component for App.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaRaj0001 committed Jun 27, 2024
1 parent 038d6f4 commit dc67f8e
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 34 deletions.
30 changes: 16 additions & 14 deletions src/app/[clubname]/page.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import React from 'react'
import OurProjects from '@/components/ClubPageComponents/OurProjects'
import OurTeam from '@/components/ClubPageComponents/OurTeam'
import OurBlogs from '@/components/ClubPageComponents/OurBlogs'
import Gallery from '@/components/ClubPageComponents/Gallery'
import React from "react";
import OurProjects from "@/components/ClubPageComponents/OurProjects";
import OurTeam from "@/components/ClubPageComponents/OurTeam";
import OurBlogs from "@/components/ClubPageComponents/OurBlogs";
import Gallery from "@/components/ClubPageComponents/Gallery";
import OurSchedule from "@/components/ClubPageComponents/OurSchedule";

const page = ({params}) => {
const club=params.clubname
const page = ({ params }) => {
const club = params.clubname;
return (
<>
<Gallery club={club}/>
<OurTeam club={club}/>
<OurProjects club={club}/>
<OurBlogs club={club}/>
<Gallery club={club} />
<OurSchedule club={club} />
<OurTeam club={club} />
<OurProjects club={club} />
<OurBlogs club={club} />
</>
)
}
);
};

export default page
export default page;
13 changes: 10 additions & 3 deletions src/app/dashboard/events/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ const Page = async () => {
return (
<>
<div className="w-full h-full flex items-center justify-center flex-col">
<h1 className="w-full text-center font-bold">
{monthName} {year}
</h1>
<div className="flex flex-col items-center justify-center space-y-4 text-center">
<div className="space-y-2 mb-0">
<h2 className="text-4xl font-bold tracking-tighter sm:text-5xl">
{monthName} {year} Schedule
</h2>
<p className="max-w-[900px] text-gray-500 md:text-xl/relaxed lg:text-base/relaxed xl:text-xl/relaxed">
Click on a coloured cell to view, edit, delete event. Click on uncoloured cell to create event.
</p>
</div>
</div>
<MonthCalendar serializedEvents={JSON.stringify(events)}/>
</div>
</>
Expand Down
41 changes: 41 additions & 0 deletions src/components/ClubPageComponents/OurSchedule.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from "react";
import { getEventsForClub } from "@/app/actions/EventData";
import Calendar from "../ui/MonthCalendar";

const OurSchedule = async ({club}) => {
const fetchedEvents = await getEventsForClub(club);
const monthNames = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
const month = new Date().getMonth(); // Call the function to get the month
const year = new Date().getFullYear();
const monthName = monthNames[month];
return (
<div className="w-full min-h-[50vh] py-12 flex items-center flex-col justify-center">
<div className="flex flex-col items-center justify-center space-y-4 text-center">
<div className="space-y-2 mb-12">
<h2 className="text-4xl font-bold tracking-tighter sm:text-5xl">
{monthName} {year} Schedule
</h2>
<p className="max-w-[900px] text-gray-500 md:text-xl/relaxed lg:text-base/relaxed xl:text-xl/relaxed">
Click on a coloured cell to see event details
</p>
</div>
</div>
<Calendar serializedEvents={JSON.stringify(fetchedEvents)}/>
</div>
);
};

export default OurSchedule;
2 changes: 1 addition & 1 deletion src/components/Events/Calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function CustomDayContent({ date, eventDates }) {
<span style={{ position: "relative", overflow: "visible" }}>
{isEventDay ? (
<div>
<span className="bg-primary text-white p-1 ">{date.getDate()}</span>
<span className="bg-primary text-white rounded-full px-2 ">{date.getDate()}</span>
</div>
) : (
date.getDate()
Expand Down
11 changes: 8 additions & 3 deletions src/components/Events/create-modal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use client"
"use client";
import React from "react";
import {
AlertDialog,
Expand Down Expand Up @@ -26,7 +26,7 @@ export function CreateEventModal({ Date, open, onOpenChange }) {
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Create Event on {Date}</AlertDialogTitle>
<AlertDialogTitle>Create Event </AlertDialogTitle>

<form onSubmit={handleSubmit}>
{/* Title */}
Expand Down Expand Up @@ -147,7 +147,12 @@ export function CreateEventModal({ Date, open, onOpenChange }) {

<AlertDialogFooter>
<AlertDialogCancel>Close</AlertDialogCancel>
<button type="submit" className="bg-primary text-white p-2">Create Event</button>
<button
type="submit"
className="bg-primary text-white rounded-md p-2"
>
Create Event
</button>
</AlertDialogFooter>
</form>
</AlertDialogHeader>
Expand Down
9 changes: 6 additions & 3 deletions src/components/Events/view-update-modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function ViewUpdateEventModal({
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Update Event on {Date}</AlertDialogTitle>
<AlertDialogTitle>Update Event</AlertDialogTitle>

<form onSubmit={handleSubmit}>
{/* Title */}
Expand Down Expand Up @@ -166,7 +166,7 @@ export function ViewUpdateEventModal({
</div>
</div>

<AlertDialogFooter className="flex flex-col gap-2 flex-col-reverse" >
<AlertDialogFooter className="flex flex-col gap-2 flex-col-reverse">
<AlertDialogCancel>Close</AlertDialogCancel>
<button
type="button"
Expand All @@ -175,7 +175,10 @@ export function ViewUpdateEventModal({
>
Delete Event
</button>
<button type="submit" className="bg-primary text-white p-2 rounded-md">
<button
type="submit"
className="bg-primary text-white p-2 rounded-md"
>
Update Event
</button>
</AlertDialogFooter>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/Achievements.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ListItem from '../ui/listItem';
import { getAllAchievements } from '@/app/actions/AchievementData';


// const achievementsData = [

// {
// title: "First",
// description: "This is the first description",
Expand Down
17 changes: 12 additions & 5 deletions src/components/Home/OurSchedule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@ const OurSchedule = async () => {
const year = new Date().getFullYear();
const monthName = monthNames[month];
return (
<div className="w-full min-h-[50vh] pb-12 flex items-center flex-col justify-center">
<h1 className="w-full text-center text-3xl mb-8 font-bold">
{monthName} {year} Schedule
</h1>
<Calendar serializedEvents={JSON.stringify(fetchedEvents)}/>
<div className="w-full min-h-[60vh] pb-12 flex items-center flex-col justify-start">
<div className="flex flex-col items-center justify-center space-y-4 text-center">
<div className="space-y-2 mb-12">
<h2 className="text-4xl font-bold tracking-tighter sm:text-5xl">
{monthName} {year} Schedule
</h2>
<p className="max-w-[900px] text-gray-500 md:text-xl/relaxed lg:text-base/relaxed xl:text-xl/relaxed">
Click on a coloured cell to see event details
</p>
</div>
</div>
<Calendar serializedEvents={JSON.stringify(fetchedEvents)} />
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/DashboardHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const AboutBlock = ({ isSuperAdmin }) => (
</span>
</p>
</Link>
<Link href="/dashboard/gallery">
<Link href="/dashboard/events">
<p className="cursor-pointer">
/Events{" "}
<span className="text-zinc-400">
Expand Down
7 changes: 4 additions & 3 deletions src/components/ui/MonthCalendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ function CustomDayContent({ date, eventDates }) {
<span style={{ position: "relative", overflow: "visible" }}>
{isEventDay ? (
<div>
<span className="bg-primary text-white p-1 ">{date.getDate()}</span>
<span className="bg-primary text-white px-2 rounded-full ">
{date.getDate()}
</span>
</div>
) : (
date.getDate()
Expand Down Expand Up @@ -62,7 +64,7 @@ export default function Calendar({ serializedEvents }) {
),
Caption: CustomCaptionComponent,
}}
className="text-lg sm:text-xl"
className="text-lg sm:text-xl"
/>
{eventDaySelected && open && (
<EventDetailDialog
Expand All @@ -72,7 +74,6 @@ export default function Calendar({ serializedEvents }) {
onOpenChange={setOpen}
/>
)}

</>
);
}

0 comments on commit dc67f8e

Please sign in to comment.