From 15cd30e639631aec9ce1d0bdd3d8ed5ffbe22062 Mon Sep 17 00:00:00 2001 From: KambojRajan Date: Tue, 20 Aug 2024 16:57:10 +0530 Subject: [PATCH 1/4] fix club name --- .../clubs/[display_name]/page.tsx | 223 +++++++++++++++++- i18n/en.ts | 13 +- i18n/hi.ts | 13 +- i18n/translations.ts | 13 +- 4 files changed, 254 insertions(+), 8 deletions(-) diff --git a/app/[locale]/student-activities/clubs/[display_name]/page.tsx b/app/[locale]/student-activities/clubs/[display_name]/page.tsx index caf37afb..b0cb8cb2 100644 --- a/app/[locale]/student-activities/clubs/[display_name]/page.tsx +++ b/app/[locale]/student-activities/clubs/[display_name]/page.tsx @@ -1,14 +1,227 @@ -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 { MdMailOutline } 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 }, +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, + facultyIncharge1: true, + facultyIncharge2: 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: , + }; + + return ( + <> + +
+ {display_name} +

{display_name.toUpperCase()}

+
+
+ +
+

+ {club?.aboutUs} +

+ {display_name} +
+ +
    + {detailed_members.map((member, i) => ( +
  • + + + {member.academicDetails?.student.person.name + + +

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

    +
    + {member.position} +
    +

    + {member.academicDetails?.batch} +

    +
    +
    +
  • + ))} +
+ + + + + {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} + + ))} + +
+ {imageCount !== 0 && ( + + )} + +
    + {club?.clubSocials.map((social, i) => ( +
  • + + {socialIcons[social.platform as SocialPlatform]} + +
  • + ))} +
