From 393bae3e2fd0b3e936bd6177bc1ad7653af6b71b Mon Sep 17 00:00:00 2001 From: 0xExp-po <153439271+0xExp-po@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:26:56 +0200 Subject: [PATCH] project page update (#48) * chore: update modal style * feat: add function to get toml file hash * chore: update demo data * feat: add check project in on-chain * feat: add pagination to commit history * chore: put pagination out from scroll area * chore: add docs link to tansu.toml description * fix: keep wallet connection --- dapp/src/components/CommitHistory.jsx | 98 +++++++++++++------ dapp/src/components/ConnectWallet.astro | 3 +- dapp/src/components/stellar-wallets-kit.ts | 10 +- .../src/components/utils/ProjectInfoModal.jsx | 2 +- dapp/src/service/GithubService.ts | 2 +- 5 files changed, 83 insertions(+), 32 deletions(-) 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 ( -