Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Nalin-Angrish committed Jul 1, 2024
2 parents 26f504e + dc67f8e commit 2782dcc
Show file tree
Hide file tree
Showing 87 changed files with 3,279 additions and 497 deletions.
1,067 changes: 1,035 additions & 32 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,32 @@
"lint": "next lint"
},
"dependencies": {
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-slot": "^1.1.0",
"@tabler/icons": "^3.5.0",
"@tabler/icons-react": "^3.5.0",
"@uploadthing/react": "^6.6.0",
"carousel": "^0.0.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"embla-carousel-react": "^8.1.5",
"framer-motion": "^11.2.11",
"html-react-parser": "^5.1.10",
"lucide-react": "^0.379.0",
"mongoose": "^8.4.0",
"next": "^14.2.3",
"next-auth": "^5.0.0-beta.18",
"react": "^18",
"react-day-picker": "^8.10.1",
"react-dom": "^18",
"react-hook-form": "^7.51.5",
"react-icons": "^5.2.1",
"react-quill": "^2.0.0",
"react-router-dom": "^6.23.1",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
Expand Down
File renamed without changes
Binary file added public/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/TeamImages/Insta Profile.jpg
Binary file not shown.
Binary file added public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions public/home/Globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/home/person.jpeg
Binary file not shown.
10 changes: 0 additions & 10 deletions src/app/[clubid]/page.jsx

This file was deleted.

21 changes: 21 additions & 0 deletions src/app/[clubname]/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +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 OurSchedule from "@/components/ClubPageComponents/OurSchedule";

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

export default page;
11 changes: 5 additions & 6 deletions src/app/actions/AchievementActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { z } from "zod";
import connectMongoDB from "@/lib/db";
import getAchievementModel from "@/models/achievement";
import Achievement from "@/models/achievement";
import { redirect } from "next/navigation";
import { auth } from "@/auth";
import { revalidatePath } from "next/cache";
Expand Down Expand Up @@ -32,12 +32,12 @@ export async function addAchievement(prevState, formData) {

// Extract validated data
const { title, description } = validatedFields.data;
console.log("ye rha title ,desc", title, description);


// Insert data into the database
try {
await connectMongoDB();
const Achievement = getAchievementModel(); // Get the achievement model

const achievement = await Achievement.findOne({ club });

if (achievement) {
Expand All @@ -51,7 +51,6 @@ export async function addAchievement(prevState, formData) {
}
} catch (error) {
// If a database error occurs, return a more specific error.
console.log("error", error);
return {
message: "Database Error: Failed to add achievement.",
};
Expand Down Expand Up @@ -92,7 +91,7 @@ export async function updateAchievement(prevState, formData) {
await connectMongoDB(); // Connect to the database

// Find the achievement for the specified club
const Achievement = getAchievementModel(); // Get the achievement model

const achievement = await Achievement.findOne({ club });

if (!achievement) {
Expand Down Expand Up @@ -139,7 +138,7 @@ export async function deleteAchievementById(id) {
// Connect to the database
try {
await connectMongoDB();
const Achievement = getAchievementModel(); // Get the achievement model


const achievement = await Achievement.findOne({ club });

Expand Down
7 changes: 4 additions & 3 deletions src/app/actions/AchievementData.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import getAchievementModel from "@/models/achievement";
import Achievement from "@/models/achievement";
import connectMongoDB from "@/lib/db";
import { unstable_noStore as noStore } from "next/cache";

export async function getAllAchievements(club) {
noStore(); // Ensure no caching is done

try {
await connectMongoDB(); // Connect to the database
const Achievement = getAchievementModel(); // Get the achievement model

const achievement = await Achievement.findOne({ club }); // Find the achievement for the specified club
if (!achievement) return []; // If no achievement found, return an empty array

Expand All @@ -28,7 +29,7 @@ export async function getAchievementById(club, achievementId) {
try {
await connectMongoDB(); // Connect to the database

const Achievement = getAchievementModel(); // Get the achievement model

const achievement = await Achievement.findOne({ club });

if (!achievement) {
Expand Down
16 changes: 8 additions & 8 deletions src/app/actions/BlogActions.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"use server";
import { z } from "zod";
import connectMongoDB from "@/lib/db";
import getBlogModel from "@/models/blog";
import Blog from "@/models/blog";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
import { auth } from "@/auth";

const FormSchema = z.object({
title: z.string().min(1, "Title is required."),
brief: z.string().min(1, "Brief is required.").max(100,"Brief is too Long, keep it below 100 characters"),
content: z.string().min(1, "Content is required."),
author: z.string().min(1, "Author is required."),
club: z.string().min(1, "Club is required."),
Expand All @@ -19,6 +20,7 @@ export async function createBlog(prevState, formData) {
// Validate form using Zod
const validatedFields = FormSchema.safeParse({
title: formData.get("title"),
brief: formData.get("brief"),
content: formData.get("content"),
author: formData.get("author"),
club: _club,
Expand All @@ -34,13 +36,12 @@ export async function createBlog(prevState, formData) {
}

// Extract validated data
const { title, content, author, club } = validatedFields.data;
const { title, brief, content, author, club } = validatedFields.data;

// Insert data into the database
try {
await connectMongoDB();
const Blog = getBlogModel();
await Blog.create({ title, content, author, club });
await Blog.create({ title, brief, content, author, club });
} catch (error) {
// If a database error occurs, return a more specific error.
return {
Expand All @@ -60,6 +61,7 @@ export async function updateBlog(_id, prevState, formData) {
// Validate form using Zod
const validatedFields = FormSchema.safeParse({
title: formData.get("title"),
brief: formData.get("brief"),
content: formData.get("content"),
author: formData.get("author"),
club: _club,
Expand All @@ -74,13 +76,12 @@ export async function updateBlog(_id, prevState, formData) {
}

// Extract validated data
const { title, content, author } = validatedFields.data;
const { title, brief, content, author } = validatedFields.data;

// Insert data into the database
try {
await connectMongoDB();
const Blog = getBlogModel();
await Blog.findByIdAndUpdate(_id, { title, content, author });
await Blog.findByIdAndUpdate(_id, { title, brief, content, author });
} catch (error) {
// If a database error occurs, return a more specific error.
return {
Expand All @@ -99,7 +100,6 @@ export async function deleteBlog(id) {
await connectMongoDB();

// Attempt to delete the blog by their ID
const Blog = getBlogModel();
const result = await Blog.findByIdAndDelete(id);

// Check if the blog was not found
Expand Down
4 changes: 1 addition & 3 deletions src/app/actions/BlogData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import connectMongoDB from "@/lib/db";
import getBlogModel from "@/models/blog";
import Blog from "@/models/blog";
import { unstable_noStore as noStore } from "next/cache";

export async function getBlogById(blogid) {
Expand All @@ -8,7 +8,6 @@ export async function getBlogById(blogid) {
await connectMongoDB();

try {
const Blog = getBlogModel();
const foundBlog = await Blog.findOne({ _id: blogid });
if (!foundBlog) {
return { error: "Blog not found", status: 404 };
Expand All @@ -30,7 +29,6 @@ export async function getAllBlogs(club) {

try {
await connectMongoDB(); // Connect to the database
const Blog = getBlogModel();
const blogs = await Blog.find({club}); // Fetch all blogs

return blogs; // Return the fetched blogs
Expand Down
Loading

0 comments on commit 2782dcc

Please sign in to comment.