add basis of logic

This commit is contained in:
akcodez
2024-12-03 12:37:19 -08:00
parent c69f987b55
commit acd3eefebc
7 changed files with 1214 additions and 1361 deletions

View File

@@ -0,0 +1,64 @@
name: Update Contentful Data
on:
repository_dispatch:
types: [contentful_update] # This should match the event type sent by the webhook
jobs:
update-data:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Dependencies
run: npm install
- name: Set Branch Name with Date
id: set-branch-name
run: echo "BRANCH_NAME=contentful-updates-$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_ENV
- name: Fetch Data from Contentful
env:
CONTENTFUL_SPACE_ID: ${{ secrets.CONTENTFUL_SPACE_ID }}
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
run: node scripts/fetchContentfulData.cjs
- name: Commit and Push Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Update data from Contentful'
branch: ${{ env.BRANCH_NAME }}
create_branch: true
- name: Create Pull Request
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: existingPulls } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
head: `${context.repo.owner}:${process.env.BRANCH_NAME}`,
state: 'open',
});
if (existingPulls.length === 0) {
const { data: pullRequest } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
head: process.env.BRANCH_NAME,
base: 'master',
title: 'Update data from Contentful',
body: 'Automated update of data from Contentful.',
});
console.log(`Pull request created: ${pullRequest.html_url}`);
} else {
console.log('Pull request already exists:', existingPulls[0].html_url);
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,9 +2,7 @@ import React, { useState } from "react";
import { useThemeHooks } from "@redocly/theme/core/hooks";
import moment from "moment";
import { Link } from "@redocly/theme/components/Link/Link";
const infoSession = require("../static/img/events/InfoSessions.png");
import events from "../static/JSON/events.json"
export const frontmatter = {
seo: {
title: "Community",
@@ -12,15 +10,6 @@ export const frontmatter = {
"The XRP Ledger (XRPL) is a community-driven public blockchain. Heres how you can get involved.",
},
};
const amaImage = require("../static/img/events/AMAs.png");
const hackathon = require("../static/img/events/Hackathons.png");
const conference = require("../static/img/events/Conference.png");
const zone = require("../static/img/events/XRPLZone.png");
const brazil = require("../static/img/events/event-meetup-brazil.png");
const korea = require("../static/img/events/SouthKoreaMeetup.png");
const infoSession2 = require("../static/img/events/xrpl-builder-office-hours-02.png");
const infoSession3 = require("../static/img/events/xrpl-builder-office-hours-03.png");
const infoSession4 = require("../static/img/events/xrpl-builder-office-hours-04.png");
const findNearestUpcomingEvent = (events) => {
let nearestEvent = null;
let nearestDateDiff = Infinity;
@@ -40,320 +29,7 @@ const findNearestUpcomingEvent = (events) => {
return { nearestEvent, nearestDateDiff, index };
};
const events = [
{
name: "New Horizon: Innovate Without Limits: New Horizons Await",
description:
"Join our EVM-compatible chain launch for a chance to win $50,000 in prizes! Unleash your creativity in DeFi and NFTs, with judging criteria focused on novelty, impact, and community engagement.",
type: "hackathon",
link: "https://newhorizon.devpost.com/",
location: "Virtual",
date: "October 19, 2023 - December 22, 2023",
image: hackathon,
end_date: "December 22, 2023",
start_date: "October 19, 2023",
},
{
name: "XRPL Community Report Launch Party",
description:
"Celebrate the XRPL Community Report launch at 7pm! Join blockchain enthusiasts, connect with experts, and discover opportunities in the XRP Ledger ecosystem. Limited space available, so register now for a night of celebration and networking!",
type: "meetup",
link: "https://www.eventbrite.fr/e/billets-xrpl-community-report-launch-party-753788370307",
location: "Paris, France",
date: "November 28, 7pm - 9pm",
image: require("../static/img/events/paris.png"),
end_date: "November 28, 2023",
start_date: "November 28, 2023",
},
{
name: "XRPL Grants Info Session: Decentralized Exchange (DEX) Focused",
description:
"Watch the recorded information session and Q&A on applying to XRPL Grants Wave 7. This session will provide a general overview of the XRPL Grants application for Wave 7, with a focus on Decentralized Exchange (DEX) projects.",
type: "info-session",
link: "https://www.youtube.com/watch?v=BbGu0QC5WEE",
location: "Virtual - Zoom",
date: "September 06, 2023",
image: infoSession,
end_date: "September 06, 2023",
start_date: "September 06, 2023",
},
{
name: "XRPL Developers Reddit AMA: Real World Assets",
description:
"Join us for a live chat on Reddit and learn more about how developers are building real world assets with confidence on the XRP Ledger.",
type: "ama",
link: "https://xrplresources.org/rwa-ama?utm_source=web&utm_medium=web&utm_campaign=bwc",
location: "Virtual - Reddit",
date: "October 17, 2023",
image: amaImage,
end_date: "October 17, 2023",
start_date: "October 17, 2023",
},
{
name: "XRP Ledger Zone ETHDenver",
description:
"XRPL Zone: your all-in-one location for creating and collaborating on XRP Ledger (XRPL) projects. Details coming soon!",
type: "zone",
link: "http://xrplzone-ethdenver.splashthat.com",
location: "Denver, Colorado",
date: "February 27, 2024",
image: zone,
end_date: "February 27, 2024",
start_date: "February 27, 2024",
},
{
name: "XRPL Developers Discord AMA: Apex 2024",
description:
"Join the DevRel team at Ripple to learn more about APEX 2024.",
type: "ama",
link: "https://discord.gg/gszzRTxV?event=1215341725825110089",
location: "XRPL Developers Discord",
date: "March 13, 2024 13:00 EST",
image: amaImage,
start_date: "March 13, 2024",
end_date: "March 13, 2024",
},
{
name: "Paris Blockchain Week",
description:
"Paris Blockchain Week is Europe's biggest blockchain & digital assets event that covers all aspects of blockchain technology.",
type: "conference",
link: "https://www.parisblockchainweek.com/",
location: "Paris, France",
date: "April 9 - 12, 2024",
image: conference,
end_date: "April 12, 2024",
start_date: "April 9, 2024",
},
{
name: "Consensus",
description:
"Join us at Consensus! This event is the world's largest, longest-running and most influential gathering that brings together all sides of the cryptocurrency, blockchain and Web3 community.",
type: "conference",
link: "https://consensus.coindesk.com/?utm_campaign=&utm_content=c24&utm_medium=sponsored&utm_source=XRPLEventsPage%20&utm_term=organic",
location: "Austin, Texas",
date: "May 29 - June 1, 2024",
image: conference,
end_date: "June 1, 2024",
start_date: "May 29, 2024",
},
{
name: "EasyA Ripple Hackathon",
description:
"Join the XRPL community at the Ripple x EasyA Hackathon in Amsterdam, where startups can compete for a $20,000 prize and a chance to present at the prestigious APEX Conference alongside industry leaders. Secure your spot now! ",
type: "hackathon",
link: "https://www.eventbrite.co.uk/e/easya-x-ripple-apex-hackathon-win-20000-tickets-882724261027?aff=oddtdtcreator",
location: "Amsterdam",
date: "June 8 - 9, 2024",
image: hackathon,
start_date: "June 8, 2024",
end_date: "June 9, 2024",
},
{
name: "APEX 2024: The XRPL Developer Summit",
description:
"Apex XRPL Developer Summit is the annual event where developers, contributors, and thought leaders come together to learn, build, share, network, and celebrate all things XRP Ledger.",
type: "conference",
link: "http://apexdevsummit.com",
location: "Amsterdam",
date: "June 11 - 13, 2024",
image: conference,
end_date: "June 13, 2024",
start_date: "June 11, 2024",
},
{
name: "SwissHacks",
description:
"Transform Fintech with XRPL at SwissHacks 2024! Prototype and collaborate with fellow builders to reinvent finance for a brighter future",
type: "hackathon",
link: "https://airtable.com/app61tk91vkuwKhGx/pagCN29Br8RdxTvp7/form",
location: "Zurich",
date: "June 28 - 30, 2024",
image: hackathon,
start_date: "June 28, 2024",
end_date: "June 30, 2024",
},
{
name: "XRPL Meetup Blockchain Rio",
description:
"Get ready to kick off Blockchain Rio with a bang at the XRP Ledger Dev Meetup! Hosted by the the XRP Ledger team, this warm-up event is the perfect chance for devs and builders to connect, share ideas, and get hyped for the main event. Expect a night filled with great conversations, delicious drinks, and the vibrant energy of Rio de Janeiro. Don't miss out on this fantastic opportunity to network and have a blast with fellow tech enthusiasts. See you there!",
type: "meetup",
link: "https://lu.ma/4uxpkd11",
location: "Rio de Janeiro",
date: "July 23, 2024",
image: brazil,
start_date: "July 23, 2024",
end_date: "July 23, 2024",
},
{
name: "XRPL Builder Office Hours",
description:
"XRPL Builder Office Hours is an open forum hosted monthly by Developer Advocates to answer technical and business questions from community members.",
type: "info-session",
link: "https://ripple.zoom.us/meeting/register/tJMscOCsrDoiHNUN6hZLpFVR69OcfG9rXtIA#/registration",
location: "Virtual - Zoom",
date: "August 23, 2024",
image: infoSession,
start_date: "August 23, 2024",
end_date: "August 23, 2024",
},
{
name: "XRP Ledger Hackathon Seoul 2024",
description:
"Calling all developers in Korea or attending Korea Blockchain Week! Join us for an exclusive pre-KBW meetup in Gangnam, Seoul! Be part of an exciting opportunity to collaborate with fellow builders leveraging the XRP Ledger. Dont miss this chance to connect with industry peers, explore local funding initiatives, and fuel your projects with new insights just before the main KBW event!",
type: "hackathon",
link: "https://lu.ma/1viq6evg",
location: "Seoul, South Korea",
date: "August 31 - September 1, 2024",
image: hackathon,
start_date: "August 31, 2024",
end_date: "September 1, 2024",
},
{
name: "XRPL Zone Seoul",
description:
"Join us at XRPL Zone Seoul where developers, corporates, fintechs, banks, VCs, academia, and the XRP community come together under one roof for the biggest XRPL event in South Korea!",
type: "zone",
link: "https://ripple.swoogo.com/xrpl-zone-seoul",
location: "Seongdong-su, Seoul",
date: "September 4, 2024",
image: require('../static/img/events/event-meetup-zone-day.png'),
start_date: "September 4, 2024",
end_date: "September 4, 2024",
},
{
name: "XRPL Zone Seoul After Hours",
description:
"Celebrate with the XRP Community during Korea Blockchain Week! Don't miss this opportunity to mingle with the vibrant XRP community, visionary XRPL developers, trailblazing innovators, and influential investors.",
type: "meetup",
link: "https://lu.ma/mbg067j3",
location: "Seongdong-su, Seoul",
date: "September 4, 2024",
image: require('../static/img/events/event-meetup-zone-night.png'),
start_date: "September 4, 2024",
end_date: "September 4, 2024",
},
{
name: "XRP Community Day Tokyo",
description:
"Join senior execs from Ripple, prominent Japanese institutions, and the XRP community for a day of inspiration, networking and insights.",
type: "meetup",
link: "https://events.xrplresources.org/toyko-community-2024",
location: "Shinagawa, Tokyo",
date: "September 6, 2024",
image: require('../static/img/events/event-meetup-tokyo-day.png'),
start_date: "September 6, 2024",
end_date: "September 6, 2024",
},
{
name: "XRP Community Night Tokyo",
description:
"Celebrate with the XRP Community in Tokyo! Don't miss this opportunity to mingle with the vibrant XRP community, visionary developers, trailblazing innovators, and influential VCs.",
type: "meetup",
link: "https://lu.ma/84do37p7",
location: "Shinagawa, Tokyo",
date: "September 6, 2024",
image: require('../static/img/events/event-meetup-tokyo-night.png'),
start_date: "September 6, 2024",
end_date: "September 6, 2024",
},
{
name: "Chicago XRP Ledger Meet Up",
description:
"Hey Chicago XRP Ledger community! Were hosting a meetup soon—come hang out, share ideas, and talk all things XRPL. Would love to see you there!",
type: "meetup",
link: "https://lu.ma/74dulzff",
location: "Chicago, IL",
date: "September 12, 2024",
image: require('../static/img/events/chicago-meetup.png'),
start_date: "September 12, 2024",
end_date: "September 12, 2024",
},
{
name: "San Francisco XRP Ledger Meet Up",
description:
"Hello San Francisco XRP Ledger community! We're hosting a meetup soon with a focus on ZK research. Excited to see you soon!",
type: "meetup",
link: "https://lu.ma/evdklm4r",
location: "San Francisco, California",
date: "September 26, 2024",
image: require('../static/img/events/sf-meetup.jpg'),
start_date: "September 26, 2024",
end_date: "September 26, 2024",
},
{
name: "XRPL Builder Office Hours",
description:
"XRPL Builder Office Hours is an open forum hosted monthly by Developer Advocates to answer technical and business questions from community members.",
type: "info",
link: "https://ripple.zoom.us/meeting/register/tJMscOCsrDoiHNUN6hZLpFVR69OcfG9rXtIA",
location: "Virtual - Zoom",
date: "September 27, 2024",
image: infoSession2,
start_date: "September 27, 2024",
end_date: "September 27, 2024",
},
{
name: "AI Fund - XRPL Grants Info Session",
description:
"Join our info session to learn about our new XRPL Grants' AI Fund, designed to support innovative projects that leverage artificial intelligence in the XRPL ecosystem.",
type: "info",
link: "https://ripple.zoom.us/webinar/register/WN__SNDW7LTSM29h5NIpvXFvg#/registration",
location: "Virtual - Zoom",
date: "October 2, 2024",
image: infoSession,
start_date: "October 2, 2024",
end_date: "October 2, 2024",
},
{
name: "XRPL Meetup @ Permissionless III - by xrpcafe",
description:
"Get ready for an unforgettable evening at the XRPL Meetup - Permissionless III in the heart of Salt Lake City! Join us on October 10th from 6 PM to 9 PM at the lively Squatters Pub Brewery.",
type: "meetup",
link: "https://lu.ma/71ag93un?locale=en-GB",
location: "Salt Lake City, Utah",
date: "October 10, 2024",
image: require('../static/img/events/salt-lake-city.jpg'),
start_date: "October 10, 2024",
end_date: "October 10, 2024",
},
{
name: "XRPL Builder Office Hours",
description:
"XRPL Builder Office Hours is an open forum hosted monthly by Developer Advocates to answer technical and business questions from community members.",
type: "info",
link: "https://ripple.zoom.us/meeting/register/tJMscOCsrDoiHNUN6hZLpFVR69OcfG9rXtIA",
location: "Virtual - Zoom",
date: "October 25, 2024",
image: infoSession3,
start_date: "October 25, 2024",
end_date: "October 25, 2024",
},
{
name: "XRPL Meetup NYC",
description:
"Get ready for an unforgettable evening at the XRPL Meetup NYC!",
type: "meetup",
link: "https://xrpl.at/Aquarium-XRPL-Residency-DemoDay4",
location: " New York, New York",
date: "November 19, 2024",
image: require('../static/img/events/new-york.jpeg'),
end_date: "November 19, 2024",
start_date: "November 19, 2024",
},
{
name: "XRPL Builder Office Hours",
description:
"XRPL Builder Office Hours is an open forum hosted monthly by Developer Advocates to answer technical and business questions from community members.",
type: "info",
link: "https://ripple.zoom.us/meeting/register/tJMscOCsrDoiHNUN6hZLpFVR69OcfG9rXtIA",
location: "Virtual - Zoom",
date: "November 22, 2024",
image: infoSession4,
start_date: "November 22, 2024",
end_date: "November 22, 2024",
},
];
const { nearestDateDiff, nearestEvent, index } = findNearestUpcomingEvent(events);
const XrplEventsAndCarouselSection = ({ events }) => {
const { useTranslate } = useThemeHooks();

17
package-lock.json generated
View File

@@ -1601,6 +1601,23 @@
"semver": "bin/semver.js"
}
},
"node_modules/@redocly/realm/node_modules/node-fetch": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz",
"integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==",
"dependencies": {
"data-uri-to-buffer": "^4.0.0",
"fetch-blob": "^3.1.4",
"formdata-polyfill": "^4.0.10"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/node-fetch"
}
},
"node_modules/@redocly/replay": {
"version": "0.5.18",
"resolved": "https://registry.npmjs.org/@redocly/replay/-/replay-0.5.18.tgz",

View File

@@ -0,0 +1,35 @@
const fs = require('fs');
const path = require('path');
const contentful = require('contentful');
require('dotenv').config();
const space = process.env.CONTENTFUL_SPACE_ID;
const accessToken = process.env.CONTENTFUL_ACCESS_TOKEN;
const client = contentful.createClient({
space,
accessToken,
});
async function fetchData() {
try {
const entries = await client.getEntries();
// Transform the entries into the required JSON format
const data = entries.items.map((item) => {
return {
id: item.sys.id,
...item.fields,
image: item?.fields.image?.fields?.file?.url || '',
};
});
// Write data to JSON file
const filePath = path.join(__dirname, '../static/JSON/contentful-events.json');
fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
console.log('Data fetched and written to contentful-events.json');
} catch (error) {
console.error('Error fetching data from Contentful:', error);
process.exit(1);
}
}
fetchData();

View File

@@ -0,0 +1,3 @@
[
]

1054
static/JSON/events.json Normal file

File diff suppressed because it is too large Load Diff