diff --git a/components/nav.tsx b/components/nav.tsx index 256784d..c103a75 100644 --- a/components/nav.tsx +++ b/components/nav.tsx @@ -129,6 +129,9 @@ const Nav = () => { Issues + + Summaries +
{latestTag}
diff --git a/pages/api/issues.js b/pages/api/issues.js index 47a5e1e..02ab06e 100644 --- a/pages/api/issues.js +++ b/pages/api/issues.js @@ -6,14 +6,16 @@ export default async function handler(req, res) { const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }); try { - const response = await octokit.rest.issues.listForRepo({ + const issues = await octokit.paginate(octokit.rest.issues.listForRepo, { owner: 'SingularityNET-Archive', repo: 'archive-oracle', state: 'all', + per_page: 100, // Adjust per_page to your needs }); - res.status(200).json(response.data); + res.status(200).json(issues); } catch (error) { + console.error("Failed to fetch issues:", error); res.status(500).json({ error: error.message }); } } diff --git a/pages/status-of-summaries.tsx b/pages/status-of-summaries.tsx new file mode 100644 index 0000000..7f561f0 --- /dev/null +++ b/pages/status-of-summaries.tsx @@ -0,0 +1,101 @@ +import { useState, useEffect } from "react"; +import type { NextPage } from "next"; +import { fetchIssues } from '../utils/fetchIssues'; +import styles from '../styles/issues.module.css'; + +interface Issue { + id: number; + title: string; + html_url: string; + state: string; +} + +const StatusOfSummaries: NextPage = () => { + const [loading, setLoading] = useState(false); + const [openIssues, setOpenIssues] = useState([]); + const [closedIssues, setClosedIssues] = useState([]); + + const newIssueUrl = `https://github.com/SingularityNET-Archive/archive-oracle/issues/new?assignees=Andre-Diamond&labels=tool-issue&projects=SingularityNET-Archive%2F3&template=testing_issue.yml&title=%2AEnter+title+here%2A+-+%5BDate%3A+${getCurrentFormattedDate()}%5D`; + + async function getIssues() { + setLoading(true); + const issues = await fetchIssues(); + console.log(issues) + const open = issues.filter((issue: Issue) => issue.state === 'open'); + const closed = issues.filter((issue: Issue) => issue.state === 'closed'); + setOpenIssues(open); + setClosedIssues(closed); + setLoading(false); + } + + useEffect(() => { + getIssues() + }, []); + + function getCurrentFormattedDate() { + const today = new Date(); + const yyyy = today.getFullYear().toString(); + let mm = (today.getMonth() + 1).toString(); // January is 0! + let dd = today.getDate().toString(); + + if (dd.length < 2) dd = '0' + dd; + if (mm.length < 2) mm = '0' + mm; + + return yyyy + '-' + mm + '-' + dd; + } + + return ( +
+

Issues

+ + + +
+ + {/* Open Issues Table */} + + + + + + + + {openIssues.map(issue => ( + + + + ))} + +
Open Issues
+ + {issue.title} + +
+ + {/* Closed Issues Table */} + + + + + + + + {closedIssues.map(issue => ( + + + + ))} + +
Closed Issues
+ + {issue.title} + +
+ +
+
+ ); + +}; + +export default StatusOfSummaries; \ No newline at end of file