import Image from "next/image"
import { useState } from "react"
import { useImageProxy } from "@/hooks/useImageProxy"
import GenericButton from "@/components/buttons/GenericButton"
import { useRouter } from "next/router"
import useWindowWidth from "@/hooks/useWindowWidth"
// With current spacing the title can only be 1 line
const promotions = [
{
id: 1,
category: "PLEBDEVS",
title: "Developer education & community platform",
description: "PlebDevs is your gateway to mastering Bitcoin, Lightning, and Nostr technologies. Join our community of aspiring developers and start your journey today!",
icon: "pi pi-code",
image: "https://media.istockphoto.com/id/537331500/photo/programming-code-abstract-technology-background-of-software-deve.jpg?s=612x612&w=0&k=20&c=jlYes8ZfnCmD0lLn-vKvzQoKXrWaEcVypHnB5MuO-g8=",
},
{
id: 2,
category: "COURSES",
title: "Structured learning paths for new devs",
description: "Dive into our comprehensive courses covering Bitcoin protocol, Lightning Network, and Nostr. From basics to advanced topics, we've got you covered.",
icon: "pi pi-book",
image: "https://media.istockphoto.com/id/1224500457/photo/programming-code-abstract-technology-background-of-software-developer-and-computer-script.jpg?s=612x612&w=0&k=20&c=nHMypkMTU1HUUW85Zt0Ff7MDbq17n0eVeXaoM9Knt4Q=",
},
{
id: 3,
category: "WORKSHOPS",
title: "Hands-on Video Workshops",
description: "Watch and learn with our interactive video workshops. Get practical experience building real Bitcoin and Lightning applications.",
icon: "pi pi-video",
image: "https://newsroom.siliconslopes.com/content/images/2018/10/code.jpg",
},
{
id: 4,
category: "RESOURCES",
title: "In-depth Resources and Documentation",
description: "Access our extensive library of resources, including guides, documentation, and best practices for Bitcoin development.",
icon: "pi pi-file",
image: "https://img.freepik.com/free-photo/programming-background-with-person-working-with-codes-computer_23-2150010125.jpg",
},
{
id: 5,
category: "COMMUNITY",
title: "Join Our Community",
description: "Connect with other developers, share your projects, and get support from our community of Bitcoin enthusiasts.",
icon: "pi pi-users",
image: "https://pikwizard.com/pw/medium/50238b1cad4ff412fdafc1325efa1c9f.jpg",
},
{
id: 6,
category: "LIGHTNING / NOSTR",
title: "Lightning and Nostr integrated",
description: "This platform is the first of its kind to integrate Lightning Network and Nostr protocols, allowing users to send and receive payments and interact with the Nostr network.",
icon: "pi pi-bolt",
image: "https://www.financemagnates.com/wp-content/uploads/2016/05/Bicoin-lightning.jpg",
},
]
const InteractivePromotionalCarousel = () => {
const [selectedPromotion, setSelectedPromotion] = useState(promotions[0])
const { returnImageProxy } = useImageProxy();
const windowWidth = useWindowWidth();
const isMobileView = windowWidth <= 1360;
const router = useRouter();
return (
{isMobileView ? (
{selectedPromotion.category}
{selectedPromotion.title}
{selectedPromotion.description}
{
(() => {
switch (selectedPromotion.category) {
case "PLEBDEVS":
return (
<>
router.push('/about')} severity="success" icon={} label="Learn More" className="w-fit py-2 font-semibold" size="small" outlined />
router.push('/subscribe')} severity="warning" icon={} label="Subscribe" className="w-fit py-2 font-semibold" size="small" outlined />
router.push('/content?tag=all')} severity="primary" icon={} label="View all content" className="w-fit py-2 font-semibold" size="small" outlined />
>
);
case "COURSES":
return (
router.push('/content?tag=courses')} icon={} label="View All Courses" className="w-fit py-2 font-semibold" size="small" outlined />
);
case "WORKSHOPS":
return (
router.push('/content?tag=workshops')} icon={} label="View All Workshops" className="w-fit py-2 font-semibold" size="small" outlined />
);
case "RESOURCES":
return (
router.push('/content?tag=resources')} icon={} label="View All Resources" className="w-fit py-2 font-semibold" size="small" outlined />
);
case "COMMUNITY":
return (
router.push('/feed?channel=global')} icon={} label="Open Community Feed" className="w-fit py-2 font-semibold" size="small" outlined />
);
case "LIGHTNING / NOSTR":
return (
router.push('/subscribe')} severity="warning" icon={} label="Subscribe" className="w-fit py-2 font-semibold" size="small" outlined />
);
default:
return null;
}
})()
}
) : (
<>
{selectedPromotion.category}
{selectedPromotion.title}
{selectedPromotion.description}
{
(() => {
switch (selectedPromotion.category) {
case "PLEBDEVS":
return (
<>
router.push('/about')} severity="success" icon={} label="Learn More" className="py-2 font-semibold" size="small" outlined />
router.push('/subscribe')} severity="warning" icon={} label="Subscribe" className="py-2 font-semibold" size="small" outlined />
router.push('/content?tag=all')} severity="primary" icon={} label="View all content" className="py-2 font-semibold" size="small" outlined />
>
);
case "COURSES":
return (
router.push('/content?tag=courses')} icon={} label="View All Courses" className="py-2 font-semibold" size="small" outlined />
);
case "WORKSHOPS":
return (
router.push('/content?tag=workshops')} icon={} label="View All Workshops" className="py-2 font-semibold" size="small" outlined />
);
case "RESOURCES":
return (
router.push('/content?tag=resources')} icon={} label="View All Resources" className="py-2 font-semibold" size="small" outlined />
);
case "COMMUNITY":
return (
router.push('/feed?channel=global')} icon={} label="Open Community Feed" className="py-2 font-semibold" size="small" outlined />
);
case "LIGHTNING / NOSTR":
return (
router.push('/subscribe')} severity="warning" icon={} label="Subscribe" className="py-2 font-semibold" size="small" outlined />
);
default:
return null;
}
})()
}
>
)}
{isMobileView ? (
{promotions.map((promo) => (
setSelectedPromotion(promo)}>
{promo.title}
))}
) : (
promotions.map((promo) => (
setSelectedPromotion(promo)}>
{promo.title}
))
)}
);
}
export default InteractivePromotionalCarousel;