5 Commits

Author SHA1 Message Date
a0fb98409f refactor: update CallToAction "Join the Network" button to scroll to download section instead of node-how-it-works
- Changed smoothScrollToElement target from 'node-how-it-works' to 'download' section
- Maintained 1200ms scroll duration
2025-11-24 14:50:19 +01:00
c9335d2c5a refactor: update CallToAction "Join the Network" button to use smooth scroll instead of navigation link
- Changed Button from navigation link with to="/network" to onClick handler with smooth scroll behavior
- Added smoothScrollToElement import from @/utils/scroll
- Implemented smooth scroll to #node-how-it-works section with 1200ms duration
- Removed to prop from Button component
2025-11-24 14:40:44 +01:00
6b4c7b3329 refactor: implement smart navigation for "Get Mycelium Connector" button with smooth scroll utility
- Added smoothScrollToElement utility function in src/utils/scroll.ts with easeInOutQuad animation and configurable duration
- Changed Header and HeaderDark "Get Mycelium Connector" button from static /download link to onClick handler with conditional navigation
- Added handleGetConnectorClick function that scrolls to #download section when on /network page, otherwise navigates to /network
- Change
2025-11-24 14:13:40 +01:00
a22a8ddcc9 refactor: update navigation links in CallToAction and NodeHero components
- Changed CallToAction "Join the Network" button from /network#download to /network
- Changed NodeHero "Explore Docs" button from #node-architecture anchor to external ThreeFold hosting FAQ link with target="_blank"
2025-11-24 13:29:07 +01:00
8e621c28b3 refactor: update NodeHero "How it works" button to use smooth scroll with onClick handler instead of anchor link
- Changed Button from anchor link with to="#node-getting-started" to onClick handler with smooth scroll behavior
- Added id="node-how-it-works" to NodeSteps section for scroll target
- Removed as="a" prop from Button component
- Implemented scrollIntoView with smooth behavior and start block positioning
2025-11-24 13:09:22 +01:00
9 changed files with 105 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
import { useState } from 'react'
import { Link } from 'react-router-dom'
import { Link, useLocation, useNavigate } from 'react-router-dom'
import { smoothScrollToElement } from '@/utils/scroll'
import { Container } from './Container'
import { Button } from './Button'
import pmyceliumLogo from '../images/logos/mainlogo.svg'
@@ -9,6 +10,17 @@ import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline'
export function Header() {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
const navigate = useNavigate()
const location = useLocation()
const handleGetConnectorClick = () => {
if (location.pathname === '/network') {
smoothScrollToElement('download', 1200)
} else {
navigate('/network')
}
}
return (
<header className="bg-white">
<nav className="border-b border-gray-100">
@@ -61,7 +73,7 @@ export function Header() {
>
Deploy Now
</Button>
<Button to="/download" variant="solid" color="cyan">
<Button variant="solid" color="cyan" onClick={handleGetConnectorClick}>
Get Mycelium Connector
</Button>
</div>
@@ -150,7 +162,15 @@ export function Header() {
>
Start Deployment
</Button>
<Button to="/download" variant="solid" color="cyan" className="mt-4 w-full" onClick={() => setMobileMenuOpen(false)}>
<Button
variant="solid"
color="cyan"
className="mt-4 w-full"
onClick={() => {
setMobileMenuOpen(false)
handleGetConnectorClick()
}}
>
Get Mycelium Connector
</Button>
</div>

View File

@@ -1,5 +1,6 @@
import { useState } from 'react'
import { Link } from 'react-router-dom'
import { Link, useLocation, useNavigate } from 'react-router-dom'
import { smoothScrollToElement } from '@/utils/scroll'
import { Container } from './Container'
import { Button } from './Button'
import pmyceliumLogo from '../images/logos/mainlogo.svg'
@@ -9,6 +10,17 @@ import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline'
export function HeaderDark() {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
const navigate = useNavigate()
const location = useLocation()
const handleGetConnectorClick = () => {
if (location.pathname === '/network') {
smoothScrollToElement('download', 1200)
} else {
navigate('/network')
}
}
return (
<header className="bg-[#111111]">
<nav className="border-b border-gray-800">
@@ -61,7 +73,7 @@ export function HeaderDark() {
>
Deploy Now
</Button>
<Button to="/download" variant="solid" color="cyan">
<Button variant="solid" color="cyan" onClick={handleGetConnectorClick}>
Get Mycelium Connector
</Button>
</div>
@@ -150,7 +162,15 @@ export function HeaderDark() {
>
Start Deployment
</Button>
<Button to="/download" variant="solid" color="cyan" className="mt-4 w-full" onClick={() => setMobileMenuOpen(false)}>
<Button
variant="solid"
color="cyan"
className="mt-4 w-full"
onClick={() => {
setMobileMenuOpen(false)
handleGetConnectorClick()
}}
>
Get Mycelium Connector
</Button>
</div>

View File

@@ -6,9 +6,10 @@ import {
useScroll,
useMotionValueEvent,
} from "motion/react";
import { Link } from "react-router-dom";
import { Link, useLocation, useNavigate } from "react-router-dom";
import { cn } from "@/lib/utils";
import { Button } from "../Button";
import { smoothScrollToElement } from "@/utils/scroll";
export const FloatingNav = ({
@@ -23,8 +24,17 @@ export const FloatingNav = ({
className?: string;
}) => {
const { scrollYProgress } = useScroll();
const [visible, setVisible] = useState(true);
const navigate = useNavigate();
const location = useLocation();
const handleGetConnectorClick = () => {
if (location.pathname === "/network") {
smoothScrollToElement("download", 1200);
} else {
navigate("/network");
}
};
useMotionValueEvent(scrollYProgress, "change", (current) => {
if (typeof current === "number") {
@@ -80,7 +90,7 @@ export const FloatingNav = ({
>
<span className="hidden sm:block text-sm">Docs</span>
</a>
<Button to="/download" variant="solid" color="cyan">
<Button variant="solid" color="cyan" onClick={handleGetConnectorClick}>
Get Mycelium Connector
</Button>
</div>

View File

@@ -51,7 +51,7 @@ export function CallToAction() {
</P>
<div className="mt-10 flex flex-wrap justify-center items-center gap-x-6 gap-y-4">
<Button to="/network#download" variant="solid" color="cyan">
<Button to="/network" variant="solid" color="cyan">
Join the Network
</Button>

View File

@@ -2,6 +2,7 @@
import { Container } from '@/components/Container'
import { Button } from "@/components/Button";
import { smoothScrollToElement } from "@/utils/scroll";
export function CallToAction() {
return (
@@ -50,7 +51,8 @@ Use the network to link environments, deploy workloads, or host nodes to strengt
{/* ✅ Two cards, stacked center with spacing */}
<div className="mt-10 flex flex-wrap justify-center items-center gap-x-6 gap-y-4">
<Button to="/network" variant="solid" color="cyan">
<Button variant="solid" color="cyan" onClick={() => smoothScrollToElement('download', 1200)}
>
Join the Network
</Button>

View File

@@ -1,6 +1,7 @@
import { useId } from 'react'
import { Container } from '@/components/Container'
import { Button } from '@/components/Button'
import { smoothScrollToElement } from '@/utils/scroll'
import phoneFrame from '../../images/phoneframe.png'
import { H3, P
, Eyebrow } from "@/components/Texts";
@@ -93,7 +94,11 @@ export function Hero() {
Your Pod is your personal gateway to the network.
</P>
<div className="mt-8 flex flex-wrap gap-x-6 gap-y-4">
<Button to="/download" variant="solid" color="cyan">
<Button
variant="solid"
color="cyan"
onClick={() => smoothScrollToElement('download', 1200)}
>
Get Started
</Button>
<Button

View File

@@ -2,6 +2,7 @@
import { Button } from '@/components/Button'
import { Eyebrow, H3, P } from '@/components/Texts'
import { smoothScrollToElement } from '@/utils/scroll'
export function NodeHero() {
return (
@@ -28,10 +29,14 @@ export function NodeHero() {
The Mycelium Network runs on nodes hosted by people and organizations around the world. Each node adds capacity, resilience, and sovereignty, expanding a global network for private, distributed compute and AI.
</P>
<div className="mt-10 flex items-center gap-x-6">
<Button to="#node-getting-started" as="a" variant="solid" color="cyan">
<Button
variant="solid"
color="cyan"
onClick={() => smoothScrollToElement('node-how-it-works', 1200)}
>
How it works
</Button>
<Button to="#node-architecture" as="a" variant="outline">
<Button to="https://threefold.info/mycelium_economics/docs/faq/hosting_faq" as="a" variant="outline" target="_blank">
Explore Docs
</Button>
</div>

View File

@@ -37,7 +37,7 @@ const steps = [
export function NodeSteps() {
return (
<section className="w-full max-w-8xl mx-auto bg-transparent">
<section id="node-how-it-works" className="w-full max-w-8xl mx-auto bg-transparent">
{/* Header spacing + borders */}
<div className="max-w-7xl mx-auto py-6 border border-t-0 border-b-0 border-gray-100" />

28
src/utils/scroll.ts Normal file
View File

@@ -0,0 +1,28 @@
export function smoothScrollToElement(id: string, duration = 800) {
const element = document.getElementById(id)
if (!element) return
const startY = window.scrollY || window.pageYOffset
const targetRect = element.getBoundingClientRect()
const targetY = startY + targetRect.top
const startTime = performance.now()
function easeInOutQuad(t: number) {
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t
}
function step(currentTime: number) {
const elapsed = currentTime - startTime
const progress = Math.min(elapsed / duration, 1)
const eased = easeInOutQuad(progress)
const nextY = startY + (targetY - startY) * eased
window.scrollTo(0, nextY)
if (progress < 1) {
requestAnimationFrame(step)
}
}
requestAnimationFrame(step)
}