import './rgh-feature-descriptions.css'; import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import {CopyIcon} from '@primer/octicons-react'; import cache from 'webext-storage-cache'; import features from '../feature-manager.js'; import {featuresMeta} from '../../readme.md'; import {getNewFeatureName} from '../options-storage.js'; import {isRefinedGitHubRepo} from '../github-helpers/index.js'; import observe from '../helpers/selector-observer.js'; import {HotfixStorage} from '../helpers/hotfix.js'; import {createRghIssueLink} from '../helpers/rgh-issue-link.js'; async function add(infoBanner: HTMLElement): Promise { const [, currentFeature] = /source\/features\/([^.]+)/.exec(location.pathname) ?? []; // Enable link even on past commits const currentFeatureName = getNewFeatureName(currentFeature); const feature = featuresMeta.find(feature => feature.id === currentFeatureName); if (!feature) { return; } const conversationsUrl = new URL('https://github.com/refined-github/refined-github/issues'); conversationsUrl.searchParams.set('q', `sort:updated-desc "${feature.id}"`); infoBanner.before( // Block and width classes required to avoid margin collapse

{feature.id}

{ /* eslint-disable-next-line react/no-danger */ }
Related issues { location.pathname.endsWith('css') ? <> • See JavaScript : undefined }
{feature.screenshot && ( )}
, ); // Skip dev check present in `getLocalHotfixes`, we want to see this even when developing const hotfixes = await cache.get('hotfixes:') ?? []; const hotfixed = hotfixes.find(([feature]) => feature === currentFeatureName); if (!hotfixed) { return; } const [_name, issue, unaffectedVersion] = hotfixed; infoBanner.before(
Note: This feature is disabled due to {createRghIssueLink(issue)} {unaffectedVersion && ` until version ${unaffectedVersion}`}
, ); } function init(signal: AbortSignal): void { observe('#repos-sticky-header', add, {signal}); } void features.add(import.meta.url, { asLongAs: [ isRefinedGitHubRepo, ], include: [ pageDetect.isSingleFile, ], init, }); /* Test URLs: - https://github.com/refined-github/refined-github/blob/main/source/features/sync-pr-commit-title.tsx - https://github.com/refined-github/refined-github/blob/main/source/features/clean-conversation-sidebar.css */