Skip to content

Commit

Permalink
chore: refactor the code
Browse files Browse the repository at this point in the history
  • Loading branch information
a0m0rajab committed Nov 9, 2023
1 parent 50486f1 commit 22a7a6d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/utils/dom-utils/addDescriptionGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ const injectDescriptionGeneratorButton = async () => {
}
}

const prActionsClassName = "ActionBar-item-container";
const actionBars = document.getElementsByClassName(prActionsClassName);
const actionBarsArray = Array.from(actionBars);
const addGeneratorButton = DescriptionGeneratorButton();
const firstPrDescription = actionBarsArray[0];
const firstPrDescription = document.querySelector(".ActionBar-item-container");

if (firstPrDescription && !firstPrDescription.querySelector("#ai-description-button")) {
const addGeneratorButton = DescriptionGeneratorButton();

if (!firstPrDescription.querySelector("#ai-description-button")) {
firstPrDescription.insertBefore(addGeneratorButton, firstPrDescription.firstChild);
}
};
Expand Down

0 comments on commit 22a7a6d

Please sign in to comment.