From 3c189d507bb6c101612ef8eb17622da8e2bdc1b8 Mon Sep 17 00:00:00 2001 From: wangyantong <135088663+wangyantong2000@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:02:48 +0800 Subject: [PATCH] fix: Perceptor tab missing icon (#863) --- .../ContentScripts/features/perceptor-tab/index.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pages/ContentScripts/features/perceptor-tab/index.tsx b/src/pages/ContentScripts/features/perceptor-tab/index.tsx index 7e219d39..8fe7b61f 100644 --- a/src/pages/ContentScripts/features/perceptor-tab/index.tsx +++ b/src/pages/ContentScripts/features/perceptor-tab/index.tsx @@ -53,12 +53,18 @@ const addPerceptorTab = async (): Promise => { const insightsTabDataItem = $('li[data-menu-item$="insights-tab"]', repoNavigationDropdown); const perceptorTabDataItem = insightsTabDataItem.clone(true); perceptorTabDataItem.attr('data-menu-item', featureId); - perceptorTabDataItem.children('a').text('Perceptor').attr({ - 'data-selected-links': perceptorHref, + perceptorTabDataItem.children('a').attr({ href: perceptorHref, }); + const perceptorSvgElement = perceptorTabDataItem + .children('a') + .find('span.ActionListItem-visual.ActionListItem-visual--leading') + .find('svg'); + perceptorSvgElement.attr('class', 'octicon octicon-perceptor'); + perceptorSvgElement.html(iconSvgPath); + const perceptorTextElement = perceptorTabDataItem.children('a').find('span.ActionListItem-label'); + perceptorTextElement.text('Perceptor'); insightsTabDataItem.after(perceptorTabDataItem); - // Trigger a reflow to push the right-most tab into the overflow dropdown window.dispatchEvent(new Event('resize')); };