diff --git a/CHANGELOG.md b/CHANGELOG.md index c1fbf7e7..e87d061d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ > All notable changes to this project will be documented in this file +## [1.14.2-beta.1](https://github.com/open-sauced/ai/compare/v1.14.1...v1.14.2-beta.1) (2023-11-05) + + +### 🐛 Bug Fixes + +* view on open sauced ([#278](https://github.com/open-sauced/ai/issues/278)) ([eb56300](https://github.com/open-sauced/ai/commit/eb563009c32adabede89187035aff9e46ce4f962)) + ## [1.14.1](https://github.com/open-sauced/ai/compare/v1.14.0...v1.14.1) (2023-11-01) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index a62fbf92..046d796f 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "opensauced-browser-extension", - "version": "1.14.1", + "version": "1.14.2-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "opensauced-browser-extension", - "version": "1.14.1", + "version": "1.14.2-beta.1", "dependencies": { "date-fns": "^2.30.0", "gpt-tokenizer": "^1.0.5", diff --git a/package.json b/package.json index 039530ed..123216cb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "opensauced-browser-extension", "private": true, - "version": "1.14.1", + "version": "1.14.2-beta.1", "files": [ "dist" ], diff --git a/src/constants.ts b/src/constants.ts index d264f53b..a2183cfe 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -31,8 +31,6 @@ export const OPEN_SAUCED_EMOJIS_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/emojis`; // Content-scripts selectors 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_PROFILE_USER_PROFILE_BIO_SELECTOR = ".p-note.user-profile-bio.mb-3.js-user-profile-bio.f4"; -export const GITHUB_PROFILE_USER_PROFILE_EDITABLE_AREA_SELECTOR = "js-profile-editable-area d-flex flex-column d-md-block"; 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"; diff --git a/src/content-scripts/components/ViewOnOpenSaucedButton/ViewOnOpenSaucedButton.ts b/src/content-scripts/components/ViewOnOpenSaucedButton/ViewOnOpenSaucedButton.ts index fac8aaea..8a6c0cf2 100644 --- a/src/content-scripts/components/ViewOnOpenSaucedButton/ViewOnOpenSaucedButton.ts +++ b/src/content-scripts/components/ViewOnOpenSaucedButton/ViewOnOpenSaucedButton.ts @@ -7,8 +7,7 @@ export const ViewOnOpenSaucedButton = (username: string) => { const viewOnOpenSaucedButton = createHtmlElement("a", { id: "view-on-opensauced-button", href: `https://${OPEN_SAUCED_INSIGHTS_DOMAIN}/user/${username}/contributions`, - className: - "inline-block my-4 text-black bg-gh-white dark:bg-gh-gray dark:text-white rounded-md p-2 text-sm font-semibold text-center select-none w-full border hover:shadow-button hover:no-underline", + className: "inline-block mb-2 text-black bg-gh-white dark:bg-gh-gray dark:text-white rounded-md p-2 text-sm font-semibold text-center select-none w-full border hover:shadow-button hover:no-underline", target: "_blank", rel: "noopener noreferrer", innerHTML: ` diff --git a/src/popup/components/HighlightSlide.tsx b/src/popup/components/HighlightSlide.tsx index c21592ae..f55a8764 100644 --- a/src/popup/components/HighlightSlide.tsx +++ b/src/popup/components/HighlightSlide.tsx @@ -26,7 +26,7 @@ export const HighlightSlide = ({ highlight, emojis }: HighlightSlideProps) => { async function fetchHighlightReactions () { const highlightReactionData = await getHighlightReactions(highlight.id); - const userHighlightReactionData = await getUserHighlightReactions( await getAuthToken(), highlight.id); + const userHighlightReactionData = await getUserHighlightReactions(await getAuthToken(), highlight.id); const highlightReactionsWithEmojiUrls = emojis.filter(emoji => highlightReactionData.some(highlightReaction => highlightReaction.emoji_id === emoji.id)).map(emoji => { const highlightReaction = highlightReactionData.find(highlightReaction => highlightReaction.emoji_id === emoji.id)!; @@ -69,23 +69,29 @@ export const HighlightSlide = ({ highlight, emojis }: HighlightSlideProps) => { return (
{/* fixed height, content ellipsis */} -

- - {title} - -

+ + { + + title + ? ( +

+ + {title} + +

) + : null + }
Author: @@ -158,10 +164,10 @@ export const HighlightSlide = ({ highlight, emojis }: HighlightSlideProps) => { role="menuitem" tabIndex={-1} onClick={async () => { - await addReactionToHighlight( highlight.id, emoji.id); + await addReactionToHighlight(highlight.id, emoji.id); }} onKeyDown={async () => { - await addReactionToHighlight( highlight.id, emoji.id); + await addReactionToHighlight(highlight.id, emoji.id); }} > { @@ -8,12 +7,16 @@ const injectViewOnOpenSaucedButton = (username: string) => { const viewOnOpenSaucedButton = ViewOnOpenSaucedButton(username); - const userEditableArea = document.getElementsByClassName( - GITHUB_PROFILE_USER_PROFILE_EDITABLE_AREA_SELECTOR, - ); - const editableAreaElement = userEditableArea[0]; + const editProfileButtonSelector = ".btn-block.js-profile-editable-edit-button"; + const editProfileButton = document.querySelector(editProfileButtonSelector); - editableAreaElement.parentNode?.insertBefore(viewOnOpenSaucedButton, editableAreaElement); + if (editProfileButton) { + editProfileButton.parentNode?.insertBefore(viewOnOpenSaucedButton, editProfileButton); + } else { + const callToActionButtonsArea = document.querySelector(".js-user-profile-follow-button")?.closest(".flex-order-1.flex-md-order-none"); + + callToActionButtonsArea?.insertBefore(viewOnOpenSaucedButton, callToActionButtonsArea.firstChild); + } }; export default injectViewOnOpenSaucedButton;