Skip to content

Commit ca6cd55

Browse files
authored
Merge pull request #280 from open-sauced/beta
main <- v1.14.2-beta.1
2 parents 9dc2c1d + d563034 commit ca6cd55

File tree

7 files changed

+46
-33
lines changed

7 files changed

+46
-33
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55

66
> All notable changes to this project will be documented in this file
77
8+
## [1.14.2-beta.1](https://github.com/open-sauced/ai/compare/v1.14.1...v1.14.2-beta.1) (2023-11-05)
9+
10+
11+
### 🐛 Bug Fixes
12+
13+
* view on open sauced ([#278](https://github.com/open-sauced/ai/issues/278)) ([eb56300](https://github.com/open-sauced/ai/commit/eb563009c32adabede89187035aff9e46ce4f962))
14+
815
## [1.14.1](https://github.com/open-sauced/ai/compare/v1.14.0...v1.14.1) (2023-11-01)
916

1017

npm-shrinkwrap.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "opensauced-browser-extension",
33
"private": true,
4-
"version": "1.14.1",
4+
"version": "1.14.2-beta.1",
55
"files": [
66
"dist"
77
],

src/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export const OPEN_SAUCED_EMOJIS_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/emojis`;
3131
// Content-scripts selectors
3232
export const GITHUB_PROFILE_MENU_SELECTOR = ".p-nickname.vcard-username.d-block";
3333
export const GITHUB_PROFILE_EDIT_MENU_SELECTOR = "button.js-profile-editable-edit-button";
34-
export const GITHUB_PROFILE_USER_PROFILE_BIO_SELECTOR = ".p-note.user-profile-bio.mb-3.js-user-profile-bio.f4";
35-
export const GITHUB_PROFILE_USER_PROFILE_EDITABLE_AREA_SELECTOR = "js-profile-editable-area d-flex flex-column d-md-block";
3634
export const GITHUB_PR_COMMENT_HEADER_SELECTOR = "timeline-comment-header clearfix d-flex";
3735
export const GITHUB_NEW_PR_COMMENT_EDITOR_SELECTOR = "flex-nowrap d-none d-md-inline-block mr-md-0 mr-3";
3836
export const GITHUB_PR_COMMENT_EDITOR_SELECTOR = "flex-nowrap d-inline-block mr-3";

src/content-scripts/components/ViewOnOpenSaucedButton/ViewOnOpenSaucedButton.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ export const ViewOnOpenSaucedButton = (username: string) => {
77
const viewOnOpenSaucedButton = createHtmlElement("a", {
88
id: "view-on-opensauced-button",
99
href: `https://${OPEN_SAUCED_INSIGHTS_DOMAIN}/user/${username}/contributions`,
10-
className:
11-
"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",
10+
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",
1211
target: "_blank",
1312
rel: "noopener noreferrer",
1413
innerHTML: `

src/popup/components/HighlightSlide.tsx

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const HighlightSlide = ({ highlight, emojis }: HighlightSlideProps) => {
2626

2727
async function fetchHighlightReactions () {
2828
const highlightReactionData = await getHighlightReactions(highlight.id);
29-
const userHighlightReactionData = await getUserHighlightReactions( await getAuthToken(), highlight.id);
29+
const userHighlightReactionData = await getUserHighlightReactions(await getAuthToken(), highlight.id);
3030

3131
const highlightReactionsWithEmojiUrls = emojis.filter(emoji => highlightReactionData.some(highlightReaction => highlightReaction.emoji_id === emoji.id)).map(emoji => {
3232
const highlightReaction = highlightReactionData.find(highlightReaction => highlightReaction.emoji_id === emoji.id)!;
@@ -69,23 +69,29 @@ export const HighlightSlide = ({ highlight, emojis }: HighlightSlideProps) => {
6969
return (
7070
<div className="border border-white/40 rounded-md p-3 mt-2 bg-white">
7171
{/* fixed height, content ellipsis */}
72-
<h3 className="
73-
text-base font-medium
74-
overflow-hidden
75-
line-clamp-2
76-
h-6
77-
leading-5
78-
"
79-
>
80-
<a
81-
className="text-slate-800 cursor-pointer"
82-
href={url}
83-
rel="noopener noreferrer"
84-
target="_blank"
85-
>
86-
{title}
87-
</a>
88-
</h3>
72+
73+
{
74+
75+
title
76+
? (
77+
<h3 className="
78+
text-base font-medium
79+
overflow-hidden
80+
line-clamp-2
81+
h-6
82+
leading-5"
83+
>
84+
<a
85+
className="text-slate-800 cursor-pointer"
86+
href={url}
87+
rel="noopener noreferrer"
88+
target="_blank"
89+
>
90+
{title}
91+
</a>
92+
</h3>)
93+
: null
94+
}
8995

9096
<div className="flex items-center">
9197
<span className="mr-2 text-slate-500">Author:</span>
@@ -158,10 +164,10 @@ export const HighlightSlide = ({ highlight, emojis }: HighlightSlideProps) => {
158164
role="menuitem"
159165
tabIndex={-1}
160166
onClick={async () => {
161-
await addReactionToHighlight( highlight.id, emoji.id);
167+
await addReactionToHighlight(highlight.id, emoji.id);
162168
}}
163169
onKeyDown={async () => {
164-
await addReactionToHighlight( highlight.id, emoji.id);
170+
await addReactionToHighlight(highlight.id, emoji.id);
165171
}}
166172
>
167173
<img
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { GITHUB_PROFILE_USER_PROFILE_EDITABLE_AREA_SELECTOR } from "../../constants";
21
import { ViewOnOpenSaucedButton } from "../../content-scripts/components/ViewOnOpenSaucedButton/ViewOnOpenSaucedButton";
32

43
const injectViewOnOpenSaucedButton = (username: string) => {
@@ -8,12 +7,16 @@ const injectViewOnOpenSaucedButton = (username: string) => {
87

98
const viewOnOpenSaucedButton = ViewOnOpenSaucedButton(username);
109

11-
const userEditableArea = document.getElementsByClassName(
12-
GITHUB_PROFILE_USER_PROFILE_EDITABLE_AREA_SELECTOR,
13-
);
14-
const editableAreaElement = userEditableArea[0];
10+
const editProfileButtonSelector = ".btn-block.js-profile-editable-edit-button";
11+
const editProfileButton = document.querySelector(editProfileButtonSelector);
1512

16-
editableAreaElement.parentNode?.insertBefore(viewOnOpenSaucedButton, editableAreaElement);
13+
if (editProfileButton) {
14+
editProfileButton.parentNode?.insertBefore(viewOnOpenSaucedButton, editProfileButton);
15+
} else {
16+
const callToActionButtonsArea = document.querySelector(".js-user-profile-follow-button")?.closest(".flex-order-1.flex-md-order-none");
17+
18+
callToActionButtonsArea?.insertBefore(viewOnOpenSaucedButton, callToActionButtonsArea.firstChild);
19+
}
1720
};
1821

1922
export default injectViewOnOpenSaucedButton;

0 commit comments

Comments
 (0)