Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions frontend/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { getTranslations } from 'next-intl/server';
import { Suspense } from 'react';

import FeaturesHeroSection from '@/components/home/FeaturesHeroSection';
import HomePageScroll from '@/components/home/HomePageScroll';
import WelcomeHeroSection from '@/components/home/WelcomeHeroSection';
import Footer from '@/components/shared/Footer';
import LazyFooter from '@/components/shared/LazyFooter';

export async function generateMetadata({
params,
Expand Down Expand Up @@ -75,9 +76,11 @@ export default function Home() {
data-home-step
className="min-h-[calc(100dvh-4rem)] shrink-0 snap-start [scroll-snap-stop:always]"
>
<FeaturesHeroSection />
<Suspense fallback={null}>
<FeaturesHeroSection />
</Suspense>
</div>
<Footer forceVisible />
<LazyFooter forceVisible />
</HomePageScroll>
);
}
9 changes: 3 additions & 6 deletions frontend/components/home/FeaturesHeroSection.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
'use client';

import { BrainCircuit, MessageCircleQuestion, TrendingUp } from 'lucide-react';
import { useTranslations } from 'next-intl';
import * as React from 'react';
import { getTranslations } from 'next-intl/server';

import { DynamicGridBackground } from '@/components/shared/DynamicGridBackground';
import { Link } from '@/i18n/routing';

import { FlipCardQA } from './FlipCardQA';
import { FloatingCode } from './FloatingCode';

export default function FeaturesHeroSection() {
const t = useTranslations('homepage');
export default async function FeaturesHeroSection() {
const t = await getTranslations('homepage');

return (
<DynamicGridBackground
Expand Down
5 changes: 0 additions & 5 deletions frontend/components/home/InteractiveCTAButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const InteractiveCTAButton = React.forwardRef<HTMLAnchorElement>(

const [currentText, setCurrentText] = useState(t('cta'));
const [variantIndex, setVariantIndex] = useState(0);
const [isFirstRender, setIsFirstRender] = useState(true);

const textVariants = [
t('cta'),
Expand All @@ -36,10 +35,6 @@ export const InteractiveCTAButton = React.forwardRef<HTMLAnchorElement>(
t('ctaVariants.8'),
];

useEffect(() => {
setIsFirstRender(false);
}, []);

const x = useMotionValue(0);
const y = useMotionValue(0);

Expand Down
2 changes: 0 additions & 2 deletions frontend/components/home/WelcomeHeroBackground.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export function WelcomeHeroBackground() {
return (
<>
Expand Down
35 changes: 35 additions & 0 deletions frontend/components/shared/LazyFooter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use client';

import dynamic from 'next/dynamic';
import { useEffect, useRef, useState } from 'react';

const Footer = dynamic(() => import('./Footer'));

export default function LazyFooter(props: { forceVisible?: boolean }) {
const sentinelRef = useRef<HTMLDivElement | null>(null);
const [nearViewport, setNearViewport] = useState(false);

useEffect(() => {
const node = sentinelRef.current;
if (!node) return;

const observer = new IntersectionObserver(
([entry]) => {
if (entry.isIntersecting) {
setNearViewport(true);
observer.disconnect();
}
},
{ rootMargin: '300px' }
);

observer.observe(node);
return () => observer.disconnect();
}, []);

if (!nearViewport) {
return <div ref={sentinelRef} aria-hidden="true" />;
}

return <Footer {...props} />;
}
Loading