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';
|
2025-01-11 18:27:29 -06:00
|
|
|
import { signIn, useSession } from 'next-auth/react';
|
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();
|
2025-01-11 18:27:29 -06:00
|
|
|
const { data: session } = useSession();
|
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]';
|
|
|
|
};
|
|
|
|
|
2025-01-11 18:27:29 -06:00
|
|
|
const handleLearnToCode = async () => {
|
|
|
|
const starterCourseUrl = '/course/naddr1qvzqqqr4xspzpueu32tp0jc47uzlcuxdgcw06m40ytu7ynpna2adnqty3e0vda6pqy88wumn8ghj7mn0wvhxcmmv9uq32amnwvaz7tmjv4kxz7fwv3sk6atn9e5k7tcpr9mhxue69uhhyetvv9ujuumwdae8gtnnda3kjctv9uq3wamnwvaz7tmjv4kxz7fwdehhxarj9e3xzmny9uq36amnwvaz7tmjv4kxz7fwd46hg6tw09mkzmrvv46zucm0d5hsz9mhwden5te0wfjkccte9ec8y6tdv9kzumn9wshszynhwden5te0dehhxarjxgcjucm0d5hszynhwden5te0dehhxarjw4jjucm0d5hsz9nhwden5te0wp6hyurvv4ex2mrp0yhxxmmd9uq3wamnwvaz7tmjv4kxz7fwv3jhvueww3hk7mrn9uqzge34xvuxvdtrx5knzcfhxgkngwpsxsknsetzxyknxe3sx43k2cfkxsurwdq68epwa?active=starter';
|
|
|
|
|
|
|
|
// If user is already signed in, redirect directly
|
|
|
|
if (session?.user) {
|
|
|
|
router.push(starterCourseUrl);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for stored keys
|
|
|
|
const storedPubkey = localStorage.getItem('anonymousPubkey');
|
|
|
|
const storedPrivkey = localStorage.getItem('anonymousPrivkey');
|
|
|
|
|
|
|
|
if (storedPubkey && storedPrivkey) {
|
|
|
|
// Sign in with stored keys
|
|
|
|
const result = await signIn('anonymous', {
|
|
|
|
pubkey: storedPubkey,
|
|
|
|
privkey: storedPrivkey,
|
|
|
|
redirect: false,
|
|
|
|
callbackUrl: starterCourseUrl
|
|
|
|
});
|
|
|
|
|
|
|
|
if (result?.ok) {
|
|
|
|
router.push(starterCourseUrl);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Proceed with anonymous sign in
|
|
|
|
signIn('anonymous', {
|
|
|
|
callbackUrl: starterCourseUrl,
|
|
|
|
redirect: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
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-11-04 13:31:34 -06:00
|
|
|
style={{ objectFit: 'cover', transform: 'scaleX(-1)', filter: isTabView ? 'blur(1px)' : 'blur(3px)' }}
|
|
|
|
className='opacity-90 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" />
|
2025-01-08 15:33:29 -06:00
|
|
|
<source src="https://plebdevs-bucket.nyc3.cdn.digitaloceanspaces.com/plebdevs-montage.webm" type="video/webm" />
|
2024-10-11 13:04:52 -05:00
|
|
|
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-11-04 12:55:53 -06:00
|
|
|
<span className={`block ${isTabView ? `transition-opacity duration-500 ${isAnimating ? 'opacity-0' : 'opacity-100'}` : ''}`}>
|
2024-11-04 12:52:18 -06:00
|
|
|
Build on{' '}
|
2024-11-04 12:55:53 -06:00
|
|
|
<span className={`${getColorClass(currentTech)} ${!isTabView ? `transition-opacity duration-500 ${isAnimating ? 'opacity-0' : 'opacity-100'}` : ''}`}>
|
2024-10-17 16:35:08 -05:00
|
|
|
{currentTech}
|
|
|
|
</span>
|
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-11-05 09:18:26 -06:00
|
|
|
<div
|
|
|
|
className="mb-8 flex flex-row hover:opacity-70 cursor-pointer"
|
2024-11-06 15:54:11 -06:00
|
|
|
onClick={() => !isMobile && window.open('https://www.udemy.com/user/austin-james-kelsay/', '_blank')}
|
|
|
|
style={{ cursor: isMobile ? 'default' : 'pointer' }}
|
2024-11-05 09:18:26 -06:00
|
|
|
>
|
2024-10-11 14:41:36 -05:00
|
|
|
<AvatarGroup>
|
2024-10-18 14:38:44 -05:00
|
|
|
<Avatar image={"https://pbs.twimg.com/profile_images/1674493492519751680/wxuiYCJA_400x400.jpg"} size={isMobile ? "normal" : "large"} shape="circle" />
|
|
|
|
<Avatar image={"https://cdn.discordapp.com/avatars/823623334582681610/a19c596166584d2f51e444103255336d.png?size=1024"} size={isMobile ? "normal" : "large"} shape="circle" />
|
|
|
|
<Avatar image={"https://pbs.twimg.com/profile_images/1724533572537880576/WBcctRHT_400x400.jpg"} size={isMobile ? "normal" : "large"} shape="circle" />
|
|
|
|
<Avatar image={"https://cdn.discordapp.com/avatars/850975720872214578/37b3790a77e5c848d9489c2649420aa9.png?size=1024"} size={isMobile ? "normal" : "large"} shape="circle" />
|
|
|
|
<Avatar image={"https://i.nostr.build/BksqZ8QSHxr9FGj2.webp"} size={isMobile ? "normal" : "large"} shape="circle" />
|
2024-10-12 13:17:01 -05:00
|
|
|
<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
|
2025-01-11 18:27:29 -06:00
|
|
|
label="Learn To Code"
|
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
|
2025-01-11 18:27:29 -06:00
|
|
|
onClick={handleLearnToCode}
|
2024-10-10 17:03:42 -05:00
|
|
|
/>
|
|
|
|
<GenericButton
|
2024-12-11 11:23:14 -06:00
|
|
|
label="Level Up"
|
2025-01-03 09:45:51 -06:00
|
|
|
icon={<i className="pi pi-video 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
|
2024-12-11 11:23:14 -06:00
|
|
|
onClick={() => router.push('/content?tag=all')}
|
2024-10-10 17:03:42 -05:00
|
|
|
/>
|
|
|
|
</div>
|
2024-03-17 17:32:23 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default HeroBanner;
|