Skip to content

Commit

Permalink
chore: add jump to latest commit button
Browse files Browse the repository at this point in the history
  • Loading branch information
0xExp-po committed Sep 13, 2024
1 parent f7a0f1b commit d5d97f5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dapp/src/components/ProjectInfo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ import ModalInput from "./utils/ModalInput.astro";
</svg>
<span>View Project Info</span>
</div>
<div id="jump-to-latest-commit" class="flex items-center space-x-2 cursor-pointer hover:bg-zinc-300 transition-colors duration-300 rounded-lg px-2 py-1">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-8.707l-3-3a1 1 0 00-1.414 1.414L10.586 9H7a1 1 0 100 2h3.586l-1.293 1.293a1 1 0 101.414 1.414l3-3a1 1 0 000-1.414z" clip-rule="evenodd" />
</svg>
<span>Jump to Latest Verified Commit</span>
</div>
</div>
</div>
<div id="commit-history-container" class="mt-4 overflow-hidden transition-all duration-300 max-h-0">
Expand Down Expand Up @@ -311,6 +317,7 @@ import ModalInput from "./utils/ModalInput.astro";
}

const viewCommitHistory = document.getElementById("view-commit-history");
const jumpToLatestCommit = document.getElementById("jump-to-latest-commit");
const viewCommitText = document.getElementById("view-commit-text");
const commitHistoryContainer = document.getElementById("commit-history-container");
const commitIconUp = document.getElementById("commit-icon-up");
Expand Down Expand Up @@ -344,6 +351,19 @@ import ModalInput from "./utils/ModalInput.astro";
});
}

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 d5d97f5

Please sign in to comment.