Spaces:
Running
Running
ahmdelbaz28-ux commited on
Commit ·
4655eeb
1
Parent(s): b1cc3c9
feat: implement 'Master Class' elite animations including 3D tilt cards, magnetic buttons, and neon electric pulses
Browse filesFiles changed (6)
1234@echo offgit add .git commit -m "feat: implement 'Master Class' elite animations including 3D tilt cards, magnetic buttons, and neon electric pulses"git push -f origin main1234@echo offgit add .git commit -m "design: enhance hero showcase image with premium glow effects, larger dimensions, and 'Top Rated' elite badge"git push -f origin main12345636 unmodified lines434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188import { Link } from "react-router";import { useTranslation } from "@/hooks/useTranslation";import { Clock, Star, Users, Zap, ChevronRight } from "lucide-react";interface CourseCardProps {course: {36 unmodified linesconst lvl = levelColors[course.level] || levelColors.beginner;return (<Link to={`/courses/${course.slug}`} className="group block outline-none focus-visible:ring-2 focus-visible:ring-[#06b6d4] rounded-2xl"><articleclassName="relative overflow-hidden rounded-2xl border border-[#1e2d3d] bg-[#0d1420] transition-all duration-300group-hover:border-[rgba(6,182,212,0.4)] group-hover:shadow-[0_20px_60px_rgba(6,182,212,0.08)]group-hover:-translate-y-1 group-hover:will-change-transform">{/* ── Thumbnail ── */}<div className="relative h-48 overflow-hidden bg-gradient-to-br from-[#0a1628] to-[#1e2d3d]"><imgsrc={course.thumbnail || "/hero-bg.jpg"}alt={title}loading="lazy"width="384"height="192"decoding="async"onError={(e) => { e.currentTarget.src = "/hero-bg.jpg"; e.currentTarget.onerror = null; }}className="h-full w-full object-cover transition-transform duration-700 group-hover:scale-[1.04]"/>{/* Gradient overlay */}<div className="absolute inset-0 bg-gradient-to-t from-[#0d1420] via-transparent to-transparent" />{/* Top badges row */}<div className="absolute start-3 top-3 flex items-center gap-2">{course.isPremium ? (<span className="flex items-center gap-1 rounded-lg bg-[rgba(6,182,212,0.9)] px-2.5 py-1 text-[11px] font-bold uppercase tracking-wider text-[#001a24] backdrop-blur-sm"><Zap className="h-3 w-3" />Premium</span>) : (<span className="flex items-center gap-1 rounded-lg border border-[#f59e0b] bg-[rgba(245,158,11,0.15)] px-2.5 py-1 text-[11px] font-bold uppercase tracking-wider text-[#f59e0b] backdrop-blur-sm">{lang === "ar" ? "مجاني" : "Free"}</span>)}{discount > 0 && (<span className="rounded-lg bg-[rgba(239,68,68,0.85)] px-2.5 py-1 text-[11px] font-bold text-white backdrop-blur-sm">-{discount}%</span>)}</div>{/* Duration — bottom right */}<div className="absolute bottom-3 end-3 flex items-center gap-1 rounded-lg bg-[rgba(10,14,23,0.75)] px-2 py-1 backdrop-blur-md"><Clock className="h-3 w-3 text-[#94a3b8]" /><span className="text-[11px] font-medium text-[#94a3b8]">{course.durationHours}{lang === "ar" ? "س" : "h"}</span></div></div>{/* ── Body ── */}<div className="p-5">{/* Category + Level */}<div className="flex items-center justify-between"><span className="text-[11px] font-semibold uppercase tracking-widest text-[#06b6d4]">{categoryLabel || "Engineering"}</span><spanclassName="rounded-md px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider"style={{ background: lvl.bg, color: lvl.text }}>{lang === "ar" ? lvl.labelAr : lvl.label}</span></div>{/* Title */}<h3className="mt-2 line-clamp-2 text-[15px] font-bold leading-snug text-[#e8f0fe] transition-colors duration-200 group-hover:text-[#06b6d4]"dir={lang === "ar" ? "rtl" : "ltr"}>{title}</h3>{/* Short description */}{shortDesc && (<pclassName="mt-1.5 line-clamp-2 text-[12px] leading-relaxed text-[#64748b]"dir={lang === "ar" ? "rtl" : "ltr"}>{shortDesc}</p>)}{/* ── Stats row ── */}<div className="mt-4 flex items-center gap-4"><div className="flex items-center gap-1"><Star className="h-3.5 w-3.5 fill-[#f59e0b] text-[#f59e0b]" /><span className="text-[12px] font-semibold text-[#e8f0fe]">{parseFloat(course.rating).toFixed(1)}</span><span className="text-[11px] text-[#475569]">({course.reviewCount})</span></div><div className="h-3 w-px bg-[#1e2d3d]" /><div className="flex items-center gap-1"><Users className="h-3.5 w-3.5 text-[#475569]" /><span className="text-[11px] text-[#64748b]">{course.studentCount >= 1000? `${(course.studentCount / 1000).toFixed(1)}k`: course.studentCount.toLocaleString()}{lang === "ar" ? " طالب" : " students"}</span></div></div>{/* ── Separator ── */}<div className="my-4 h-px bg-gradient-to-r from-transparent via-[#1e2d3d] to-transparent" />{/* ── Price + CTA ── */}<div className="flex items-center justify-between"><div>{coursePrice === 0 ? (<span className="text-base font-bold text-[#10b981]">{lang === "ar" ? "مجاناً" : "Free"}</span>) : (<div className="flex items-baseline gap-2"><span className="text-xl font-extrabold text-[#e8f0fe]">{coursePrice.toLocaleString()} {lang === "ar" ? "ج.م" : "EGP"}</span>{originalPrice > coursePrice && (<span className="text-sm text-[#475569] line-through">{originalPrice.toLocaleString()}</span>)}</div>)}</div>{/* Animated CTA arrow */}<div className="flex h-8 w-8 items-center justify-center rounded-full border border-[#1e2d3d] bg-[#111827] transition-all duration-200 group-hover:border-[#06b6d4] group-hover:bg-[rgba(6,182,212,0.1)]"><ChevronRight className="h-4 w-4 text-[#475569] transition-colors group-hover:text-[#06b6d4] rtl:rotate-180" /></div></div></div>{/* Shimmer line on hover */}<div className="absolute bottom-0 start-0 h-[2px] w-0 bg-gradient-to-r from-[#06b6d4] to-[#0891b2] transition-all duration-500 group-hover:w-full" /></article></Link>);}123456736 unmodified lines4445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194import { Link } from "react-router";import { useTranslation } from "@/hooks/useTranslation";import { Clock, Star, Users, Zap, ChevronRight } from "lucide-react";import { TiltCard } from "@/components/ui/motion";interface CourseCardProps {course: {36 unmodified linesconst lvl = levelColors[course.level] || levelColors.beginner;return (<TiltCard className="h-full"><Link to={`/courses/${course.slug}`} className="group block h-full outline-none focus-visible:ring-2 focus-visible:ring-[#06b6d4] rounded-2xl"><articleclassName="relative h-full overflow-hidden rounded-2xl border border-[#1e2d3d] bg-[#0d1420] transition-all duration-300group-hover:border-[rgba(6,182,212,0.4)] group-hover:shadow-[0_20px_60px_rgba(6,182,212,0.12)]group-hover:will-change-transform">{/* ── Thumbnail ── */}<div className="relative h-48 overflow-hidden bg-gradient-to-br from-[#0a1628] to-[#1e2d3d]"><imgsrc={course.thumbnail || "/hero-bg.jpg"}alt={title}loading="lazy"width="384"height="192"decoding="async"onError={(e) => { e.currentTarget.src = "/hero-bg.jpg"; e.currentTarget.onerror = null; }}className="h-full w-full object-cover transition-transform duration-700 group-hover:scale-[1.04]"/>{/* Gradient overlay */}<div className="absolute inset-0 bg-gradient-to-t from-[#0d1420] via-transparent to-transparent" />{/* Top badges row */}<div className="absolute start-3 top-3 flex items-center gap-2">{course.isPremium ? (<span className="flex items-center gap-1 rounded-lg bg-[rgba(6,182,212,0.9)] px-2.5 py-1 text-[11px] font-bold uppercase tracking-wider text-[#001a24] backdrop-blur-sm"><Zap className="h-3 w-3" />Premium</span>) : (<span className="flex items-center gap-1 rounded-lg border border-[#f59e0b] bg-[rgba(245,158,11,0.15)] px-2.5 py-1 text-[11px] font-bold uppercase tracking-wider text-[#f59e0b] backdrop-blur-sm">{lang === "ar" ? "مجاني" : "Free"}</span>)}{discount > 0 && (<span className="rounded-lg bg-[rgba(239,68,68,0.85)] px-2.5 py-1 text-[11px] font-bold text-white backdrop-blur-sm">-{discount}%</span>)}</div>{/* Duration — bottom right */}<div className="absolute bottom-3 end-3 flex items-center gap-1 rounded-lg bg-[rgba(10,14,23,0.75)] px-2 py-1 backdrop-blur-md"><Clock className="h-3 w-3 text-[#94a3b8]" /><span className="text-[11px] font-medium text-[#94a3b8]">{course.durationHours}{lang === "ar" ? "س" : "h"}</span></div></div>{/* ── Body ── */}<div className="p-5 flex flex-col h-[calc(100%-12rem)]"><div className="flex-1">{/* Category + Level */}<div className="flex items-center justify-between"><span className="text-[11px] font-semibold uppercase tracking-widest text-[#06b6d4]">{categoryLabel || "Engineering"}</span><spanclassName="rounded-md px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider"style={{ background: lvl.bg, color: lvl.text }}>{lang === "ar" ? lvl.labelAr : lvl.label}</span></div>{/* Title */}<h3className="mt-2 line-clamp-2 text-[15px] font-bold leading-snug text-[#e8f0fe] transition-colors duration-200 group-hover:text-[#06b6d4]"dir={lang === "ar" ? "rtl" : "ltr"}>{title}</h3>{/* Short description */}{shortDesc && (<pclassName="mt-1.5 line-clamp-2 text-[12px] leading-relaxed text-[#64748b]"dir={lang === "ar" ? "rtl" : "ltr"}>{shortDesc}</p>)}{/* ── Stats row ── */}<div className="mt-4 flex items-center gap-4"><div className="flex items-center gap-1"><Star className="h-3.5 w-3.5 fill-[#f59e0b] text-[#f59e0b]" /><span className="text-[12px] font-semibold text-[#e8f0fe]">{parseFloat(course.rating).toFixed(1)}</span><span className="text-[11px] text-[#475569]">({course.reviewCount})</span></div><div className="h-3 w-px bg-[#1e2d3d]" /><div className="flex items-center gap-1"><Users className="h-3.5 w-3.5 text-[#475569]" /><span className="text-[11px] text-[#64748b]">{course.studentCount >= 1000? `${(course.studentCount / 1000).toFixed(1)}k`: course.studentCount.toLocaleString()}{lang === "ar" ? " طالب" : " students"}</span></div></div></div>{/* ── Separator ── */}<div className="my-4 h-px bg-gradient-to-r from-transparent via-[#1e2d3d] to-transparent" />{/* ── Price + CTA ── */}<div className="flex items-center justify-between mt-auto"><div>{coursePrice === 0 ? (<span className="text-base font-bold text-[#10b981]">{lang === "ar" ? "مجاناً" : "Free"}</span>) : (<div className="flex items-baseline gap-2"><span className="text-xl font-extrabold text-[#e8f0fe]">{coursePrice.toLocaleString()} {lang === "ar" ? "ج.م" : "EGP"}</span>{originalPrice > coursePrice && (<span className="text-sm text-[#475569] line-through">{originalPrice.toLocaleString()}</span>)}</div>)}</div>{/* Animated CTA arrow */}<div className="flex h-8 w-8 items-center justify-center rounded-full border border-[#1e2d3d] bg-[#111827] transition-all duration-200 group-hover:border-[#06b6d4] group-hover:bg-[rgba(6,182,212,0.1)]"><ChevronRight className="h-4 w-4 text-[#475569] transition-colors group-hover:text-[#06b6d4] rtl:rotate-180" /></div></div></div>{/* Shimmer line on hover */}<div className="absolute bottom-0 start-0 h-[2px] w-0 bg-gradient-to-r from-[#06b6d4] to-[#0891b2] transition-all duration-500 group-hover:w-full" /></article></Link></TiltCard>);}
2 unmodified lines345678910111213114 unmodified lines1281291301311321331341351361371381391401411421431441451461471481491501512 unmodified linesimport { useAuth } from "@/hooks/useAuth";import { useTranslation } from "@/hooks/useTranslation";import Logo3D from "@/components/Logo3D";import {Menu, X, LayoutDashboard, Headphones,Shield, LogOut, BookOpen, ChevronDown,UserCog,} from "lucide-react";import { Button } from "@/components/ui/button";import { EngineeringModeToggle } from "@/components/ui/EngineeringMode";114 unmodified lines{ path: "/", label: lang === "ar" ? "الرئيسية" : "Home" },{ path: "/courses", label: lang === "ar" ? "الكورسات" : "Courses", icon: <BookOpen className="h-3.5 w-3.5" /> },].map((link) => (<Linkkey={link.path}to={link.path}aria-current={isActive(link.path) ? "page" : undefined}className={`relative flex items-center gap-1.5 rounded-lg px-3 py-2 text-[13px] font-medium transition-all duration-150 ${isActive(link.path)? "bg-[rgba(6,182,212,0.1)] text-[#06b6d4]": "text-[#94a3b8] hover:bg-[rgba(255,255,255,0.04)] hover:text-[#e8f0fe]"}`}>{link.icon}{link.label}{isActive(link.path) && (<span className="absolute -bottom-0.5 left-3 right-3 h-0.5 rounded-full bg-[#06b6d4]" />)}</Link>))}{isAuthenticated && (<Linkto="/dashboard"2 unmodified lines345678910111213141516114 unmodified lines1311321331341351361371381391401411421431441451461471481491501511521531541551561571581592 unmodified linesimport { useAuth } from "@/hooks/useAuth";import { useTranslation } from "@/hooks/useTranslation";import Logo3D from "@/components/Logo3D";import { motion } from "framer-motion";import { Magnetic } from "@/components/ui/motion";import {Menu, X, LayoutDashboard, Headphones,Shield, LogOut, BookOpen, ChevronDown,UserCog,} from "lucide-react";import { Button } from "@/components/ui/button";import { EngineeringModeToggle } from "@/components/ui/EngineeringMode";114 unmodified lines{ path: "/", label: lang === "ar" ? "الرئيسية" : "Home" },{ path: "/courses", label: lang === "ar" ? "الكورسات" : "Courses", icon: <BookOpen className="h-3.5 w-3.5" /> },].map((link) => (<Magnetic key={link.path}><Linkto={link.path}aria-current={isActive(link.path) ? "page" : undefined}className={`relative flex items-center gap-1.5 rounded-lg px-4 py-2 text-[13px] font-medium transition-all duration-200 ${isActive(link.path)? "bg-[rgba(6,182,212,0.1)] text-[#06b6d4]": "text-[#94a3b8] hover:text-[#e8f0fe]"}`}>{link.icon}{link.label}{isActive(link.path) && (<motion.spanlayoutId="nav-underline"className="absolute -bottom-0.5 left-3 right-3 h-0.5 rounded-full bg-[#06b6d4]"/>)}</Link></Magnetic>))}{isAuthenticated && (<Linkto="/dashboard"
120 unmodified lines121122123120 unmodified lines</motion.div>);}120 unmodified lines121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223120 unmodified lines</motion.div>);}// ─── Elite "Master Class" Components ───/*** 3D Tilt Card Effect* Adds professional depth that follows mouse movement.*/export function TiltCard({ children, className, ...props }: React.HTMLAttributes<HTMLDivElement> & MotionProps) {const [rotateX, setRotateX] = React.useState(0);const [rotateY, setRotateY] = React.useState(0);const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {const rect = e.currentTarget.getBoundingClientRect();const x = e.clientX - rect.left;const y = e.clientY - rect.top;const centerX = rect.width / 2;const centerY = rect.height / 2;const rotateX = ((y - centerY) / centerY) * -10;const rotateY = ((x - centerX) / centerX) * 10;setRotateX(rotateX);setRotateY(rotateY);};const handleMouseLeave = () => {setRotateX(0);setRotateY(0);};return (<motion.divonMouseMove={handleMouseMove}onMouseLeave={handleMouseLeave}animate={{ rotateX, rotateY }}transition={{ type: "spring", stiffness: 150, damping: 20 }}style={{ perspective: 1000, transformStyle: "preserve-3d" }}className={cn("relative transition-all duration-200", className)}{...props}>{children}</motion.div>);}/*** Magnetic Attraction Effect* Elements feel "alive" by subtly gravitating towards the cursor.*/export function Magnetic({ children, ...props }: { children: React.ReactElement }) {const ref = React.useRef<HTMLDivElement>(null);const [position, setPosition] = React.useState({ x: 0, y: 0 });const handleMouseMove = (e: MouseEvent) => {const { clientX, clientY } = e;const { left, top, width, height } = ref.current!.getBoundingClientRect();const x = clientX - (left + width / 2);const y = clientY - (top + height / 2);setPosition({ x: x * 0.2, y: y * 0.2 });};const handleMouseLeave = () => {setPosition({ x: 0, y: 0 });};return (<motion.divref={ref}onMouseMove={handleMouseMove as any}onMouseLeave={handleMouseLeave}animate={{ x: position.x, y: position.y }}transition={{ type: "spring", stiffness: 150, damping: 15, mass: 0.1 }}>{children}</motion.div>);}/*** Electric Pulse Aura* Subtle breathing neon glow for premium elements.*/export function NeonGlow({ children, className, color = "#06b6d4", ...props }: { children: React.ReactNode, className?: string, color?: string }) {return (<motion.divanimate={{boxShadow: [`0 0 0px ${color}33`,`0 0 20px ${color}66`,`0 0 0px ${color}33`]}}transition={{ duration: 2, repeat: Infinity, ease: "easeInOut" }}className={cn("rounded-xl", className)}{...props}>{children}</motion.div>);}
2 unmodified lines3456789473 unmodified lines4834844854864874884894904914924934944954964974982 unmodified linesimport { trpc } from "@/providers/trpc";import CourseCard from "@/components/CourseCard";import SEO from "@/components/SEO";import { StaggerContainer, StaggerItem, FadeIn, HoverSpring } from "@/components/ui/motion";import SingleLineDiagram from "@/components/ui/SingleLineDiagram";import ScadaGauge from "@/components/ui/ScadaGauge";import ArcFlashButton from "@/components/ui/ArcFlashButton";473 unmodified lines<div className="absolute inset-0 bg-gradient-to-t from-[#0a0e17]/40 via-transparent to-white/5 pointer-events-none" /></div>{/* Floating Badge (Star Effect) */}<div className="absolute -bottom-4 -right-4 z-20 hidden lg:flex items-center gap-3 rounded-2xl bg-[#111827] p-4 border border-[#1f2d44] shadow-xl animate-[pulse_3s_ease-in-out_infinite]"><div className="flex h-10 w-10 items-center justify-center rounded-xl bg-[rgba(6,182,212,0.1)]"><Star className="h-6 w-6 text-yellow-400 fill-yellow-400" /></div><div><p className="text-sm font-bold text-white">Top Rated</p><p className="text-xs text-[#94a3b8]">Engineering Expert</p></div></div></div></FadeIn>2 unmodified lines345678910473 unmodified lines4844854864874884894904914924934944954964974984995005015022 unmodified linesimport { trpc } from "@/providers/trpc";import CourseCard from "@/components/CourseCard";import SEO from "@/components/SEO";import { StaggerContainer, StaggerItem, FadeIn, HoverSpring, NeonGlow } from "@/components/ui/motion";import SingleLineDiagram from "@/components/ui/SingleLineDiagram";import ScadaGauge from "@/components/ui/ScadaGauge";import ArcFlashButton from "@/components/ui/ArcFlashButton";473 unmodified lines<div className="absolute inset-0 bg-gradient-to-t from-[#0a0e17]/40 via-transparent to-white/5 pointer-events-none" /></div>{/* Floating Badge (Star Effect) - Upgraded to NeonGlow */}<div className="absolute -bottom-4 -right-4 z-20 hidden lg:flex"><NeonGlow color="#06b6d4" className="flex items-center gap-3 rounded-2xl bg-[#111827] p-4 border border-[#1f2d44] shadow-xl"><div className="flex h-10 w-10 items-center justify-center rounded-xl bg-[rgba(6,182,212,0.1)]"><Star className="h-6 w-6 text-yellow-400 fill-yellow-400" /></div><div><p className="text-sm font-bold text-white">Top Rated</p><p className="text-xs text-[#94a3b8]">Engineering Expert</p></div></NeonGlow></div></div></FadeIn>
scripts/final-animations-push.batAdded+4
scripts/final-hero-upgrade.batDeleted-4
src/components/CourseCard.tsx+132-126
src/components/Navbar.tsx+24-16
src/components/ui/motion.tsx+100
src/pages/Home.tsx+14-10