From 65d3c5b6d28d97a1b32aaf451548537d73627386 Mon Sep 17 00:00:00 2001 From: Lorimer Jenkins <90644448+LorimerJenkins@users.noreply.github.com> Date: Mon, 16 Oct 2023 19:18:16 +0100 Subject: [PATCH] feat: Fair AI plugin --- src/pages/plugins/Fair-Protocol.tsx | 258 ++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 src/pages/plugins/Fair-Protocol.tsx diff --git a/src/pages/plugins/Fair-Protocol.tsx b/src/pages/plugins/Fair-Protocol.tsx new file mode 100644 index 0000000..27f3266 --- /dev/null +++ b/src/pages/plugins/Fair-Protocol.tsx @@ -0,0 +1,258 @@ +import React, { useState, useEffect } from 'react'; +import axios from 'axios'; +import styled from 'styled-components'; +import { FaCodeBranch, FaClock, FaRegEye, FaLaptopCode, FaUserFriends, FaGithub, FaClipboard, FaRegAngry, FaStar, FaExternalLinkAlt } from 'react-icons/fa'; +import ReactMarkdown from 'react-markdown'; +import Nav from "../../components/Nav"; +import Head from "../../components/Head"; +import Footer from "~/components/Footer"; +import plugInList from '../../components/plugIn/plugIns.json'; + +function HumanReadableDate(timestamp: any) { + const date = new Date(timestamp); + return date.toLocaleString(); +} + +export default function Hero() { + const packageName = 'Fair-Protocol'; + const NpmName = '@fair-protocol/sdk'; + const [githubData, setGithubData] = useState(null); + const [readme, setReadme] = useState(null); + const packageData = plugInList.find(pkg => pkg.name === packageName); + + useEffect(() => { + async function fetchData() { + if (!packageData) return; + try { + const response = await axios.get('https://api.github.com/repos/' + packageData.githubRepo); + setGithubData(response.data); + const readmeResponse = await axios.get(`https://api.github.com/repos/${packageData.githubRepo}/readme`); + const readmeContent = atob(readmeResponse.data.content); + setReadme(readmeContent); + } catch (error) { + console.error("Error fetching data:", error); + } + } + fetchData(); + }, [packageName, packageData]); + + if (!packageData) return
Plugin not found
; + + return ( + + +