Skip to content

Commit

Permalink
refactor: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Oct 3, 2024
1 parent c66036e commit 2774938
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 deletions.
2 changes: 0 additions & 2 deletions src/home/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getGitHubUser } from "./getters/get-github-user";
import { GitHubUser } from "./github-types";
import { displayGitHubUserInformation } from "./rendering/display-github-user-information";
import { renderGitHubLoginButton } from "./rendering/render-github-login-button";
// import { viewToggle } from "./fetch-github/fetch-and-display-previews";

export async function authentication() {
const accessToken = await getGitHubAccessToken();
Expand All @@ -16,6 +15,5 @@ export async function authentication() {
if (gitHubUser) {
trackDevRelReferral(gitHubUser.login + "|" + gitHubUser.id);
await displayGitHubUserInformation(gitHubUser);
// viewToggle.disabled = false;
}
}
15 changes: 6 additions & 9 deletions src/home/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import { fetchIssuesFull } from "./fetch-github/fetch-issues-full";
import { readyToolbar } from "./ready-toolbar";
import { registerServiceWorker } from "./register-service-worker";
import { renderServiceMessage } from "./render-service-message";
// import { renderErrorInModal } from "./rendering/display-popup-modal";
import { renderErrorInModal } from "./rendering/display-popup-modal";
import { renderGitRevision } from "./rendering/render-github-login-button";
import { generateSortingToolbar } from "./sorting/generate-sorting-buttons";
import { TaskManager } from "./task-manager";

// All unhandled errors are caught and displayed in a modal
// window.addEventListener("error", (event: ErrorEvent) => renderErrorInModal(event.error));
window.addEventListener("error", (event: ErrorEvent) => renderErrorInModal(event.error));

// All unhandled promise rejections are caught and displayed in a modal
// window.addEventListener("unhandledrejection", (event: PromiseRejectionEvent) => {
// renderErrorInModal(event.reason as Error);
// event.preventDefault();
// });
window.addEventListener("unhandledrejection", (event: PromiseRejectionEvent) => {
renderErrorInModal(event.reason as Error);
event.preventDefault();
});

renderGitRevision();
initiateDevRelTracking();
Expand Down Expand Up @@ -46,8 +46,5 @@ void (async function home() {
registerServiceWorker();
}

// if (!container.childElementCount) {
// applyAvatarsToIssues();
// }
return gitHubIssues;
})();
18 changes: 0 additions & 18 deletions src/home/rendering/render-github-issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,6 @@ function everyNewIssue({ gitHubIssue, container }: { gitHubIssue: GitHubIssue; c
issueElement.setAttribute("data-issue-id", gitHubIssue.id.toString());
issueElement.classList.add("issue-element-inner");

// const urlPattern = /https:\/\/github\.com\/([^/]+)\/([^/]+)\//;
// if (!gitHubIssue.body) {
// console.warn(`No body found for issue ${gitHubIssue.id}.`);
// return;
// }
// const match = gitHubIssue.body.match(urlPattern);
// const organizationName = match?.[1];

// if (!organizationName) {
// console.warn(`No organization name found for issue ${gitHubIssue.id}.`);
// return;
// }

// const repositoryName = match?.[2];
// if (!repositoryName) {
// console.warn("No repository name found");
// return;
// }
const labels = parseAndGenerateLabels(gitHubIssue);
const [organizationName, repositoryName] = gitHubIssue.repository_url.split("/").slice(-2);
setUpIssueElement(issueElement, gitHubIssue, organizationName, repositoryName, labels, gitHubIssue.html_url);
Expand Down

0 comments on commit 2774938

Please sign in to comment.