2024-10-10 17:03:42 -05:00
|
|
|
import React, { useEffect, useState, useRef } from 'react';
|
2024-09-09 17:35:00 -05:00
|
|
|
import useWindowWidth from '@/hooks/useWindowWidth';
|
2024-03-17 17:32:23 -05:00
|
|
|
import Image from 'next/image';
|
2024-10-10 17:03:42 -05:00
|
|
|
import { useImageProxy } from '@/hooks/useImageProxy';
|
|
|
|
import { useRouter } from 'next/router';
|
2024-10-11 14:41:36 -05:00
|
|
|
import { Avatar } from 'primereact/avatar';
|
|
|
|
import { AvatarGroup } from 'primereact/avatargroup';
|
2024-10-10 17:03:42 -05:00
|
|
|
import GenericButton from '../buttons/GenericButton';
|
|
|
|
import HeroImage from '../../../public/images/hero-image.png';
|
2024-10-11 14:41:36 -05:00
|
|
|
import plebdevsGuy from '../../../public/images/plebdevs-guy.png';
|
2024-03-17 17:32:23 -05:00
|
|
|
|
|
|
|
const HeroBanner = () => {
|
2024-10-10 17:03:42 -05:00
|
|
|
const [currentTech, setCurrentTech] = useState('Bitcoin');
|
|
|
|
const [isAnimating, setIsAnimating] = useState(false);
|
|
|
|
const techs = ['Bitcoin', 'Lightning', 'Nostr'];
|
2024-09-09 17:35:00 -05:00
|
|
|
const windowWidth = useWindowWidth();
|
2024-10-10 17:03:42 -05:00
|
|
|
const router = useRouter();
|
|
|
|
const { returnImageProxy } = useImageProxy();
|
2024-10-11 16:03:43 -05:00
|
|
|
|
|
|
|
const isTabView = windowWidth <= 1360;
|
2024-10-10 17:54:34 -05:00
|
|
|
const isMobile = windowWidth <= 800;
|
2024-10-11 14:53:57 -05:00
|
|
|
const isWideScreen = windowWidth >= 2200;
|
|
|
|
const isSuperWideScreen = windowWidth >= 2600;
|
2024-10-10 17:03:42 -05:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const interval = setInterval(() => {
|
|
|
|
setIsAnimating(true);
|
|
|
|
setTimeout(() => {
|
|
|
|
setCurrentTech(prev => {
|
|
|
|
const currentIndex = techs.indexOf(prev);
|
|
|
|
return techs[(currentIndex + 1) % techs.length];
|
|
|
|
});
|
|
|
|
setIsAnimating(false);
|
|
|
|
}, 400); // Half of the interval for smooth transition
|
|
|
|
}, 2800);
|
|
|
|
|
|
|
|
return () => clearInterval(interval);
|
|
|
|
}, []);
|
2024-09-09 17:35:00 -05:00
|
|
|
|
2024-10-10 17:03:42 -05:00
|
|
|
const getColorClass = (tech) => {
|
|
|
|
switch (tech) {
|
2024-03-19 17:47:16 -05:00
|
|
|
case 'Bitcoin': return 'text-orange-400';
|
|
|
|
case 'Lightning': return 'text-blue-500';
|
|
|
|
case 'Nostr': return 'text-purple-400';
|
|
|
|
default: return 'text-white';
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-10-11 14:53:57 -05:00
|
|
|
const getHeroHeight = () => {
|
|
|
|
if (isSuperWideScreen) return 'h-[900px]';
|
|
|
|
if (isWideScreen) return 'h-[700px]';
|
|
|
|
if (isMobile) return 'h-[450px]';
|
|
|
|
return 'h-[600px]';
|
|
|
|
};
|
|
|
|
|
2024-03-17 17:32:23 -05:00
|
|
|
return (
|
2024-10-11 14:53:57 -05:00
|
|
|
<div className={`${getHeroHeight()} ${isTabView ? 'mx-0' : 'm-14'} relative flex justify-center items-center overflow-hidden drop-shadow-2xl`}>
|
2024-10-10 17:03:42 -05:00
|
|
|
<Image
|
2024-10-11 13:04:52 -05:00
|
|
|
src={HeroImage}
|
2024-10-10 17:03:42 -05:00
|
|
|
alt="Banner"
|
|
|
|
quality={100}
|
|
|
|
fill
|
2024-10-11 14:41:36 -05:00
|
|
|
style={{ objectFit: 'cover', transform: 'scaleX(-1)' }}
|
2024-10-10 17:54:34 -05:00
|
|
|
className='opacity-100 rounded-lg'
|
2024-10-10 17:03:42 -05:00
|
|
|
/>
|
2024-10-11 13:04:52 -05:00
|
|
|
<div className="absolute inset-0 bg-gradient-to-br from-black via-black/20 to-transparent rounded-lg" />
|
2024-10-11 14:41:36 -05:00
|
|
|
|
2024-10-11 13:04:52 -05:00
|
|
|
{!isTabView && (
|
2024-10-11 14:44:56 -05:00
|
|
|
<div className="absolute right-0 top-24 bottom-0 w-1/2 overflow-hidden rounded-l-lg opacity-100 p-2 rounded-lg shadow-lg mr-2">
|
2024-10-11 13:04:52 -05:00
|
|
|
<video
|
2024-10-11 14:41:36 -05:00
|
|
|
className="w-full object-cover rounded-lg shadow-lg"
|
2024-10-11 13:04:52 -05:00
|
|
|
autoPlay
|
|
|
|
loop
|
|
|
|
muted
|
|
|
|
playsInline
|
|
|
|
>
|
|
|
|
<source src="https://plebdevs-bucket.nyc3.cdn.digitaloceanspaces.com/plebdevs-montage.mp4" type="video/mp4" />
|
|
|
|
Your browser does not support the video tag.
|
|
|
|
</video>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
2024-10-12 16:53:13 -05:00
|
|
|
<div className={`absolute inset-0 flex flex-col justify-center ${isTabView ? 'items-center text-center' : 'items-start pl-8'}`}>
|
2024-10-11 16:03:43 -05:00
|
|
|
<h1 className={`text-4xl sm:text-4xl lg:text-6xl font-bold leading-tight mb-6 ${isTabView ? 'px-4' : 'max-w-[50%]'}`}>
|
2024-10-10 17:03:42 -05:00
|
|
|
<span className="block">Learn to code</span>
|
2024-10-17 16:35:08 -05:00
|
|
|
<span className="block">
|
|
|
|
Build{' '}
|
|
|
|
<span className={`${getColorClass(currentTech)} transition-opacity duration-500 ${isAnimating ? 'opacity-0' : 'opacity-100'}`}>
|
|
|
|
{currentTech}
|
|
|
|
</span>
|
|
|
|
{' '}apps
|
2024-03-17 17:32:23 -05:00
|
|
|
</span>
|
2024-10-10 17:03:42 -05:00
|
|
|
<span className="block">Become a dev</span>
|
|
|
|
</h1>
|
2024-10-10 17:54:34 -05:00
|
|
|
{isMobile ? (
|
|
|
|
<h3 className="text-[#f8f8ff] mb-8 font-semibold">
|
2024-10-12 14:03:07 -05:00
|
|
|
A one of a kind developer education, content, and community platform built on Nostr and fully Lightning integrated.
|
2024-10-10 17:54:34 -05:00
|
|
|
</h3>
|
|
|
|
) : (
|
2024-10-11 14:41:36 -05:00
|
|
|
<h2 className="text-[#f8f8ff] mb-8 font-semibold max-w-[42%]">
|
2024-10-12 14:03:07 -05:00
|
|
|
A one of a kind developer education, content, and community platform built on Nostr and fully Lightning integrated.
|
2024-10-10 17:54:34 -05:00
|
|
|
</h2>
|
|
|
|
)}
|
2024-10-11 14:41:36 -05:00
|
|
|
<div className="mb-8 flex flex-row">
|
|
|
|
<AvatarGroup>
|
2024-10-12 13:17:01 -05:00
|
|
|
<Avatar image={"https://primefaces.org/cdn/primereact/images/avatar/amyelsner.png"} size={isMobile ? "normal" : "large"} shape="circle" />
|
|
|
|
<Avatar image={"https://primefaces.org/cdn/primereact/images/avatar/asiyajavayant.png"} size={isMobile ? "normal" : "large"} shape="circle" />
|
|
|
|
<Avatar image={"https://primefaces.org/cdn/primereact/images/avatar/onyamalimba.png"} size={isMobile ? "normal" : "large"} shape="circle" />
|
|
|
|
<Avatar image={"https://primefaces.org/cdn/primereact/images/avatar/ionibowcher.png"} size={isMobile ? "normal" : "large"} shape="circle" />
|
|
|
|
<Avatar image={"https://primefaces.org/cdn/primereact/images/avatar/xuxuefeng.png"} size={isMobile ? "normal" : "large"} shape="circle" />
|
|
|
|
<Avatar label="500+" shape="circle" size={isMobile ? "normal" : "large"} className={`${isMobile ? 'text-sm' : 'text-base'}`} />
|
2024-10-11 14:41:36 -05:00
|
|
|
</AvatarGroup>
|
|
|
|
<div className="flex flex-col justify-between my-2 ml-4">
|
|
|
|
<div className="flex flex-row gap-2">
|
|
|
|
{Array.from({ length: 5 }).map((_, index) => (
|
2024-10-12 13:17:01 -05:00
|
|
|
<i key={index} className={`pi pi-star-fill text-yellow-500 ${isMobile ? 'text-base' : 'text-2xl'}`} />
|
2024-10-11 14:41:36 -05:00
|
|
|
))}
|
2024-10-12 13:17:01 -05:00
|
|
|
<p className={`text-sm ${isMobile ? 'text-base' : 'text-2xl'}`}>4.87</p>
|
2024-10-11 14:41:36 -05:00
|
|
|
</div>
|
2024-10-12 13:17:01 -05:00
|
|
|
<span className={`text-sm ${isMobile ? 'text-base' : 'text-2xl'}`}>500+ students enrolled</span>
|
2024-10-11 14:41:36 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-10-10 17:03:42 -05:00
|
|
|
<div className="space-x-4">
|
|
|
|
<GenericButton
|
|
|
|
label="Learn"
|
2024-10-11 14:41:36 -05:00
|
|
|
icon={<i className="pi pi-book pr-2 text-2xl" />}
|
2024-10-10 17:03:42 -05:00
|
|
|
rounded
|
|
|
|
severity="info"
|
2024-10-11 14:41:36 -05:00
|
|
|
className="border-2"
|
2024-10-10 17:54:34 -05:00
|
|
|
size={isMobile ? null : "large"}
|
2024-10-10 17:03:42 -05:00
|
|
|
outlined
|
|
|
|
onClick={() => router.push('/content?tag=all')}
|
|
|
|
/>
|
|
|
|
<GenericButton
|
|
|
|
label="Connect"
|
2024-10-11 14:41:36 -05:00
|
|
|
icon={<i className="pi pi-users pr-2 text-2xl" />}
|
2024-10-10 17:03:42 -05:00
|
|
|
rounded
|
2024-10-10 17:54:34 -05:00
|
|
|
size={isMobile ? null : "large"}
|
2024-10-10 17:03:42 -05:00
|
|
|
severity="success"
|
2024-10-11 14:41:36 -05:00
|
|
|
className="border-2"
|
2024-10-10 17:03:42 -05:00
|
|
|
outlined
|
|
|
|
onClick={() => router.push('/feed?channel=global')}
|
|
|
|
/>
|
|
|
|
</div>
|
2024-03-17 17:32:23 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default HeroBanner;
|