From a9b3a593e806998b7abfa0c5bee523a190517f2e Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 21:36:31 +0000 Subject: [PATCH] Changes --- src/pages/Index.tsx | 137 +++++++++++++++++++++----------------------- 1 file changed, 64 insertions(+), 73 deletions(-) diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index 3cbe607..5b6a7cc 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -18,6 +18,7 @@ const Index = () => { const [lines, setLines] = useState<{ x1: number; y1: number; x2: number; y2: number }[]>([]); const [mousePos, setMousePos] = useState({ x: 0, y: 0 }); const [mounted, setMounted] = useState(false); + const [dims, setDims] = useState({ w: 0, h: 0 }); const updateLines = useCallback(() => { if (!containerRef.current || !avatarRef.current) return; @@ -25,13 +26,17 @@ const Index = () => { const avatarRect = avatarRef.current.getBoundingClientRect(); const cx = avatarRect.left + avatarRect.width / 2 - containerRect.left; const cy = avatarRect.top + avatarRect.height / 2 - containerRect.top; + setDims({ w: containerRect.width, h: containerRect.height }); const newLines = cardRefs.current.map((card) => { if (!card) return { x1: cx, y1: cy, x2: cx, y2: cy }; const cardRect = card.getBoundingClientRect(); - const cardCx = cardRect.left + cardRect.width / 2 - containerRect.left; - const cardCy = cardRect.top + cardRect.height / 2 - containerRect.top; - return { x1: cx, y1: cy, x2: cardCx, y2: cardCy }; + return { + x1: cx, + y1: cy, + x2: cardRect.left + cardRect.width / 2 - containerRect.left, + y2: cardRect.top + cardRect.height / 2 - containerRect.top, + }; }); setLines(newLines); }, []); @@ -40,29 +45,30 @@ const Index = () => { updateLines(); const timer = setTimeout(() => setMounted(true), 100); window.addEventListener('resize', updateLines); - return () => { - window.removeEventListener('resize', updateLines); - clearTimeout(timer); - }; + return () => { window.removeEventListener('resize', updateLines); clearTimeout(timer); }; }, [updateLines]); useEffect(() => { - // Re-calc after fonts/images load - const timer = setTimeout(updateLines, 500); - return () => clearTimeout(timer); + const t = setTimeout(updateLines, 500); + return () => clearTimeout(t); }, [updateLines]); const handleMouseMove = useCallback((e: React.MouseEvent) => { - if (!containerRef.current) return; - const rect = containerRef.current.getBoundingClientRect(); - setMousePos({ x: e.clientX - rect.left, y: e.clientY - rect.top }); + setMousePos({ x: e.clientX, y: e.clientY }); }, []); + // On mobile, use a smaller radius + const isMobile = dims.w < 640; + const radius = isMobile ? 140 : 220; + const count = items.length; + // Start from top (-90deg) and spread evenly + const angleOffset = -90; + return (
{/* Global mouse glow */}
{ {lines.map((line, i) => ( - {/* Glow line */} - {/* Main line */} - {/* End dot on card */} ))} - {/* Center dot */} {lines.length > 0 && ( )} - {/* Center Avatar Hub */} -
-
- Mohamad + {/* Hub container - centered */} +
+ {/* Center Avatar */} +
+
+ Mohamad +
+
+

👋 Hey!

+

+ I'm Mohamad +

+
-
-

- 👋 Hey There! -

-

- I'm Mohamad — welcome to my space. -

-
-
- {/* Cards arranged around */} -
- {/* Top row - 3 cards */} -
- {items.slice(0, 3).map((item, i) => ( + {/* Orbiting cards */} + {items.map((item, i) => { + const angle = ((360 / count) * i + angleOffset) * (Math.PI / 180); + const x = Math.cos(angle) * radius; + const y = Math.sin(angle) * radius; + const cardW = isMobile ? 110 : 130; + const cardH = isMobile ? 80 : 90; + + return ( { cardRefs.current[i] = el; }} href={item.href} target="_blank" rel="noopener noreferrer" - className="block" + className="absolute" + style={{ + left: `calc(50% + ${x}px - ${cardW / 2}px)`, + top: `calc(50% + ${y}px - ${cardH / 2}px)`, + width: cardW, + }} > - +
- - + +
-

{item.label}

-

{item.desc}

+

{item.label}

+

{item.desc}

- ))} -
- - {/* Bottom row - 2 cards centered */} - + ); + })}
{/* Footer */} -

+

damaj.tech