Skip to content

Commit

Permalink
fix: repo star tooltip (#871)
Browse files Browse the repository at this point in the history
* After the star button is clicked, it must be refreshed to display the image

* Fixed that images would no longer be displayed after clicking the star button

* Update index.tsx
  • Loading branch information
Xsy41 authored Sep 23, 2024
1 parent 285b29b commit 3d9bed1
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/pages/ContentScripts/features/repo-star-tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,18 @@ const init = async (): Promise<void> => {
// <div data-view-component="true" class="starred BtnGroup flex-1 ml-0">
// <div data-view-component="true" class="unstarred BtnGroup ml-0 flex-1">
// No matter the repo is starred or not, the two button are always there
// So we need to filter the visible one
const $starButton = $(starButtonSelector).filter(function () {
if ($(this).parent().parent().css('display') !== 'none') {
return true;
} else {
return false;
}
// Select all star buttons and no more filtering
const $starButtons = $(starButtonSelector);
// Render NativePopover for each button
$starButtons.each(function () {
const placeholderElement = $('<div class="NativePopover" />').appendTo('body')[0];
render(
<NativePopover anchor={$(this)} width={280} arrowPosition="top-middle">
<View stars={stars} meta={meta} />
</NativePopover>,
placeholderElement
);
});
const placeholderElement = $('<div class="NativePopover" />').appendTo('body')[0];
render(
<NativePopover anchor={$starButton} width={280} arrowPosition="top-middle">
<View stars={stars} meta={meta} />
</NativePopover>,
placeholderElement
);
};

const restore = async () => {};
Expand Down

0 comments on commit 3d9bed1

Please sign in to comment.