diff --git a/dapp/src/components/CommitHistory.jsx b/dapp/src/components/CommitHistory.jsx index edeebf5..03a21be 100644 --- a/dapp/src/components/CommitHistory.jsx +++ b/dapp/src/components/CommitHistory.jsx @@ -11,20 +11,22 @@ const CommitHistory = () => { const isProjectInfoLoaded = useStore(projectInfoLoaded); const [commitHistory, setCommitHistory] = useState([]); const [authors, setAuthors] = useState([]); + const [currentPage, setCurrentPage] = useState(1); - const fetchCommitHistory = async () => { + const fetchCommitHistory = async (page = 1) => { const projectRepoInfo = loadProjectRepoInfo(); if (projectRepoInfo?.author && projectRepoInfo?.repository) { - const history = await getCommitHistory(projectRepoInfo.author, projectRepoInfo.repository); + const history = await getCommitHistory(projectRepoInfo.author, projectRepoInfo.repository, page); setCommitHistory(history); - + setCurrentPage(page); + // Set the latest commit if (history.length > 0 && history[0].commits.length > 0) { latestCommit.set(history[0].commits[0].sha); } } }; - + const addMaintainerBadge = () => { const configData = loadConfigData(); if (configData.authorGithubNames && configData.authorGithubNames.length > 0) { @@ -47,31 +49,71 @@ const CommitHistory = () => { }, [isProjectInfoLoaded]); return ( -
- {commitHistory.map((day) => ( -
-

-
- {formatDate(day.date)} -

-
- {day.commits.map((commit) => ( -
- -
- ))} + <> +
+ {commitHistory.map((day) => ( +
+

+
+ {formatDate(day.date)} +

+
+ {day.commits.map((commit) => ( +
+ +
+ ))} +
-
- ))} -
+ ))} +
+ + {/* Pagination */} +
+ + + {currentPage > 2 && ...} + {currentPage !== 1 && ( + + )} + +
+ ); }; diff --git a/dapp/src/components/ConnectWallet.astro b/dapp/src/components/ConnectWallet.astro index 543f75d..c1d939d 100644 --- a/dapp/src/components/ConnectWallet.astro +++ b/dapp/src/components/ConnectWallet.astro @@ -4,9 +4,10 @@