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 ( + + +