Skip to content

Commit

Permalink
Merge pull request ubiquity#79 from jordan-ae/highlight-on-rate-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 authored Aug 19, 2024
2 parents 9de94e8 + e886eda commit 803107b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion cypress/e2e/devpool.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ describe("DevPool", () => {
cy.get('div[id="issues-container"]').children().should("have.length", 2);
cy.get('[for="priority-bottom"]').click();
cy.get('div[id="issues-container"]').children().should("have.length", 2);
cy.get("#filters-bottom").scrollTo("right");
cy.get('[for="activity-bottom"]').should("be.visible").click();
cy.get('div[id="issues-container"]').children().should("have.length", 2);
cy.get('[for="activity-bottom"]').click();
Expand Down
15 changes: 15 additions & 0 deletions src/home/fetch-github/handle-rate-limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { Octokit } from "@octokit/rest";
import { getGitHubUser } from "../getters/get-github-user";
import { renderErrorInModal } from "../rendering/display-popup-modal";
import { rateLimitModal } from "./fetch-issues-preview";
import { gitHubLoginButton } from "../rendering/render-github-login-button";
import { preview } from "../rendering/render-preview-modal";
import { toolbar } from "../ready-toolbar";

type RateLimit = {
reset: number | null;
Expand All @@ -15,6 +18,18 @@ export async function handleRateLimit(octokit?: Octokit, error?: RequestError) {
user: false,
};

preview.classList.add("active");
document.body.classList.add("preview-active");

if (toolbar) {
toolbar.scrollTo({
left: toolbar.scrollWidth,
behavior: "smooth",
});

gitHubLoginButton?.classList.add("highlight");
}

if (error?.response?.headers["x-ratelimit-reset"]) {
rate.reset = parseInt(error.response.headers["x-ratelimit-reset"]);
}
Expand Down

0 comments on commit 803107b

Please sign in to comment.