diff --git a/public/intro-video.mp4 b/public/intro-video.mp4 deleted file mode 100644 index 8958d2fb..00000000 Binary files a/public/intro-video.mp4 and /dev/null differ diff --git a/src/app/page.tsx b/src/app/page.tsx index 35648030..b5581a0c 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,25 +1,125 @@ -import Image from "next/image"; +'use client'; + +import { useEffect, useState } from "react"; +import data from "../database/data.json"; +import ProjectCard from "../components/shared/ProjectCard"; +import { ProjectsData, Project } from "../types"; +import Link from "next/link"; export default function Home() { + const [randomProjects, setRandomProjects] = useState([]); + + const getRandomProjects = (): Project[] => { + const allProjects: Record = { + beginner: [], + intermediate: [], + advanced: [], + }; + for (const category in data) { + if (Object.prototype.hasOwnProperty.call(data, category)) { + const categoryData = data[category as keyof typeof data]; + for (const level in categoryData) { + const levelKey = level as keyof ProjectsData; + (categoryData[levelKey] as Project[]).forEach((project) => + allProjects[levelKey]?.push({ ...project, category, level: levelKey }) + ); + } + } + } + + const beginnerProject = allProjects.beginner[Math.floor(Math.random() * allProjects.beginner.length)]; + const intermediateProject = allProjects.intermediate[Math.floor(Math.random() * allProjects.intermediate.length)]; + const advancedProject = allProjects.advanced[Math.floor(Math.random() * allProjects.advanced.length)]; + return [beginnerProject, intermediateProject, advancedProject].filter( + (project): project is Project => Boolean(project) + ); + }; + + useEffect(() => { + const projects = getRandomProjects(); + setRandomProjects(projects); + }, []); + return (
-
- logo -
-

WEB MASTER LOG | YOUR WEB DEV HUB

-
- image + {/* Hero Section */} +
+

Supercharge Your Web Development Journey

+

+ Explore, learn, and contribute to diverse web development projects. Empower your skills with open-source. +

+ + +
-
- -
+ {/* Problem-Solution Showcase */} +
+

+ Why Web Master Log? +

+
+
+

Real Projects

+

+ Access a wide range of real-world projects, from beginner-friendly to advanced. +

+
+
+

Collaborative Learning

+

+ Contribute, learn, and grow by collaborating with a vibrant developer community. +

+
+
+

Beginner-Friendly

+

+ Start your journey with easy-to-follow documentation and guides. +

+
+
+
+ + {/* Explore Projects */} +
+

Explore Projects

+
+ {randomProjects.map((project, index) => ( + + ))} +
+
+ + + +
+
+ + {/* Call to Contribute */} +
+

+ Ready to Contribute? +

+

+ Join our community and contribute to exciting open-source projects. It's + easy, rewarding, and fun! +

+
+ +
+
); diff --git a/src/types/index.ts b/src/types/index.ts index c183af68..955b9dcb 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -6,6 +6,8 @@ export interface Project { avatar_url: string; description: string; tags: string[]; + category?: string; + level?: "beginner" | "intermediate" | "advanced"; } export interface ProjectsData {