Skip to content

Commit

Permalink
chore: open history and jump to latest commit
Browse files Browse the repository at this point in the history
  • Loading branch information
0xExp-po committed Sep 14, 2024
1 parent 59143de commit b3d7a9e
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions dapp/src/components/ProjectInfo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,32 @@ import ModalInput from "./utils/ModalInput.astro";
const commitIconUp = document.getElementById("commit-icon-up");
const commitIconDown = document.getElementById("commit-icon-down");

if (viewCommitHistory && viewCommitText && commitHistoryContainer && commitIconUp && commitIconDown) {
if (viewCommitHistory && commitHistoryContainer) {
viewCommitHistory.addEventListener("click", () => {
if (commitHistoryContainer.style.maxHeight === "0px" || !commitHistoryContainer.style.maxHeight) {
commitHistoryContainer.style.maxHeight = `${commitHistoryContainer.scrollHeight}px`;
} else {
commitHistoryContainer.style.maxHeight = "0px";
}
});

}

if (jumpToLatestCommit && commitHistoryContainer) {
jumpToLatestCommit.addEventListener("click", () => {
if (commitHistoryContainer.style.maxHeight === "0px" || !commitHistoryContainer.style.maxHeight) {
commitHistoryContainer.style.maxHeight = `${commitHistoryContainer.scrollHeight}px`;
} else {
setTimeout(() => {
const latestCommit = document.getElementById('latest-commit-record');
if (latestCommit) {
latestCommit.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
}, 10);
}
})
}

if (viewCommitText && commitHistoryContainer && commitIconUp && commitIconDown) {
commitHistoryContainer.addEventListener("transitionend", () => {
if (commitHistoryContainer.style.maxHeight === "0px") {
viewCommitText.textContent = "View Commit History";
Expand All @@ -346,24 +363,11 @@ import ModalInput from "./utils/ModalInput.astro";
if (latestCommit) {
latestCommit.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
}, 1000);
}, 10);
}
});
}

if (jumpToLatestCommit && commitHistoryContainer) {
jumpToLatestCommit.addEventListener("click", () => {
if (commitHistoryContainer.style.maxHeight !== "0px") {
setTimeout(() => {
const latestCommit = document.getElementById('latest-commit-record');
if (latestCommit) {
latestCommit.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
}, 1000);
}
})
}

window.addEventListener('walletConnected', (_event: Event) => {
updateUpgradeConfigButtonVisibility();
});
Expand Down

0 comments on commit b3d7a9e

Please sign in to comment.