From a384562f9fe54d6aad26931c86aaa0ae9187e00d Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 21 Jul 2025 09:59:47 +0000 Subject: [PATCH] Refactor home page and navigation Move icon to navigation, update featured interactives, and add random interactives section. --- src/components/Navigation.tsx | 6 ++- src/pages/Index.tsx | 75 +++++++++++++++++++++++++++++++---- 2 files changed, 73 insertions(+), 8 deletions(-) diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index 444e1d6..d28c138 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -1,4 +1,5 @@ import { Link, useLocation } from "react-router-dom"; +import { BookOpen } from "lucide-react"; import { cn } from "@/lib/utils"; const Navigation = () => { @@ -16,8 +17,11 @@ const Navigation = () => {
+
+ +
Interactives diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index 335f2b8..553f7ea 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -2,11 +2,11 @@ import { Link } from "react-router-dom"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; -import { ArrowRight, BookOpen, Puzzle, Sparkles } from "lucide-react"; +import { ArrowRight, Sparkles } from "lucide-react"; import Layout from "@/components/Layout"; -// Featured interactives to display on index page -const featuredInteractives = [{ +// All interactives data +const allInteractives = [{ id: 'binary-number-game', title: 'Binary Number Representation', description: 'Learn how numbers are represented in binary (base-2) format through an interactive guessing game.', @@ -63,16 +63,28 @@ const featuredInteractives = [{ path: '/knights-puzzle', theme: 'Puzzles' }]; + +// Featured interactives (3 fixed ones) +const featuredInteractives = allInteractives.filter(interactive => + ['northcotts-game', 'ternary-search-trick', 'game-of-sim'].includes(interactive.id) +); + +// Function to get random interactives (excluding featured ones) +const getRandomInteractives = (count: number) => { + const availableInteractives = allInteractives.filter(interactive => + !['northcotts-game', 'ternary-search-trick', 'game-of-sim'].includes(interactive.id) + ); + + const shuffled = [...availableInteractives].sort(() => 0.5 - Math.random()); + return shuffled.slice(0, count); +}; const Index = () => { + const randomInteractives = getRandomInteractives(3); return {/* Hero Section */}
-
- -
-

Discover a collection of interactive educational tools designed to supplement lectures and enhance understanding across multiple disciplines. From discrete mathematics to social choice theory.

@@ -131,6 +143,55 @@ const Index = () => { )}
+
+
+ + {/* Random Interactives Section */} +
+
+
+
+ +

+ Random Interactives +

+ +
+

+ Explore something new with these randomly selected interactives +

+
+ +
+ {randomInteractives.map(interactive => + + + + {interactive.title} + + + + {interactive.theme} + + + +

+ {interactive.description} +

+
+ {interactive.tags.slice(0, 3).map(tag => + {tag} + )} +
+ +
+
)} +
+