Skip to content

Commit

Permalink
fix: change the classname and remove extra code
Browse files Browse the repository at this point in the history
  • Loading branch information
a0m0rajab committed Nov 7, 2023
1 parent 39fb06d commit 241c385
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/constants.ts
Expand Up @@ -32,8 +32,6 @@ export const OPEN_SAUCED_EMOJIS_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/emojis`;
export const GITHUB_PROFILE_MENU_SELECTOR = ".p-nickname.vcard-username.d-block";
export const GITHUB_PROFILE_EDIT_MENU_SELECTOR = "button.js-profile-editable-edit-button";
export const GITHUB_PR_COMMENT_HEADER_SELECTOR = "timeline-comment-header clearfix d-flex";
export const GITHUB_NEW_PR_COMMENT_EDITOR_SELECTOR = "flex-nowrap d-none d-md-inline-block mr-md-0 mr-3";
export const GITHUB_PR_COMMENT_EDITOR_SELECTOR = "flex-nowrap d-inline-block mr-3";
export const GITHUB_REVIEW_SUGGESTION_SELECTOR = "js-suggestion-button-placeholder";
export const GITHUB_REPO_ACTIONS_SELECTOR = ".pagehead-actions";
export const GITHUB_PR_COMMENT_TEXT_AREA_SELECTOR = "pull_request[body]";
Expand Down
6 changes: 2 additions & 4 deletions src/utils/dom-utils/addDescriptionGenerator.ts
@@ -1,6 +1,4 @@
import { DescriptionGeneratorButton } from "../../content-scripts/components/GenerateAIDescription/DescriptionGeneratorButton";
import { GITHUB_NEW_PR_COMMENT_EDITOR_SELECTOR, GITHUB_PR_COMMENT_EDITOR_SELECTOR } from "../../constants";
import { isGithubPullRequestPage } from "../urlMatchers";
import { isPublicRepository } from "../fetchGithubAPIData";
import { SettingsConfig } from "../../popup/pages/settings";

Expand All @@ -23,8 +21,8 @@ const injectDescriptionGeneratorButton = async () => {
}
}

const selector = isGithubPullRequestPage(window.location.href) ? GITHUB_PR_COMMENT_EDITOR_SELECTOR : GITHUB_NEW_PR_COMMENT_EDITOR_SELECTOR;
const commentFormatRow = document.getElementsByClassName(selector)[0];
const prActionsClassName = "ActionBar-item-container";
const commentFormatRow = document.getElementsByClassName(prActionsClassName)[0];
const addGeneratorButton = DescriptionGeneratorButton();

commentFormatRow.insertBefore(addGeneratorButton, commentFormatRow.firstChild);
Expand Down

0 comments on commit 241c385

Please sign in to comment.