+
+ + ); } diff --git a/i18n/en.ts b/i18n/en.ts index 481e525d..8c6c08e0 100644 --- a/i18n/en.ts +++ b/i18n/en.ts @@ -20,7 +20,18 @@ const text: Translations = { more: 'Read more', }, }, - + club: { + about: 'About', + ourmMembers: 'Our Members', + postHolders: 'Post Holders', + gallery: 'Gallery', + contacts: 'Contacts us', + rollNumber: 'Roll Number', + name: 'Name', + batch: 'Batch', + degree: 'Degree', + major: 'Major', + }, Clubs: { title: 'CLUBS' }, Committee: { building: 'BUILDING & WORK COMMITTEE', diff --git a/i18n/hi.ts b/i18n/hi.ts index 8af092bd..11dca698 100644 --- a/i18n/hi.ts +++ b/i18n/hi.ts @@ -16,7 +16,18 @@ const text: Translations = { more: 'और पढ़ें', }, }, - + club: { + about: 'परिचय', + ourmMembers: 'हमारे सदस्य', + postHolders: 'पदाधिकारी', + gallery: 'गैलरी', + contacts: 'संपर्क', + rollNumber: 'रोल नंबर', + name: 'नाम', + batch: 'बैच', + degree: 'डिग्री', + major: 'मेजर', + }, Clubs: { title: 'संघठनें' }, Committee: { building: 'निर्माण एवं कार्य समिति', diff --git a/i18n/translations.ts b/i18n/translations.ts index 43127a89..19eb241f 100644 --- a/i18n/translations.ts +++ b/i18n/translations.ts @@ -12,7 +12,18 @@ export interface Translations { more: string; }; }; - + club: { + about: string; + ourmMembers: string; + postHolders: string; + gallery: string; + contacts: string; + rollNumber: string; + name: string; + batch: string; + degree: string; + major: string; + }; Clubs: { title: string }; Committee: { building: string; From faf63a397246256a23e53383f7d01881cc7f1484 Mon Sep 17 00:00:00 2001 From: KambojRajan Date: Tue, 3 Sep 2024 21:52:26 +0530 Subject: [PATCH 2/4] redesign: page design change --- .../clubs/[dispaly_name]/event/page.tsx | 73 ++++++ app/[locale]/academics/page.tsx | 2 +- .../clubs/[display_name]/event/page.tsx | 9 + .../clubs/[display_name]/page.tsx | 216 +++++++++++++++++- components/carousels/gallery.tsx | 10 +- i18n/en.ts | 16 +- i18n/hi.ts | 16 +- i18n/translations.ts | 16 +- server/db/schema/clubs.schema.ts | 22 +- server/db/schema/events.ts | 32 +++ server/db/schema/index.ts | 1 + server/db/schema/notifications.schema.ts | 4 + 12 files changed, 381 insertions(+), 36 deletions(-) create mode 100644 app/[locale]/@modals/(.)student-activities/clubs/[dispaly_name]/event/page.tsx create mode 100644 app/[locale]/student-activities/clubs/[display_name]/event/page.tsx create mode 100644 server/db/schema/events.ts 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..61a63d9e --- /dev/null +++ b/app/[locale]/@modals/(.)student-activities/clubs/[dispaly_name]/event/page.tsx @@ -0,0 +1,73 @@ +import Image from 'next/image'; + +import { GalleryCarousel } from '~/components/carousels'; +import { Dialog } from '~/components/dialog'; + +interface ClubEvent { + title: string; + date: string; + image: [string]; + description: string; +} + +export default function EventPage({ + searchParams, +}: { + params: { locale: string }; + searchParams: { club_event: string }; +}) { + const clubEvent = JSON.parse(searchParams.club_event) as ClubEvent; + 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..8e3b850b --- /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}/events`); +} diff --git a/app/[locale]/student-activities/clubs/[display_name]/page.tsx b/app/[locale]/student-activities/clubs/[display_name]/page.tsx index b0cb8cb2..b31764be 100644 --- a/app/[locale]/student-activities/clubs/[display_name]/page.tsx +++ b/app/[locale]/student-activities/clubs/[display_name]/page.tsx @@ -4,7 +4,7 @@ import Link from 'next/link'; import type { ReactNode } from 'react'; import { FaInstagram, FaLinkedinIn } from 'react-icons/fa'; import { FaXTwitter } from 'react-icons/fa6'; -import { MdMailOutline } from 'react-icons/md'; +import { MdEmail, MdMailOutline, MdOutlineLocalPhone } from 'react-icons/md'; import { LuFacebook } from 'react-icons/lu'; import { GalleryCarousel } from '~/components/carousels'; @@ -40,8 +40,10 @@ export default async function Club({ with: { clubMembers: true, clubSocials: true, + clubNotifications: true, facultyIncharge1: true, facultyIncharge2: true, + facultyIncharge3: true, }, }); @@ -83,6 +85,68 @@ export default async function Club({ facebook: , }; + const events = [ + { + 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', + }, + { + 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', + }, + { + 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', + }, + { + 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', + }, + { + 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', + }, + ]; + + 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', + }, + ]; + return ( <> @@ -97,6 +161,7 @@ export default async function Club({

{display_name.toUpperCase()}

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

{club?.howToJoinUs}

+ + +

{club?.whyToJoinUs}

+
+ + {text.club.howToJoinUs} +
+ + {/* notifications */} + +
+ + + + Note + Date + + + + {club?.clubNotifications.map((note, i) => ( + + {note.content} + {note.updatedAt.toISOString()} + + ))} + +
+
+ + {/* 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 */} ))} + + {/* members */} @@ -183,6 +384,8 @@ export default async function Club({ ))}
+ + {/* gallery */} {imageCount !== 0 && ( )} - + + {/* socials */}
    {club?.clubSocials.map((social, i) => (
  • {children.map((child, index) => ( - + {child} ))} diff --git a/i18n/en.ts b/i18n/en.ts index 8c6c08e0..120a2340 100644 --- a/i18n/en.ts +++ b/i18n/en.ts @@ -22,15 +22,19 @@ const text: Translations = { }, club: { about: 'About', - ourmMembers: 'Our Members', - postHolders: 'Post Holders', - gallery: 'Gallery', - contacts: 'Contacts us', - rollNumber: 'Roll Number', - name: 'Name', 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: { diff --git a/i18n/hi.ts b/i18n/hi.ts index 11dca698..8514acd1 100644 --- a/i18n/hi.ts +++ b/i18n/hi.ts @@ -18,15 +18,19 @@ const text: Translations = { }, club: { about: 'परिचय', - ourmMembers: 'हमारे सदस्य', - postHolders: 'पदाधिकारी', - gallery: 'गैलरी', - contacts: 'संपर्क', - rollNumber: 'रोल नंबर', - name: 'नाम', batch: 'बैच', degree: 'डिग्री', + event: 'आयोजन', + faculty: 'संकाय', + gallery: 'गैलरी', + howToJoinUs: 'हमारे साथ कैसे जुड़ें', major: 'मेजर', + name: 'नाम', + notification: 'सूचना', + ourMembers: 'हमारे सदस्य', + postHolders: 'पदाधिकारी', + rollNumber: 'रोल नंबर', + whyToJoinUs: 'हमारे साथ क्यों जुड़ें', }, Clubs: { title: 'संघठनें' }, Committee: { diff --git a/i18n/translations.ts b/i18n/translations.ts index 19eb241f..57fe6467 100644 --- a/i18n/translations.ts +++ b/i18n/translations.ts @@ -14,15 +14,19 @@ export interface Translations { }; club: { about: string; - ourmMembers: string; - postHolders: string; - gallery: string; - contacts: string; - rollNumber: string; - name: 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: { diff --git a/server/db/schema/clubs.schema.ts b/server/db/schema/clubs.schema.ts index 910b4eb7..c88e3f65 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..537b1b66 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 { From a0c614b65a6eb7fbb60dab8738db60044282c297 Mon Sep 17 00:00:00 2001 From: KambojRajan Date: Tue, 3 Sep 2024 23:19:14 +0530 Subject: [PATCH 3/4] med --- .../clubs/[display_name]/page.tsx | 53 +++++++++++++++---- server/db/schema/clubs.schema.ts | 22 ++++---- server/db/schema/notifications.schema.ts | 2 +- 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/app/[locale]/student-activities/clubs/[display_name]/page.tsx b/app/[locale]/student-activities/clubs/[display_name]/page.tsx index b31764be..ed9f18f8 100644 --- a/app/[locale]/student-activities/clubs/[display_name]/page.tsx +++ b/app/[locale]/student-activities/clubs/[display_name]/page.tsx @@ -40,10 +40,10 @@ export default async function Club({ with: { clubMembers: true, clubSocials: true, - clubNotifications: true, + // clubNotifications: true, facultyIncharge1: true, facultyIncharge2: true, - facultyIncharge3: true, + // facultyIncharge3: true, }, }); @@ -147,6 +147,36 @@ export default async function Club({ }, ]; + 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 ( <> @@ -199,7 +229,7 @@ export default async function Club({ heading="h3" text={text.club.howToJoinUs.toUpperCase()} /> -

    {club?.howToJoinUs}

    +

    {dummyClubData?.howToJoinUs}

    -

    {club?.whyToJoinUs}

    +

    {dummyClubData?.whyToJoinUs}

    {text.club.howToJoinUs} @@ -236,10 +266,11 @@ export default async function Club({ - {club?.clubNotifications.map((note, i) => ( + {/* {club?.clubNotifications.map((note, i) => ( */} + {dummyNotifications.map((note, i) => ( {note.content} - {note.updatedAt.toISOString()} + {note.updatedAt.toDateString()} ))} @@ -282,11 +313,11 @@ export default async function Club({ heading="h2" text={text.club.faculty.toUpperCase()} /> -
      +
        {facultyInchage.map((faculty, idx) => (
      • <> -

        +

        {faculty.name}

        {faculty.title} @@ -409,7 +440,7 @@ export default async function Club({ )} {/* socials */} -
          +
            {club?.clubSocials.map((social, i) => (
          • faculty.id ), - facultyInchargeId3: integer('faculty_incharge_id3').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') @@ -71,10 +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), + // facultyIncharge3: one(faculty, { + // relationName: 'facultyIncharge3', + // fields: [clubs.facultyInchargeId3], + // references: [faculty.id], + // }), + // clubNotifications: many(notifications), })); diff --git a/server/db/schema/notifications.schema.ts b/server/db/schema/notifications.schema.ts index 537b1b66..9292a062 100644 --- a/server/db/schema/notifications.schema.ts +++ b/server/db/schema/notifications.schema.ts @@ -23,7 +23,7 @@ export const notifications = pgTable( updatedAt: timestamp('updated_at') .$onUpdate(() => new Date()) .notNull(), - clubId: integer('club_id').references(() => clubs.id), + // clubId: integer('club_id').references(() => clubs.id), }, (notifications) => { return { From e03852c962e77336af5496b49ff0d2be094a533c Mon Sep 17 00:00:00 2001 From: KambojRajan Date: Wed, 4 Sep 2024 19:22:36 +0530 Subject: [PATCH 4/4] fix: minor ui fix and scroll fix --- .../clubs/[dispaly_name]/event/page.tsx | 52 +++++- .../clubs/[display_name]/event/page.tsx | 2 +- .../clubs/[display_name]/page.tsx | 157 +++++++++--------- 3 files changed, 134 insertions(+), 77 deletions(-) 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 index 61a63d9e..40fe5061 100644 --- a/app/[locale]/@modals/(.)student-activities/clubs/[dispaly_name]/event/page.tsx +++ b/app/[locale]/@modals/(.)student-activities/clubs/[dispaly_name]/event/page.tsx @@ -4,6 +4,7 @@ import { GalleryCarousel } from '~/components/carousels'; import { Dialog } from '~/components/dialog'; interface ClubEvent { + id: number; title: string; date: string; image: [string]; @@ -16,7 +17,56 @@ export default function EventPage({ params: { locale: string }; searchParams: { club_event: string }; }) { - const clubEvent = JSON.parse(searchParams.club_event) as ClubEvent; + 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 ( diff --git a/app/[locale]/student-activities/clubs/[display_name]/event/page.tsx b/app/[locale]/student-activities/clubs/[display_name]/event/page.tsx index 8e3b850b..b959ba15 100644 --- a/app/[locale]/student-activities/clubs/[display_name]/event/page.tsx +++ b/app/[locale]/student-activities/clubs/[display_name]/event/page.tsx @@ -5,5 +5,5 @@ export default function Event({ }: { params: { locale: string; display_name: string }; }) { - redirect(`/${locale}/student-activities/clubs/${display_name}/events`); + 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 ed9f18f8..31cf549b 100644 --- a/app/[locale]/student-activities/clubs/[display_name]/page.tsx +++ b/app/[locale]/student-activities/clubs/[display_name]/page.tsx @@ -30,6 +30,62 @@ export async function generateStaticParams() { return await db.select({ display_name: clubs.urlName }).from(clubs); } +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 }, }: { @@ -85,49 +141,6 @@ export default async function Club({ facebook: , }; - const events = [ - { - 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', - }, - { - 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', - }, - { - 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', - }, - { - 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', - }, - { - 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', - }, - ]; - const facultyInchage = [ { image: @@ -179,7 +192,10 @@ export default async function Club({ return ( <> - +
            {display_name} -
            +

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

            -
            - -

            {dummyClubData?.howToJoinUs}

            +
            +
            +

            {text.club.howToJoinUs}

            +

            {dummyClubData?.howToJoinUs}

            +
            - -

            {dummyClubData?.whyToJoinUs}

            -
            +
            +

            {text.club.whyToJoinUs}

            +

            {dummyClubData?.whyToJoinUs}

            +
            +
            {text.club.howToJoinUs} -
            +
            @@ -287,9 +293,10 @@ export default async function Club({ {events.map((event, i) => (
          • @@ -313,7 +320,7 @@ export default async function Club({ heading="h2" text={text.club.faculty.toUpperCase()} /> -
              +
                {facultyInchage.map((faculty, idx) => (
              • <> -

                +

                {faculty.name}

                {faculty.title} @@ -418,7 +425,7 @@ export default async function Club({ {/* gallery */} {imageCount !== 0 && ( -