Skip to content

Commit

Permalink
Merge pull request #209 from tasc-nmamit/migration
Browse files Browse the repository at this point in the history
Merge After Admin Dashboard
  • Loading branch information
pratham-ak2004 authored Oct 2, 2024
2 parents fea73bb + 420bcbe commit f7842c1
Show file tree
Hide file tree
Showing 78 changed files with 2,698 additions and 2,020 deletions.
Binary file removed bun.lockb
Binary file not shown.
787 changes: 195 additions & 592 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,25 @@
"bits-ui": "^0.5.7",
"caniuse-lite": "^1.0.30001655",
"clsx": "^2.0.0",
"cmdk-sv": "^0.0.18",
"downloadjs": "^1.4.7",
"firebase": "^10.4.0",
"formsnap": "^1.0.1",
"googleapis": "^128.0.0",
"gsap": "^3.12.5",
"html-to-image": "^1.11.11",
"html5-qrcode": "^2.3.8",
"iconify-icon": "^1.0.8",
"lucide-svelte": "^0.284.0",
"marked": "^14.1.2",
"qrcode": "^1.5.4",
"svelte-copy": "^1.4.1",
"svelte-markdown": "^0.4.1",
"svelte-qrcode-image": "^1.0.0-rc.2",
"svelte-qrcode-image": "2.0.0-alpha.1",
"sveltekit-superforms": "^2.18.0",
"tailwind-merge": "^1.14.0",
"tailwind-variants": "^0.1.18"
"tailwind-variants": "^0.1.18",
"xlsx": "^0.18.5",
"zod": "^3.23.8"
},
"prisma": {
"seed": "vite-node ./prisma/seed.ts"
Expand Down
114 changes: 83 additions & 31 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init

generator client {
provider = "prisma-client-js"
}
Expand Down Expand Up @@ -33,14 +27,16 @@ model User {
usn String?
lightTheme String?
darkTheme String?
role Role @default(USER)
role Role @default(USER)
links Links?
organizers Event[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Core Core[]
Team Team[] @relation("UserTeam")
Core Core[]
Student Student[]
Team Team[] @relation("UserTeam")
}

model Account {
Expand Down Expand Up @@ -74,6 +70,16 @@ model Session {
updatedAt DateTime @updatedAt
}

model Student {
id String @id @default(cuid())
name User @relation(fields: [userId], references: [id])
userId String @unique
image String
placement Placement?
patents Patents[] @relation("StudentPatents")
}

model Core {
id String @id @default(cuid())
year String
Expand All @@ -87,13 +93,15 @@ model Core {
}

model Faculty {
id String @id @default(cuid())
id String @id @default(cuid())
name String
email String
designation String
designation2 String?
image String
about String[]
patents Patents[] @relation("FacultyPatents")
publications Publication[] @relation("FacultyPublications")
order Int @unique
Expand All @@ -107,20 +115,25 @@ model Event {
title String
description String?
brief String?
image String
date DateTime
time String?
reportLink String?
venue String?
qr String?
entryFee Int?
category EventCategory
minTeamSize Int @default(1)
maxTeamSize Int @default(1)
minTeamSize Int @default(1)
maxTeamSize Int @default(1)
type EventType
participants Team[]
winners Winners[]
organizers User[]
guests String[]
published Boolean @default(false)
published Boolean @default(false)
registrationsAvailable Boolean @default(true)
}

model Links {
Expand All @@ -140,49 +153,81 @@ model Links {
model Team {
id String @id @default(cuid())
name String?
user User[] @relation("UserTeam")
event Event @relation(fields: [eventId], references: [id])
winner Winners?
attended Boolean @default(false)
eventId String
name String?
leaderId String?
transactionId String?
user User[] @relation("UserTeam")
event Event @relation(fields: [eventId], references: [id])
winner Winners?
attended Boolean @default(false)
eventId String
isConfirmed Boolean @default(false)
}

model Winners {
id String @id @default(cuid())
position Int
teamId String @unique
eventId String
position WinnerType
teamId String @unique
eventId String
event Event @relation(fields: [eventId], references: [id])
team Team @relation(fields: [teamId], references: [id])
}
model Student {

model Placement {
id String @id @default(cuid())
offers Offer[]
year Year @relation("PlacementYear", fields: [yearId], references: [id])
yearId String
student Student @relation(fields: [studentId], references: [id])
studentId String @unique
}

model Company {
id String @id @default(cuid())
companyName String
offers Offer[]
}

model Offer {
id String @id @default(cuid())
name String
image String
patents Patents[] @relation("StudentPatents")
placements Placement[]
company Company @relation(fields: [companyId], references: [id])
companyId String
package String
}

model Year {
id String @id @default(cuid())
year String
companies String[]
placements Placement[] @relation("PlacementYear")
}

model Patents {
id String @id @default(cuid())
patentId String
year String
faculty Faculty[] @relation("FacultyPatents")
faculty Faculty[] @relation("FacultyPatents")
title String
authors String[]
student Student[] @relation("StudentPatents")
student Student[] @relation("StudentPatents")
inventorsName String[]
inventorsAddress String[]
certificate String?
}

model Publication {
id String @id @default(cuid())
id String @id @default(cuid())
authors String[]
title String
publish_date String
Expand Down Expand Up @@ -212,4 +257,11 @@ enum EventCategory {
PREVIOUS
UPCOMING
CURRENT
}
}

enum WinnerType {
FIRST
SECOND
THIRD
PARTICIPATION
}
105 changes: 55 additions & 50 deletions src/lib/components/Card/PlacementCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,64 @@
import type { PlacementOffer } from '$lib/components/types/AchievementData';
import { NAME_TO_IMAGE as images } from '$lib/data/Images';
export let companies: Record<string, string[]>;
export let offers: Record<string, PlacementOffer[]>;
export let offers: Record<string, any[]>;
export let companyNames: string[];
onMount(() => {
const containers = document.querySelectorAll('.carousel-container');
containers.forEach((container) => {
const inner = container.querySelector('.carousel-inner');
if (!inner) return;
const items = Array.from(inner.children) as HTMLElement[];
const totalItems = items.length;
// Get the current screen size
const isSmallScreen = window.innerWidth < 640;
// Disable animation if there are less than or equal to required items
if ((isSmallScreen && totalItems === 1) || (!isSmallScreen && totalItems <= 2)) return;
// Duplicate items for seamless looping
for (let i = 0; i < totalItems; i++) {
const clone = items[i].cloneNode(true) as HTMLElement;
inner.appendChild(clone);
}
// Recalculate the total items after duplication
const totalDuplicatedItems = inner.children.length;
const tl = gsap.timeline({ repeat: -1, paused: true });
tl.to(inner, {
duration: totalDuplicatedItems * 4, // Adjust duration based on the number of duplicated items
xPercent: -100 * totalDuplicatedItems / 2,
ease: 'none',
modifiers: {
xPercent: gsap.utils.unitize(value => {
return parseFloat(value) % (100 * totalDuplicatedItems / 2);
})
}
});
// Ensure that the code only runs in the browser
if (typeof window !== 'undefined') {
const containers = document.querySelectorAll('.carousel-container');
containers.forEach((container) => {
const inner = container.querySelector('.carousel-inner');
if (!inner) return;
tl.play();
const items = Array.from(inner.children) as HTMLElement[];
const totalItems = items.length;
container.addEventListener('mouseenter', () => {
tl.pause();
});
// Get the current screen size
const isSmallScreen = window.innerWidth < 640;
container.addEventListener('mouseleave', () => {
tl.resume();
// Disable animation if there are less than or equal to required items
if ((isSmallScreen && totalItems === 1) || (!isSmallScreen && totalItems <= 2)) return;
// Duplicate items for seamless looping
for (let i = 0; i < totalItems; i++) {
const clone = items[i].cloneNode(true) as HTMLElement;
inner.appendChild(clone);
}
// Recalculate the total items after duplication
const totalDuplicatedItems = inner.children.length;
const tl = gsap.timeline({ repeat: -1, paused: true });
tl.to(inner, {
duration: totalDuplicatedItems * 4, // Adjust duration based on the number of duplicated items
xPercent: -100 * totalDuplicatedItems / 2,
ease: 'none',
modifiers: {
xPercent: gsap.utils.unitize(value => {
return parseFloat(value) % (100 * totalDuplicatedItems / 2);
})
}
});
tl.play();
container.addEventListener('mouseenter', () => {
tl.pause();
});
container.addEventListener('mouseleave', () => {
tl.resume();
});
});
});
}
});
onDestroy(() => {
const containers = document.querySelectorAll('.carousel-container');
onDestroy(() => {
if (typeof window !== 'undefined') {
const containers = document.querySelectorAll('.carousel-container');
containers.forEach((container) => {
const inner = container.querySelector('.carousel-inner');
if (!inner) return;
Expand All @@ -69,9 +72,11 @@
if (totalItems > 2)
gsap.killTweensOf(inner);
});
});
}
});
</script>


<style>
.carousel-container {
overflow: hidden;
Expand Down Expand Up @@ -102,16 +107,16 @@
</div>
<div class="col-span-3 carousel-container rounded-lg grid justify-around sm:justify-normal">
<div class="carousel-inner self-center">
{#each companies[company] as student}
{#each offers[company] as student}
<div class="carousel-item grid">
<div class="bg-card w-[95%] sm:h-full h-[90%] self-center object-contain sm:border-2 border border-[#d2b863] md:rounded-[17px] sm:rounded-[13px] rounded-[8px] grid grid-cols-5">
<div class="col-span-2 w-full h-full sm:aspect-[7/9] aspect-square relative">
<img src="/user1.png" alt="" class=" object-fill sm:h-full h-[89.5%] w-full md:rounded-l-[15px] sm:rounded-l-[11px] rounded-l-[7px]">
<div class="absolute inset-0 sm:ml-[75%] ml-[50%] sm:h-full h-[89.5%] bg-gradient-to-r from-transparent to-card"></div>
</div>
<div class="flex flex-col col-span-3 justify-around sm:h-full h-[90%]">
<p class="lg:text-xl md:text-lg sm:text-md text-sm text-center md:font-bold sm:font-semibold">{student}</p>
<p class="lg:text-xl md:text-lg sm:text-md text-sm text-center md:font-bold sm:font-semibold">{offers[student].find(c => c.company === company)?.package || ''}</p>
<p class="lg:text-xl md:text-lg sm:text-md text-sm text-center md:font-bold sm:font-semibold">{student.studentName}</p>
<p class="lg:text-xl md:text-lg sm:text-md text-sm text-center md:font-bold sm:font-semibold">{student.studentPackage}</p>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit f7842c1

Please sign in to comment.