import React, { useState, useEffect } from "react"; import moment from "moment"; import { useThemeHooks } from "@redocly/theme/core/hooks"; import allEvents from "../static/JSON/events.json"; import { Link } from "@redocly/theme/components/Link/Link"; const findNearestUpcomingEvent = (events) => { let nearestEvent = null; let nearestDateDiff = Infinity; let index = 0; events.forEach((event, i) => { const eventStartDate = moment(event.start_date, "MMMM DD, YYYY"); const currentDate = moment(); const diff = eventStartDate.diff(currentDate, "days"); if (diff >= 0 && diff < nearestDateDiff) { nearestEvent = event; nearestDateDiff = diff; index = i; } }); return { nearestEvent, nearestDateDiff, index }; }; const XrplEventsAndCarouselSection = ({ events }) => { const { useTranslate } = useThemeHooks(); const { translate } = useTranslate(); // State variables for the nearest event const [nearestEventInfo, setNearestEventInfo] = useState({ nearestEvent: null, nearestDateDiff: null, index: 0, }); // State for the current index in the carousel const [currentIndex, setCurrentIndex] = useState(0); useEffect(() => { const { nearestEvent, nearestDateDiff, index } = findNearestUpcomingEvent(events); setNearestEventInfo({ nearestEvent, nearestDateDiff, index }); setCurrentIndex(index); }, [events]); const updateCarousel = () => { const prevEvent = events[currentIndex - 1] || null; const currentEvent = events[currentIndex]; const nextEvent = events[currentIndex + 1] || null; return { prevEvent, currentEvent, nextEvent, }; }; const handlePrev = () => { if (currentIndex > 0) { setCurrentIndex((prevIndex) => prevIndex - 1); } }; const handleNext = () => { if (currentIndex < events.length - 1) { setCurrentIndex((prevIndex) => prevIndex + 1); } }; const { prevEvent, currentEvent, nextEvent } = updateCarousel(); return ( <>
{translate("XRPL Events")}

{translate( "community.index.event.h4part1", "Check out global events hosted " )}
{translate( "community.index.event.h4part2", "by the XRPL community" )}

{translate( "Meet the XRPL community at meetups, hackathons, blockchain conferences, and more across global regions." )}

{translate("View All Events")}
{!!nearestEventInfo.nearestEvent && (

{translate("UPCOMING EVENT")}

{nearestEventInfo.nearestDateDiff}
{translate("days")}
{translate(nearestEventInfo.nearestEvent?.name)}

{nearestEventInfo.nearestEvent?.date}

{nearestEventInfo.nearestEvent?.location}

)} {translate("View All Events")}
Left Event Image
Featured Event Image currentEvent && window.open(currentEvent.link, "_blank") } />
{currentEvent ? currentEvent.name : ""}
{currentEvent ? currentEvent.location : ""}
{currentEvent ? currentEvent.date : ""}
Right Event Image
); }; const CommunityPage: React.FC = () => { const events = allEvents.filter((event) => event.community) const { useTranslate } = useThemeHooks(); const { translate } = useTranslate(); return (
{/* Community Heading Section */}
People sitting at a conference Person speaking at a conference Person sitting and speaking People chatting Person speaking at Apex
Down Arrow

{translate("community.index.h1part1", "A Global Blockchain")}
{translate("community.index.h1part2", "Community of ")} {translate("community.index.h1part3", "Builders")}
{translate("community.index.h1part4", "and Innovators")}

{translate("XRPL Community")}
{/* Community Table Section */}
{translate("Join the Conversation")}

{translate("Hot Topics Happening Now")}

discord icon {translate( "AMA with Edge Wallet: Learn more about Edge Wallet and how they are building on the XRP Ledger." )}
twitter icon {translate( "Clawback: A newly proposed feature that adds to the XRP Ledger's token asset control capabilities." )}
youtube icon {translate( "APEX 2023: View keynote sessions from the annual developer summit where developers, contributors, and thought leaders come together to learn, build, and celebrate all things XRP Ledger." )}
xrpl icon {translate( "Deep Dive into XRPL DeFi Course: Learn about the inner workings of decentralized finance including safety and security, auto-bridging, pathfinding, liquidity pools, and more." )}
{/* XRPL Events Carousel Section */} {/* Community Funding Section */}
{translate("Get Funding")}
{translate("funding been awarded")}
$ 13 M+
{translate("teams awarded globally")}
120+
{translate("countries represented")}
28+
{translate("XRPL Developer Funding")}

{translate("Funding Opportunities for Blockchain Businesses")}

{translate( "If you're a software developer or team looking to build your next blockchain business on the XRP Ledger (XRPL), numerous funding opportunities like grants and hackathons await your innovation." )}

{translate("Get Funding")}
{/* Community Spotlight Wrapper */}
{translate("XRPL Community Spotlight")}

{translate( "Showcase your blockchain project, application, or product" )}

{translate( "Get featured on the Developer Reflections blog or Ecosystem page, and amplify your innovation within the blockchain community." )}

{translate("Submit Your Project")}
Blockdaemon
Blockdaemon

{translate( "Your go-to independent blockchain infrastructure provider, offering secure and scalable blockchain services, including wallets, nodes, staking, protocols, and integrations for developers and institutions alike." )}

{translate("View Project")}
XRPCafe
XRPCafe

{translate( "A premier NFT marketplace dedicated to fostering mass adoption of the XRP Ledger." )}

{translate("View Project")}
{/* Bottom Cards Section 2 cards */}
Top Right Image
{translate("RippleX Bug Bounty Program")}
{translate("Contribute to the XRP Ledger's")}
Security

{translate( "RippleX’s Bug Bounty, part of Ripple's 1 Billion XRP pledge, strengthens XRP Ledger security and supports its ecosystem." )}

{translate( "Use this program to report bugs in RippleX/rippled. Send a detailed report of a qualifying bug to " )} bugs@ripple.com {translate(" and use the ")} Public Key.

{translate("Learn more")}
Bottom Right Image
{translate("Report a Scam")}
{translate("Report Scams to Safeguard Our Community")}

{translate( "In an evolving industry where trust and security are critical, scams continue to impede progress in crypto and blockchain. Help mitigate scammers by reporting scams." )}

{translate("Report a Scam")}
{" "} {/* Bottom Cards Section */}
Top Left Image
{translate("Contribute to Consensus")}
{translate("Run an XRP Ledger network node")}

{translate( "Thank you for your interest in contributing to XRP Ledger." )}

{translate("Networks and Servers")} {translate("Join UNL")} {translate("Install & Configure")} {translate("Troubleshooting")}
Bottom Right Image
{translate("XRPL Careers")}
{translate( "Discover your next career opportunity in the XRPL community" )}

{translate( "Teams across the XRPL community are looking for talented individuals to help build their next innovation." )}

Top Right Image
{translate("Contribute to XRPL.org")}
{translate( "A Community-Driven Resource for All Things XRP Ledger" )}

{translate( "Contribute to XRPL.org, the go-to resource for XRP Ledger. This open-source portal welcomes contributions from anyone for suggested changes." )}

{translate("Read Contributor Guidelines")}
{" "}
); }; export default CommunityPage;