diff --git a/app/[locale]/@modals/(.)student-activities/clubs/[dispaly_name]/event/page.tsx b/app/[locale]/@modals/(.)student-activities/clubs/[dispaly_name]/event/page.tsx new file mode 100644 index 00000000..40fe5061 --- /dev/null +++ b/app/[locale]/@modals/(.)student-activities/clubs/[dispaly_name]/event/page.tsx @@ -0,0 +1,123 @@ +import Image from 'next/image'; + +import { GalleryCarousel } from '~/components/carousels'; +import { Dialog } from '~/components/dialog'; + +interface ClubEvent { + id: number; + title: string; + date: string; + image: [string]; + description: string; +} + +export default function EventPage({ + searchParams, +}: { + params: { locale: string }; + searchParams: { club_event: string }; +}) { + const events = [ + { + id: 0, + title: 'Event 1', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, + { + id: 1, + title: 'Event 2', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, + { + id: 2, + title: 'Event 3', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, + { + id: 3, + title: 'Event 4', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, + { + id: 4, + title: 'Event 5', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, + ] as ClubEvent[]; + + const id = parseInt(searchParams.club_event); + const clubEvent = events[id]; + const imageCount = clubEvent.image.length; + + return ( + + + {[...Array(imageCount)].map((_, index) => ( + {String(index)} + ))} + +
+

+ {clubEvent.title} +

+ + {[...Array(imageCount)].map((_, index) => ( + {String(index)} + ))} + +
+

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolore quis + optio adipisci, voluptates nobis eos nisi tempora eius assumenda + maxime et velit reiciendis reprehenderit libero aut rem, vero, dolorum + animi! Voluptatum assumenda rerum, non consequatur labore vitae + repudiandae maxime beatae in doloribus itaque, quaerat dolorem + nesciunt modi quas provident officia, necessitatibus ut amet qui + voluptatibus facere. Aut aliquid veritatis cum, nihil, minima + laudantium perferendis assumenda doloribus quam aspernatur nulla + porro! +

+
+
+ ); +} diff --git a/app/[locale]/academics/page.tsx b/app/[locale]/academics/page.tsx index b89a4d0c..2edc9a35 100644 --- a/app/[locale]/academics/page.tsx +++ b/app/[locale]/academics/page.tsx @@ -1,6 +1,6 @@ import { WorkInProgressStatus } from '~/components/status'; -export default function Academics({ +export default async function Academics({ params: { locale }, }: { params: { locale: string }; diff --git a/app/[locale]/student-activities/clubs/[display_name]/event/page.tsx b/app/[locale]/student-activities/clubs/[display_name]/event/page.tsx new file mode 100644 index 00000000..b959ba15 --- /dev/null +++ b/app/[locale]/student-activities/clubs/[display_name]/event/page.tsx @@ -0,0 +1,9 @@ +import { redirect } from 'next/navigation'; + +export default function Event({ + params: { locale, display_name }, +}: { + params: { locale: string; display_name: string }; +}) { + redirect(`/${locale}/student-activities/clubs/${display_name}`); +} diff --git a/app/[locale]/student-activities/clubs/[display_name]/page.tsx b/app/[locale]/student-activities/clubs/[display_name]/page.tsx index caf37afb..31cf549b 100644 --- a/app/[locale]/student-activities/clubs/[display_name]/page.tsx +++ b/app/[locale]/student-activities/clubs/[display_name]/page.tsx @@ -1,14 +1,465 @@ -import { WorkInProgressStatus } from '~/components/status'; -import { clubs, db } from '~/server/db'; +import { eq } from 'drizzle-orm'; +import Image from 'next/image'; +import Link from 'next/link'; +import type { ReactNode } from 'react'; +import { FaInstagram, FaLinkedinIn } from 'react-icons/fa'; +import { FaXTwitter } from 'react-icons/fa6'; +import { MdEmail, MdMailOutline, MdOutlineLocalPhone } from 'react-icons/md'; +import { LuFacebook } from 'react-icons/lu'; + +import { GalleryCarousel } from '~/components/carousels'; +import Heading from '~/components/heading'; +import ImageHeader from '~/components/image-header'; +import { + Card, + CardContent, + CardFooter, + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '~/components/ui'; +import { getTranslations } from '~/i18n/translations'; +import { cn } from '~/lib/utils'; +import { clubs, db, studentAcademicDetails } from '~/server/db'; +import { countChildren } from '~/server/s3'; export async function generateStaticParams() { return await db.select({ display_name: clubs.urlName }).from(clubs); } -export default function Club({ - params: { locale }, +interface ClubEvent { + id: number; + title: string; + date: string; + image: [string]; + description: string; +} + +const events = [ + { + id: 0, + title: 'Event 1', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, + { + id: 1, + title: 'Event 2', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, + { + id: 2, + title: 'Event 3', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, + { + id: 3, + title: 'Event 4', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, + { + id: 4, + title: 'Event 5', + date: '2021-10-10', + image: [ + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + ], + description: 'This is the description of the event', + }, +] as ClubEvent[]; + +export default async function Club({ + params: { locale, display_name }, }: { params: { locale: string; display_name: string }; }) { - return ; + const club = await db.query.clubs.findFirst({ + where: eq(clubs.urlName, display_name), + with: { + clubMembers: true, + clubSocials: true, + // clubNotifications: true, + facultyIncharge1: true, + facultyIncharge2: true, + // facultyIncharge3: true, + }, + }); + + const detailed_members = await Promise.all( + club?.clubMembers.map(async (member) => { + const academicDetails = await db.query.studentAcademicDetails.findFirst({ + where: eq(studentAcademicDetails.id, member.studentId), + with: { + major: true, + student: { + with: { + person: { + columns: { + name: true, + }, + }, + }, + }, + }, + }); + return { ...member, academicDetails }; + }) ?? [] + ); + + const text = await getTranslations(locale); + const imageCount = await countChildren(`clubs/${display_name}/images`); + type SocialPlatform = + | 'instagram' + | 'twitter' + | 'mail' + | 'linkdin' + | 'facebook'; + + const socialIcons: Record = { + instagram: , + twitter: , + mail: , + linkdin: , + facebook: , + }; + + const facultyInchage = [ + { + image: + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + name: 'Awdesh Kumar', + title: 'HOD Computer Engineering', + email: 'awdesh@gmail.com', + phone: '1234567890', + }, + { + image: + 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/800px-Image_created_with_a_mobile_phone.png', + name: 'Awdesh Kumar', + title: 'HOD Computer Engineering', + email: 'awdesh@gmail.com', + phone: '1234567890', + }, + ]; + + const dummyNotifications = [ + { + content: 'Meeting scheduled for all club members at 5 PM.', + updatedAt: new Date('2024-09-01T14:30:00Z'), + }, + { + content: 'New event: Coding Marathon on 12th September. Register now!', + updatedAt: new Date('2024-09-02T10:15:00Z'), + }, + { + content: 'Reminder: Submit your project reports by Friday.', + updatedAt: new Date('2024-09-03T08:45:00Z'), + }, + { + content: "Club membership renewals are open. Don't forget to renew!", + updatedAt: new Date('2024-09-04T11:00:00Z'), + }, + { + content: 'Workshop on Android development scheduled for next week.', + updatedAt: new Date('2024-09-05T09:30:00Z'), + }, + ]; + + const dummyClubData = { + howToJoinUs: + 'To join our club, simply fill out the membership form available on our website or attend our weekly meetings held every Friday at 5 PM in the main auditorium.', + whyToJoinUs: + 'Joining our club gives you the opportunity to network with like-minded individuals, enhance your skills through various workshops, and participate in exciting events and competitions throughout the year.', + }; + + return ( + <> + +
+ {display_name} +

{display_name.toUpperCase()}

+
+
+ {/* about */} + +
+

+ {club?.aboutUs} +

+ {display_name} +
+ {/* why and how to join */} +
+
+
+

{text.club.howToJoinUs}

+

{dummyClubData?.howToJoinUs}

+
+ +
+

{text.club.whyToJoinUs}

+

{dummyClubData?.whyToJoinUs}

+
+
+ + {text.club.howToJoinUs} +
+ + {/* notifications */} + +
+ + + + Note + Date + + + + {/* {club?.clubNotifications.map((note, i) => ( */} + {dummyNotifications.map((note, i) => ( + + {note.content} + {note.updatedAt.toDateString()} + + ))} + +
+
+ + {/* Events */} + +
    + {events.map((event, i) => ( +
  • + + + +

    + {event.title} +

    +
    +
    + +
  • + ))} +
+ + {/* Faculty incharge */} + +
    + {facultyInchage.map((faculty, idx) => ( +
  • + {faculty.name} +
    + <> +

    + {faculty.name} +

    + {faculty.title} + +
    + + + {faculty.email} + + + + {faculty.phone} + +
    +
    +
  • + ))} +
+ + {/* post holders */} + +
    + {detailed_members.map((member, i) => ( +
  • + + + {member.academicDetails?.student.person.name + + +

    + {member.academicDetails?.student.person.name} +

    +
    + {member.position} +
    +

    + {member.academicDetails?.batch} +

    +
    +
    +
  • + ))} +
+ + {/* members */} + + + + + {text.club.rollNumber} + {text.club.name} + {text.club.batch} + {text.club.degree} + {text.club.major} + + + + {detailed_members.map((member, i) => ( + + + {member.academicDetails?.student.rollNumber} + + + {member.academicDetails?.student.person.name} + + {member.academicDetails?.batch} + {member.academicDetails?.major.degree} + {member.academicDetails?.major.name} + + ))} + +
+ + {/* gallery */} + {imageCount !== 0 && ( + + )} + + {/* socials */} +
    + {club?.clubSocials.map((social, i) => ( +
  • + + {socialIcons[social.platform as SocialPlatform]} + +
  • + ))} +
+
+ + ); } diff --git a/components/carousels/gallery.tsx b/components/carousels/gallery.tsx index f594fc68..89ccf416 100644 --- a/components/carousels/gallery.tsx +++ b/components/carousels/gallery.tsx @@ -12,7 +12,7 @@ const GalleryCarousel = ({ carouselProps, children, className, - itemClassName, + itemClassName = 'sm:basis-1/2 lg:basis-1/3 xl:basis-1/4 2xl:basis-1/5', }: { carouselProps?: CarouselProps; children: React.ReactNode[]; @@ -31,13 +31,7 @@ const GalleryCarousel = ({ > {children.map((child, index) => ( - + {child} ))} diff --git a/i18n/en.ts b/i18n/en.ts index 481e525d..120a2340 100644 --- a/i18n/en.ts +++ b/i18n/en.ts @@ -20,7 +20,22 @@ const text: Translations = { more: 'Read more', }, }, - + club: { + about: 'About', + batch: 'Batch', + degree: 'Degree', + event: 'Event', + faculty: 'Faculty Incharge', + gallery: 'Gallery', + howToJoinUs: 'How to Join Us', + major: 'Major', + name: 'Name', + notification: 'Notification', + ourMembers: 'Our Members', + postHolders: 'Post Holders', + rollNumber: 'Roll Number', + whyToJoinUs: 'Why to Join Us', + }, Clubs: { title: 'CLUBS' }, Committee: { building: 'BUILDING & WORK COMMITTEE', diff --git a/i18n/hi.ts b/i18n/hi.ts index 8af092bd..8514acd1 100644 --- a/i18n/hi.ts +++ b/i18n/hi.ts @@ -16,7 +16,22 @@ const text: Translations = { more: 'और पढ़ें', }, }, - + club: { + about: 'परिचय', + batch: 'बैच', + degree: 'डिग्री', + event: 'आयोजन', + faculty: 'संकाय', + gallery: 'गैलरी', + howToJoinUs: 'हमारे साथ कैसे जुड़ें', + major: 'मेजर', + name: 'नाम', + notification: 'सूचना', + ourMembers: 'हमारे सदस्य', + postHolders: 'पदाधिकारी', + rollNumber: 'रोल नंबर', + whyToJoinUs: 'हमारे साथ क्यों जुड़ें', + }, Clubs: { title: 'संघठनें' }, Committee: { building: 'निर्माण एवं कार्य समिति', diff --git a/i18n/translations.ts b/i18n/translations.ts index 43127a89..57fe6467 100644 --- a/i18n/translations.ts +++ b/i18n/translations.ts @@ -12,7 +12,22 @@ export interface Translations { more: string; }; }; - + club: { + about: string; + batch: string; + degree: string; + event: string; + faculty: string; + gallery: string; + howToJoinUs: string; + ourMembers: string; + major: string; + name: string; + notification: string; + postHolders: string; + rollNumber: string; + whyToJoinUs: string; + }; Clubs: { title: string }; Committee: { building: string; diff --git a/server/db/schema/clubs.schema.ts b/server/db/schema/clubs.schema.ts index 910b4eb7..1fed4bac 100644 --- a/server/db/schema/clubs.schema.ts +++ b/server/db/schema/clubs.schema.ts @@ -10,7 +10,15 @@ import { varchar, } from 'drizzle-orm/pg-core'; -import { clubMembers, clubSocials, departments, faculty, persons } from '.'; +import { + clubMembers, + clubSocials, + departments, + events, + faculty, + notifications, + persons, +} from '.'; export const clubs = pgTable('clubs', { id: smallserial('id').primaryKey(), @@ -20,6 +28,8 @@ export const clubs = pgTable('clubs', { tagline: varchar('tagline', { length: 256 }).notNull(), email: varchar('email', { length: 256 }).notNull(), aboutUs: varchar('about_us').notNull(), + // howToJoinUs: varchar('how_to_join_us').notNull(), + // whyToJoinUs: varchar('why_to_join_us').notNull(), category: varchar('category', { enum: ['committee', 'cultural', 'crew', 'technical'], }).notNull(), @@ -30,6 +40,9 @@ export const clubs = pgTable('clubs', { facultyInchargeId2: integer('faculty_incharge_id2').references( () => faculty.id ), + // facultyInchargeId3: integer('faculty_incharge_id3').references( + // () => faculty.id + // ), isActive: boolean('is_active').default(true).notNull(), createdOn: date('created_on', { mode: 'date' }).defaultNow().notNull(), updatedAt: timestamp('updated_at') @@ -41,6 +54,7 @@ export const clubs = pgTable('clubs', { }); export const clubsRelations = relations(clubs, ({ many, one }) => ({ + clubEvents: many(events), clubMembers: many(clubMembers), clubSocials: many(clubSocials), department: one(departments, { @@ -57,4 +71,10 @@ export const clubsRelations = relations(clubs, ({ many, one }) => ({ fields: [clubs.facultyInchargeId2], references: [faculty.id], }), + // facultyIncharge3: one(faculty, { + // relationName: 'facultyIncharge3', + // fields: [clubs.facultyInchargeId3], + // references: [faculty.id], + // }), + // clubNotifications: many(notifications), })); diff --git a/server/db/schema/events.ts b/server/db/schema/events.ts new file mode 100644 index 00000000..7e619e8c --- /dev/null +++ b/server/db/schema/events.ts @@ -0,0 +1,32 @@ +import { relations } from 'drizzle-orm'; +import { + integer, + pgTable, + serial, + timestamp, + varchar, +} from 'drizzle-orm/pg-core'; + +import { clubs, persons } from '.'; + +export const events = pgTable('events', { + id: serial('id').primaryKey(), + name: varchar('name', { length: 128 }).notNull(), + description: varchar('description'), + startDate: timestamp('date').notNull(), + endDate: timestamp('date').notNull(), + clubId: integer('club_id').references(() => clubs.id), + updatedAt: timestamp('updated_at') + .$onUpdate(() => new Date()) + .notNull(), + updatedBy: integer('updated_by') + .references(() => persons.id) + .notNull(), +}); + +export const eventsRelations = relations(events, ({ one }) => ({ + club: one(clubs, { + fields: [events.clubId], + references: [clubs.id], + }), +})); diff --git a/server/db/schema/index.ts b/server/db/schema/index.ts index 3124a222..d8f2e819 100644 --- a/server/db/schema/index.ts +++ b/server/db/schema/index.ts @@ -9,6 +9,7 @@ export * from './deans.schema'; export * from './department-heads.schema'; export * from './departments.schema'; export * from './doctorates.schema'; +export * from './events'; export * from './faculty.schema'; export * from './faq.schema'; export * from './majors.schema'; diff --git a/server/db/schema/notifications.schema.ts b/server/db/schema/notifications.schema.ts index 2e27b0be..9292a062 100644 --- a/server/db/schema/notifications.schema.ts +++ b/server/db/schema/notifications.schema.ts @@ -1,4 +1,5 @@ import { + integer, pgTable, serial, text, @@ -7,6 +8,8 @@ import { varchar, } from 'drizzle-orm/pg-core'; +import { clubs } from '.'; + export const notifications = pgTable( 'notifications', { @@ -20,6 +23,7 @@ export const notifications = pgTable( updatedAt: timestamp('updated_at') .$onUpdate(() => new Date()) .notNull(), + // clubId: integer('club_id').references(() => clubs.id), }, (notifications) => { return {