Skip to content

Commit

Permalink
feat: trigger refresh with 'r'
Browse files Browse the repository at this point in the history
This will not update the GUI, which results in poor UX. It's still nice
to not having to grab the mouse, just to click the refresh button.
  • Loading branch information
chelmertz committed Nov 13, 2024
1 parent 5729ee0 commit 4729937
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/server/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ <h2>Keyboard shortcuts</h2>
<li><kbd>b</kbd> - bury (or unbury) PR, pushing the PR down to the latest prio available</li>
<li><kbd>enter</kbd> - open focused PR in Github, in a new window</li>
<li><kbd>shift + enter</kbd> - open all PRs in Github, in new windows (might trigger a browser warning)</li>
<li><kbd>r</kbd> - trigger a refresh</li>
<li><kbd>?</kbd> - show this dialog</li>
<li><kbd>esc</kbd> - hide this dialog</li>
</ul>
Expand Down Expand Up @@ -269,8 +270,9 @@ <h2>Keyboard shortcuts</h2>
dialog.showModal();
});

const refreshElement = document.querySelector("a.refresh");
let isRefreshing = false;
document.querySelector("a.refresh").addEventListener("click", (e) => {
refreshElement.addEventListener("click", (e) => {
if (!isRefreshing) {
isRefreshing = true;
fetch(e.currentTarget.href, {method: 'POST'}).then((response) => {
Expand Down Expand Up @@ -346,6 +348,8 @@ <h2>Keyboard shortcuts</h2>
const buryUrl = prs[activePr].querySelector("a.bury").href;
bury(buryUrl);
e.preventDefault();
} else if (e.key === "r") {
refreshElement.click();
} else if (e.key === "?") {
dialog.showModal();
} else if (e.key === "Enter") {
Expand Down

0 comments on commit 4729937

Please sign in to comment.