From f45faa42326a7f80eb23554c9658f9aa6600ef51 Mon Sep 17 00:00:00 2001 From: Xsy41 <912465467@qq.com> Date: Sun, 17 Nov 2024 15:40:31 +0800 Subject: [PATCH] Mimicking getting data on github --- src/api/common.ts | 21 +++--- src/api/developer.ts | 16 ++--- src/api/repo.ts | 72 +++++++++---------- src/feature-manager.ts | 8 ++- src/helpers/get-developer-info.ts | 4 +- src/helpers/get-repo-info.ts | 24 ++++--- src/helpers/is-gitee.ts | 5 ++ src/helpers/platform-detection.ts | 8 +++ .../{ => common}/fast-pr/baseContent.ts | 0 .../{ => common}/fast-pr/giteeService.ts | 4 +- .../features/{ => common}/fast-pr/giteeUrl.ts | 0 .../{ => common}/fast-pr/githubService.ts | 4 +- .../{ => common}/fast-pr/handleMessage.tsx | 0 .../features/{ => common}/fast-pr/index.tsx | 4 +- .../features/{ => common}/fast-pr/view.tsx | 6 +- .../features/{ => common}/oss-gpt/index.tsx | 13 ++-- .../features/{ => common}/oss-gpt/rcw.scss | 0 .../features/{ => common}/oss-gpt/service.ts | 0 .../features/{ => common}/oss-gpt/view.tsx | 6 +- .../index.tsx | 20 +++--- .../view.tsx | 12 ++-- .../developer-hovercard-info/index.tsx | 10 +-- .../developer-hovercard-info/view.tsx | 4 +- .../developer-networks/icon-svg-path.ts | 0 .../{ => github}/developer-networks/index.tsx | 6 +- .../developer-networks/react-modal.scss | 0 .../{ => github}/developer-networks/view.tsx | 6 +- .../{ => github}/perceptor-layout/index.tsx | 6 +- .../{ => github}/perceptor-layout/view.tsx | 0 .../perceptor-tab/icon-svg-path.ts | 0 .../{ => github}/perceptor-tab/index.tsx | 13 ++-- .../repo-activity-openrank-trends/index.tsx | 20 +++--- .../repo-activity-openrank-trends/view.tsx | 12 ++-- .../AvatarColorStore.ts | 0 .../repo-activity-racing-bar/PlayerButton.tsx | 0 .../repo-activity-racing-bar/RacingBar.tsx | 2 +- .../SpeedController.tsx | 0 .../repo-activity-racing-bar/data.ts | 2 +- .../repo-activity-racing-bar/index.tsx | 16 +++-- .../useLoadedAvatars.ts | 0 .../repo-activity-racing-bar/view.tsx | 4 +- .../repo-fork-tooltip/ForkChart.tsx | 4 +- .../{ => github}/repo-fork-tooltip/index.tsx | 20 +++--- .../{ => github}/repo-fork-tooltip/view.tsx | 12 ++-- .../repo-header-labels/ActivityChart.tsx | 4 +- .../repo-header-labels/ContributorChart.tsx | 4 +- .../repo-header-labels/OpenRankChart.tsx | 4 +- .../repo-header-labels/ParticipantChart.tsx | 4 +- .../repo-header-labels/activityView.tsx | 14 ++-- .../{ => github}/repo-header-labels/index.tsx | 26 +++---- .../repo-header-labels/openrankView.tsx | 14 ++-- .../repo-header-labels/participantView.tsx | 14 ++-- .../{ => github}/repo-header-labels/view.tsx | 14 ++-- .../repo-issue-tooltip/IssueChart.tsx | 4 +- .../{ => github}/repo-issue-tooltip/index.tsx | 24 ++++--- .../{ => github}/repo-issue-tooltip/view.tsx | 14 ++-- .../repo-networks/DataNotFound.tsx | 0 .../{ => github}/repo-networks/index.tsx | 8 +-- .../{ => github}/repo-networks/view.tsx | 6 +- .../repo-pr-tooltip/MergedLinesChart.tsx | 4 +- .../{ => github}/repo-pr-tooltip/PRChart.tsx | 4 +- .../{ => github}/repo-pr-tooltip/index.tsx | 28 ++++---- .../{ => github}/repo-pr-tooltip/view.tsx | 14 ++-- .../repo-sidebar-labels/OpenDiggerLabel.tsx | 2 +- .../repo-sidebar-labels/index.tsx | 13 ++-- .../repo-star-tooltip/StarChart.tsx | 4 +- .../{ => github}/repo-star-tooltip/index.tsx | 22 +++--- .../{ => github}/repo-star-tooltip/view.tsx | 12 ++-- src/pages/ContentScripts/index.ts | 32 ++++----- 69 files changed, 351 insertions(+), 302 deletions(-) create mode 100644 src/helpers/is-gitee.ts create mode 100644 src/helpers/platform-detection.ts rename src/pages/ContentScripts/features/{ => common}/fast-pr/baseContent.ts (100%) rename src/pages/ContentScripts/features/{ => common}/fast-pr/giteeService.ts (98%) rename src/pages/ContentScripts/features/{ => common}/fast-pr/giteeUrl.ts (100%) rename src/pages/ContentScripts/features/{ => common}/fast-pr/githubService.ts (98%) rename src/pages/ContentScripts/features/{ => common}/fast-pr/handleMessage.tsx (100%) rename src/pages/ContentScripts/features/{ => common}/fast-pr/index.tsx (96%) rename src/pages/ContentScripts/features/{ => common}/fast-pr/view.tsx (98%) rename src/pages/ContentScripts/features/{ => common}/oss-gpt/index.tsx (81%) rename src/pages/ContentScripts/features/{ => common}/oss-gpt/rcw.scss (100%) rename src/pages/ContentScripts/features/{ => common}/oss-gpt/service.ts (100%) rename src/pages/ContentScripts/features/{ => common}/oss-gpt/view.tsx (97%) rename src/pages/ContentScripts/features/{ => github}/developer-activity-openrank-trends/index.tsx (66%) rename src/pages/ContentScripts/features/{ => github}/developer-activity-openrank-trends/view.tsx (82%) rename src/pages/ContentScripts/features/{ => github}/developer-hovercard-info/index.tsx (93%) rename src/pages/ContentScripts/features/{ => github}/developer-hovercard-info/view.tsx (91%) rename src/pages/ContentScripts/features/{ => github}/developer-networks/icon-svg-path.ts (100%) rename src/pages/ContentScripts/features/{ => github}/developer-networks/index.tsx (83%) rename src/pages/ContentScripts/features/{ => github}/developer-networks/react-modal.scss (100%) rename src/pages/ContentScripts/features/{ => github}/developer-networks/view.tsx (98%) rename src/pages/ContentScripts/features/{ => github}/perceptor-layout/index.tsx (85%) rename src/pages/ContentScripts/features/{ => github}/perceptor-layout/view.tsx (100%) rename src/pages/ContentScripts/features/{ => github}/perceptor-tab/icon-svg-path.ts (100%) rename src/pages/ContentScripts/features/{ => github}/perceptor-tab/index.tsx (90%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-openrank-trends/index.tsx (70%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-openrank-trends/view.tsx (85%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-racing-bar/AvatarColorStore.ts (100%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-racing-bar/PlayerButton.tsx (100%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-racing-bar/RacingBar.tsx (98%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-racing-bar/SpeedController.tsx (100%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-racing-bar/data.ts (98%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-racing-bar/index.tsx (70%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-racing-bar/useLoadedAvatars.ts (100%) rename src/pages/ContentScripts/features/{ => github}/repo-activity-racing-bar/view.tsx (98%) rename src/pages/ContentScripts/features/{ => github}/repo-fork-tooltip/ForkChart.tsx (95%) rename src/pages/ContentScripts/features/{ => github}/repo-fork-tooltip/index.tsx (60%) rename src/pages/ContentScripts/features/{ => github}/repo-fork-tooltip/view.tsx (78%) rename src/pages/ContentScripts/features/{ => github}/repo-header-labels/ActivityChart.tsx (95%) rename src/pages/ContentScripts/features/{ => github}/repo-header-labels/ContributorChart.tsx (95%) rename src/pages/ContentScripts/features/{ => github}/repo-header-labels/OpenRankChart.tsx (95%) rename src/pages/ContentScripts/features/{ => github}/repo-header-labels/ParticipantChart.tsx (95%) rename src/pages/ContentScripts/features/{ => github}/repo-header-labels/activityView.tsx (76%) rename src/pages/ContentScripts/features/{ => github}/repo-header-labels/index.tsx (78%) rename src/pages/ContentScripts/features/{ => github}/repo-header-labels/openrankView.tsx (76%) rename src/pages/ContentScripts/features/{ => github}/repo-header-labels/participantView.tsx (84%) rename src/pages/ContentScripts/features/{ => github}/repo-header-labels/view.tsx (93%) rename src/pages/ContentScripts/features/{ => github}/repo-issue-tooltip/IssueChart.tsx (96%) rename src/pages/ContentScripts/features/{ => github}/repo-issue-tooltip/index.tsx (56%) rename src/pages/ContentScripts/features/{ => github}/repo-issue-tooltip/view.tsx (85%) rename src/pages/ContentScripts/features/{ => github}/repo-networks/DataNotFound.tsx (100%) rename src/pages/ContentScripts/features/{ => github}/repo-networks/index.tsx (79%) rename src/pages/ContentScripts/features/{ => github}/repo-networks/view.tsx (97%) rename src/pages/ContentScripts/features/{ => github}/repo-pr-tooltip/MergedLinesChart.tsx (96%) rename src/pages/ContentScripts/features/{ => github}/repo-pr-tooltip/PRChart.tsx (96%) rename src/pages/ContentScripts/features/{ => github}/repo-pr-tooltip/index.tsx (54%) rename src/pages/ContentScripts/features/{ => github}/repo-pr-tooltip/view.tsx (89%) rename src/pages/ContentScripts/features/{ => github}/repo-sidebar-labels/OpenDiggerLabel.tsx (93%) rename src/pages/ContentScripts/features/{ => github}/repo-sidebar-labels/index.tsx (77%) rename src/pages/ContentScripts/features/{ => github}/repo-star-tooltip/StarChart.tsx (95%) rename src/pages/ContentScripts/features/{ => github}/repo-star-tooltip/index.tsx (66%) rename src/pages/ContentScripts/features/{ => github}/repo-star-tooltip/view.tsx (78%) diff --git a/src/api/common.ts b/src/api/common.ts index a4507583..6ac486ed 100644 --- a/src/api/common.ts +++ b/src/api/common.ts @@ -1,9 +1,14 @@ import { OSS_XLAB_ENDPOINT, ErrorCode } from '../constant'; import request from '../helpers/request'; -export const getMetricByName = async (owner: string, metricNameMap: Map, metric: string) => { +export const getMetricByName = async ( + platform: string, + owner: string, + metricNameMap: Map, + metric: string +) => { try { - return await request(`${OSS_XLAB_ENDPOINT}/github/${owner}/${metricNameMap.get(metric)}.json`); + return await request(`${OSS_XLAB_ENDPOINT}/${platform}/${owner}/${metricNameMap.get(metric)}.json`); } catch (error) { // the catched error being "404" means the metric file is not available so return a null if (error === ErrorCode.NOT_FOUND) { @@ -57,8 +62,8 @@ class MetaStore { * Fetch the meta file and cache the response * @param name repo name or user name */ - private fetchMeta(name: string) { - const url = `${OSS_XLAB_ENDPOINT}/github/${name}/meta.json`; + private fetchMeta(platform: string, name: string) { + const url = `${OSS_XLAB_ENDPOINT}/${platform}/${name}/meta.json`; const promise = fetch(url); this.responseCache.set(name, promise); } @@ -68,9 +73,9 @@ class MetaStore { * @param name repo name or user name * @returns true if the meta file exists, false otherwise */ - public async has(name: string) { + public async has(platform: string, name: string) { if (!this.responseCache.has(name)) { - this.fetchMeta(name); + this.fetchMeta(platform, name); } const response = await this.responseCache.get(name)!; if (!response.ok) { @@ -85,8 +90,8 @@ class MetaStore { * @param name repo name or user name * @returns the parsed meta file if it exists, undefined otherwise */ - public async get(name: string): Promise { - if (await this.has(name)) { + public async get(platform: string, name: string): Promise { + if (await this.has(platform, name)) { const meta: CommonMeta = await this.responseCache .get(name)! // clone the response to avoid the response being used up diff --git a/src/api/developer.ts b/src/api/developer.ts index 953d41ce..928aa814 100644 --- a/src/api/developer.ts +++ b/src/api/developer.ts @@ -8,18 +8,18 @@ const metricNameMap = new Map([ ['repo_network', 'repo_network'], ]); -export const getActivity = async (user: string) => { - return getMetricByName(user, metricNameMap, 'activity'); +export const getActivity = async (platform: string, user: string) => { + return getMetricByName(platform, user, metricNameMap, 'activity'); }; -export const getOpenrank = async (user: string) => { - return getMetricByName(user, metricNameMap, 'openrank'); +export const getOpenrank = async (platform: string, user: string) => { + return getMetricByName(platform, user, metricNameMap, 'openrank'); }; -export const getDeveloperNetwork = async (user: string) => { - return getMetricByName(user, metricNameMap, 'developer_network'); +export const getDeveloperNetwork = async (platform: string, user: string) => { + return getMetricByName(platform, user, metricNameMap, 'developer_network'); }; -export const getRepoNetwork = async (user: string) => { - return getMetricByName(user, metricNameMap, 'repo_network'); +export const getRepoNetwork = async (platform: string, user: string) => { + return getMetricByName(platform, user, metricNameMap, 'repo_network'); }; diff --git a/src/api/repo.ts b/src/api/repo.ts index 2b78ebd2..49e013f2 100644 --- a/src/api/repo.ts +++ b/src/api/repo.ts @@ -22,74 +22,74 @@ const metricNameMap = new Map([ ['activity_details', 'activity_details'], ]); -export const getActivity = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'activity'); +export const getActivity = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'activity'); }; -export const getOpenrank = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'openrank'); +export const getOpenrank = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'openrank'); }; -export const getParticipant = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'participant'); +export const getParticipant = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'participant'); }; -export const getContributor = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'contributor'); +export const getContributor = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'contributor'); }; -export const getForks = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'forks'); +export const getForks = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'forks'); }; -export const getStars = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'stars'); +export const getStars = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'stars'); }; -export const getIssuesOpened = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'issues_opened'); +export const getIssuesOpened = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'issues_opened'); }; -export const getIssuesClosed = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'issues_closed'); +export const getIssuesClosed = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'issues_closed'); }; -export const getIssueComments = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'issue_comments'); +export const getIssueComments = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'issue_comments'); }; -export const getPROpened = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'PR_opened'); +export const getPROpened = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'PR_opened'); }; -export const getPRMerged = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'PR_merged'); +export const getPRMerged = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'PR_merged'); }; -export const getPRReviews = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'PR_reviews'); +export const getPRReviews = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'PR_reviews'); }; -export const getMergedCodeAddition = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'merged_code_addition'); +export const getMergedCodeAddition = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'merged_code_addition'); }; -export const getMergedCodeDeletion = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'merged_code_deletion'); +export const getMergedCodeDeletion = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'merged_code_deletion'); }; -export const getMergedCodeSum = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'merged_code_sum'); +export const getMergedCodeSum = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'merged_code_sum'); }; -export const getDeveloperNetwork = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'developer_network'); +export const getDeveloperNetwork = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'developer_network'); }; -export const getRepoNetwork = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'repo_network'); +export const getRepoNetwork = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'repo_network'); }; -export const getActivityDetails = async (repo: string) => { - return getMetricByName(repo, metricNameMap, 'activity_details'); +export const getActivityDetails = async (platform: string, repo: string) => { + return getMetricByName(platform, repo, metricNameMap, 'activity_details'); }; diff --git a/src/feature-manager.ts b/src/feature-manager.ts index 36080ed3..126decb6 100644 --- a/src/feature-manager.ts +++ b/src/feature-manager.ts @@ -10,6 +10,7 @@ import isRestorationVisit from './helpers/is-restoration-visit'; import shouldFeatureRun, { ShouldRunConditions } from './helpers/should-feature-run'; import optionsStorage from './options-storage'; import { throttle } from 'lodash-es'; +import { getPlatform } from './helpers/platform-detection'; type FeatureInit = () => Promisable; type FeatureRestore = Function; @@ -82,8 +83,11 @@ const globalReady = new Promise(async (resolve) => { document.documentElement.classList.add('hypercrx'); const options = await optionsStorage.getAll(); + const updatedOptions = Object.fromEntries( + Object.entries(options).map(([key, value]) => [key.replace(/\//g, '-'), value]) + ); - resolve(options); + resolve(updatedOptions); }); const setupPageLoad = async (id: FeatureId, config: InternalRunConfig): Promise => { @@ -113,6 +117,7 @@ const getFeatureID = (url: string): FeatureId => { let name = pathComponents.pop()!.split('.')[0]; if (name === 'index') { name = pathComponents.pop()!; + name = pathComponents.pop()! + '-' + name; } return `${prefix}${name}` as FeatureId; }; @@ -124,7 +129,6 @@ const add = async ( ): Promise => { /* Feature filtering and running */ const options = await globalReady; - // If the feature is disabled, skip it if (!options[id as keyof typeof options]) { log.info('↩️', 'Skipping', id); diff --git a/src/helpers/get-developer-info.ts b/src/helpers/get-developer-info.ts index 271bdf41..6a14368b 100644 --- a/src/helpers/get-developer-info.ts +++ b/src/helpers/get-developer-info.ts @@ -19,8 +19,8 @@ export function getDeveloperNameByUrl() { return pageDetect.utils.getUsername()!; } -export async function isDeveloperWithMeta() { - return pageDetect.isUserProfile() && (await metaStore.has(getDeveloperName())); +export async function isDeveloperWithMeta(platform: string) { + return pageDetect.isUserProfile() && (await metaStore.has(platform, getDeveloperName())); } export async function isUserProfile() { return pageDetect.isUserProfile(); diff --git a/src/helpers/get-repo-info.ts b/src/helpers/get-repo-info.ts index f74acef6..7ddf1f49 100644 --- a/src/helpers/get-repo-info.ts +++ b/src/helpers/get-repo-info.ts @@ -38,14 +38,20 @@ export async function isRepoRoot() { /** * check if the repository is public */ -export async function isPublicRepo() { - const selector = 'meta[name="octolytics-dimension-repository_public"]'; - await elementReady(selector); - // - const isPublic = $(selector).attr('content') === 'true'; - return pageDetect.isRepo() && isPublic; +export async function isPublicRepo(platform: string) { + if (platform === 'github') { + const selector = 'meta[name="octolytics-dimension-repository_public"]'; + await elementReady(selector); + // + const isPublic = $(selector).attr('content') === 'true'; + return pageDetect.isRepo() && isPublic; + } else { + return true; + } } - -export async function isPublicRepoWithMeta() { - return (await isPublicRepo()) && ((await metaStore.has(getRepoName())) || (await metaStore.has(getRepoNameByPage()))); +export async function isPublicRepoWithMeta(platform: string) { + return ( + (await isPublicRepo(platform)) && + ((await metaStore.has(platform, getRepoNameByUrl())) || (await metaStore.has(platform, getRepoNameByPage()))) + ); } diff --git a/src/helpers/is-gitee.ts b/src/helpers/is-gitee.ts new file mode 100644 index 00000000..732b0a67 --- /dev/null +++ b/src/helpers/is-gitee.ts @@ -0,0 +1,5 @@ +const isGitee = (): boolean => { + return window.location.href.startsWith('https://gitee.com/'); +}; + +export default isGitee; diff --git a/src/helpers/platform-detection.ts b/src/helpers/platform-detection.ts new file mode 100644 index 00000000..4ee3d2c1 --- /dev/null +++ b/src/helpers/platform-detection.ts @@ -0,0 +1,8 @@ +import isGitee from './is-gitee'; +import isGithub from './is-github'; + +export const getPlatform = (): 'github' | 'gitee' => { + if (isGithub()) return 'github'; + if (isGitee()) return 'gitee'; + throw new Error('Unsupported platform'); +}; diff --git a/src/pages/ContentScripts/features/fast-pr/baseContent.ts b/src/pages/ContentScripts/features/common/fast-pr/baseContent.ts similarity index 100% rename from src/pages/ContentScripts/features/fast-pr/baseContent.ts rename to src/pages/ContentScripts/features/common/fast-pr/baseContent.ts diff --git a/src/pages/ContentScripts/features/fast-pr/giteeService.ts b/src/pages/ContentScripts/features/common/fast-pr/giteeService.ts similarity index 98% rename from src/pages/ContentScripts/features/fast-pr/giteeService.ts rename to src/pages/ContentScripts/features/common/fast-pr/giteeService.ts index cc871612..346446e3 100644 --- a/src/pages/ContentScripts/features/fast-pr/giteeService.ts +++ b/src/pages/ContentScripts/features/common/fast-pr/giteeService.ts @@ -1,8 +1,8 @@ import * as url from './giteeUrl'; import { handleMessage } from './handleMessage'; import type { FormInstance } from 'antd/lib/form'; -import i18n from '../../../../helpers/i18n'; -import { getGiteeToken } from '../../../../helpers/gitee-token'; +import i18n from '../../../../../helpers/i18n'; +import { getGiteeToken } from '../../../../../helpers/gitee-token'; import { generateBranchName, COMMIT_MESSAGE, COMMIT_MESSAGE_DOC } from './baseContent'; const t = i18n.t; let userName: string | null; diff --git a/src/pages/ContentScripts/features/fast-pr/giteeUrl.ts b/src/pages/ContentScripts/features/common/fast-pr/giteeUrl.ts similarity index 100% rename from src/pages/ContentScripts/features/fast-pr/giteeUrl.ts rename to src/pages/ContentScripts/features/common/fast-pr/giteeUrl.ts diff --git a/src/pages/ContentScripts/features/fast-pr/githubService.ts b/src/pages/ContentScripts/features/common/fast-pr/githubService.ts similarity index 98% rename from src/pages/ContentScripts/features/fast-pr/githubService.ts rename to src/pages/ContentScripts/features/common/fast-pr/githubService.ts index d8015a33..8626c102 100644 --- a/src/pages/ContentScripts/features/fast-pr/githubService.ts +++ b/src/pages/ContentScripts/features/common/fast-pr/githubService.ts @@ -1,7 +1,7 @@ import { handleMessage } from './handleMessage'; import type { FormInstance } from 'antd/lib/form'; -import { getGithubToken } from '../../../../helpers/github-token'; -import i18n from '../../../../helpers/i18n'; +import { getGithubToken } from '../../../../../helpers/github-token'; +import i18n from '../../../../../helpers/i18n'; import { Octokit } from '@octokit/rest'; import { generateBranchName, COMMIT_MESSAGE, COMMIT_MESSAGE_DOC } from './baseContent'; diff --git a/src/pages/ContentScripts/features/fast-pr/handleMessage.tsx b/src/pages/ContentScripts/features/common/fast-pr/handleMessage.tsx similarity index 100% rename from src/pages/ContentScripts/features/fast-pr/handleMessage.tsx rename to src/pages/ContentScripts/features/common/fast-pr/handleMessage.tsx diff --git a/src/pages/ContentScripts/features/fast-pr/index.tsx b/src/pages/ContentScripts/features/common/fast-pr/index.tsx similarity index 96% rename from src/pages/ContentScripts/features/fast-pr/index.tsx rename to src/pages/ContentScripts/features/common/fast-pr/index.tsx index 50e355fb..640f7fac 100644 --- a/src/pages/ContentScripts/features/fast-pr/index.tsx +++ b/src/pages/ContentScripts/features/common/fast-pr/index.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; -import features from '../../../../feature-manager'; +import features from '../../../../../feature-manager'; import View from './view'; -import i18n from '../../../../helpers/i18n'; +import i18n from '../../../../../helpers/i18n'; const featureId = features.getFeatureID(import.meta.url); const t = i18n.t; interface MatchedUrl { diff --git a/src/pages/ContentScripts/features/fast-pr/view.tsx b/src/pages/ContentScripts/features/common/fast-pr/view.tsx similarity index 98% rename from src/pages/ContentScripts/features/fast-pr/view.tsx rename to src/pages/ContentScripts/features/common/fast-pr/view.tsx index 967ec078..902ed752 100644 --- a/src/pages/ContentScripts/features/fast-pr/view.tsx +++ b/src/pages/ContentScripts/features/common/fast-pr/view.tsx @@ -5,10 +5,10 @@ import * as githubService from './githubService'; import * as giteeService from './giteeService'; import { GET_FILE_URL as GITEE_FILE_URL } from './giteeUrl'; import { handleMessage } from './handleMessage'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; import { useTranslation } from 'react-i18next'; -import { getGiteeToken } from '../../../../helpers/gitee-token'; -import { getGithubToken } from '../../../../helpers/github-token'; +import { getGiteeToken } from '../../../../../helpers/gitee-token'; +import { getGithubToken } from '../../../../../helpers/github-token'; import { PR_TITLE, PR_CONTENT } from './baseContent'; interface Props { filePath: string; diff --git a/src/pages/ContentScripts/features/oss-gpt/index.tsx b/src/pages/ContentScripts/features/common/oss-gpt/index.tsx similarity index 81% rename from src/pages/ContentScripts/features/oss-gpt/index.tsx rename to src/pages/ContentScripts/features/common/oss-gpt/index.tsx index 6914bb1a..1a7acb40 100644 --- a/src/pages/ContentScripts/features/oss-gpt/index.tsx +++ b/src/pages/ContentScripts/features/common/oss-gpt/index.tsx @@ -2,11 +2,12 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; import $ from 'jquery'; -import features from '../../../../feature-manager'; -import getGithubTheme from '../../../../helpers/get-github-theme'; -import { getRepoName, isPublicRepo } from '../../../../helpers/get-repo-info'; +import features from '../../../../../feature-manager'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import { getRepoName, isPublicRepo } from '../../../../../helpers/get-repo-info'; import View from './view'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; interface DocsMetaItem { type: 'repo' | 'org'; @@ -65,7 +66,7 @@ const init = async (): Promise => { // TODO need a mechanism to remove extra listeners like this one document.addEventListener('turbo:load', async () => { - if (await isPublicRepo()) { + if (await isPublicRepo(getPlatform())) { if (repoName !== getRepoName()) { repoName = getRepoName(); renderTo($(`#${featureId}`)[0]); @@ -77,7 +78,7 @@ const init = async (): Promise => { }; features.add(featureId, { - include: [isGithub, isPublicRepo], + include: [isGithub, () => isPublicRepo(getPlatform())], awaitDomReady: false, init, }); diff --git a/src/pages/ContentScripts/features/oss-gpt/rcw.scss b/src/pages/ContentScripts/features/common/oss-gpt/rcw.scss similarity index 100% rename from src/pages/ContentScripts/features/oss-gpt/rcw.scss rename to src/pages/ContentScripts/features/common/oss-gpt/rcw.scss diff --git a/src/pages/ContentScripts/features/oss-gpt/service.ts b/src/pages/ContentScripts/features/common/oss-gpt/service.ts similarity index 100% rename from src/pages/ContentScripts/features/oss-gpt/service.ts rename to src/pages/ContentScripts/features/common/oss-gpt/service.ts diff --git a/src/pages/ContentScripts/features/oss-gpt/view.tsx b/src/pages/ContentScripts/features/common/oss-gpt/view.tsx similarity index 97% rename from src/pages/ContentScripts/features/oss-gpt/view.tsx rename to src/pages/ContentScripts/features/common/oss-gpt/view.tsx index c008a5da..690c52c9 100644 --- a/src/pages/ContentScripts/features/oss-gpt/view.tsx +++ b/src/pages/ContentScripts/features/common/oss-gpt/view.tsx @@ -12,10 +12,10 @@ import { import { getAnswer } from './service'; import './rcw.scss'; -import exists from '../../../../helpers/exists'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; +import exists from '../../../../../helpers/exists'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; interface Props { theme: 'light' | 'dark'; currentRepo: string; diff --git a/src/pages/ContentScripts/features/developer-activity-openrank-trends/index.tsx b/src/pages/ContentScripts/features/github/developer-activity-openrank-trends/index.tsx similarity index 66% rename from src/pages/ContentScripts/features/developer-activity-openrank-trends/index.tsx rename to src/pages/ContentScripts/features/github/developer-activity-openrank-trends/index.tsx index eab92d46..29c4bb9a 100644 --- a/src/pages/ContentScripts/features/developer-activity-openrank-trends/index.tsx +++ b/src/pages/ContentScripts/features/github/developer-activity-openrank-trends/index.tsx @@ -1,13 +1,14 @@ import React from 'react'; import $ from 'jquery'; -import features from '../../../../feature-manager'; -import { getDeveloperName, isDeveloperWithMeta } from '../../../../helpers/get-developer-info'; -import { getActivity, getOpenrank } from '../../../../api/developer'; -import { UserMeta, metaStore } from '../../../../api/common'; +import features from '../../../../../feature-manager'; +import { getDeveloperName, isDeveloperWithMeta } from '../../../../../helpers/get-developer-info'; +import { getActivity, getOpenrank } from '../../../../../api/developer'; +import { UserMeta, metaStore } from '../../../../../api/common'; import View from './view'; import { createRoot } from 'react-dom/client'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); let developerName: string; let activity: any; @@ -15,9 +16,10 @@ let openrank: any; let meta: UserMeta; const getData = async () => { - activity = await getActivity(developerName); - openrank = await getOpenrank(developerName); - meta = (await metaStore.get(developerName)) as UserMeta; + const platform = getPlatform(); + activity = await getActivity(platform, developerName); + openrank = await getOpenrank(platform, developerName); + meta = (await metaStore.get(platform, developerName)) as UserMeta; }; const renderTo = (container: any) => { @@ -48,7 +50,7 @@ const restore = async () => { renderTo($(`#${featureId}`)[0]); }; features.add(featureId, { - asLongAs: [isGithub, isDeveloperWithMeta], + asLongAs: [isGithub, () => isDeveloperWithMeta(getPlatform())], awaitDomReady: false, init, restore, diff --git a/src/pages/ContentScripts/features/developer-activity-openrank-trends/view.tsx b/src/pages/ContentScripts/features/github/developer-activity-openrank-trends/view.tsx similarity index 82% rename from src/pages/ContentScripts/features/developer-activity-openrank-trends/view.tsx rename to src/pages/ContentScripts/features/github/developer-activity-openrank-trends/view.tsx index 8211d2df..82f7df12 100644 --- a/src/pages/ContentScripts/features/developer-activity-openrank-trends/view.tsx +++ b/src/pages/ContentScripts/features/github/developer-activity-openrank-trends/view.tsx @@ -1,11 +1,11 @@ import React, { useState, useEffect } from 'react'; -import getGithubTheme from '../../../../helpers/get-github-theme'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import Bars from '../../../../components/Bars'; -import { UserMeta } from '../../../../api/common'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import Bars from '../../../../../components/Bars'; +import { UserMeta } from '../../../../../api/common'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); const generateBarsData = (activity: any, openrank: any, updatedAt: number) => { diff --git a/src/pages/ContentScripts/features/developer-hovercard-info/index.tsx b/src/pages/ContentScripts/features/github/developer-hovercard-info/index.tsx similarity index 93% rename from src/pages/ContentScripts/features/developer-hovercard-info/index.tsx rename to src/pages/ContentScripts/features/github/developer-hovercard-info/index.tsx index 128d452d..e4be80d4 100644 --- a/src/pages/ContentScripts/features/developer-hovercard-info/index.tsx +++ b/src/pages/ContentScripts/features/github/developer-hovercard-info/index.tsx @@ -1,15 +1,17 @@ -import features from '../../../../feature-manager'; -import { getOpenrank } from '../../../../api/developer'; +import features from '../../../../../feature-manager'; +import { getOpenrank } from '../../../../../api/developer'; import elementReady from 'element-ready'; import React from 'react'; import View from './view'; import { createRoot } from 'react-dom/client'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); let isInitialized = false; const getDeveloperLatestOpenrank = async (developerName: string): Promise => { - const data = await getOpenrank(developerName); + const platform = getPlatform(); + const data = await getOpenrank(platform, developerName); if (data) { // filter YYYY-MM const monthKeys = Object.keys(data).filter((key) => /^\d{4}-\d{2}$/.test(key)); diff --git a/src/pages/ContentScripts/features/developer-hovercard-info/view.tsx b/src/pages/ContentScripts/features/github/developer-hovercard-info/view.tsx similarity index 91% rename from src/pages/ContentScripts/features/developer-hovercard-info/view.tsx rename to src/pages/ContentScripts/features/github/developer-hovercard-info/view.tsx index 24318a03..43fc8ec1 100644 --- a/src/pages/ContentScripts/features/developer-hovercard-info/view.tsx +++ b/src/pages/ContentScripts/features/github/developer-hovercard-info/view.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import getGithubTheme from '../../../../helpers/get-github-theme'; -import '../../../../helpers/i18n'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import '../../../../../helpers/i18n'; interface OpenRankProps { developerName: string; diff --git a/src/pages/ContentScripts/features/developer-networks/icon-svg-path.ts b/src/pages/ContentScripts/features/github/developer-networks/icon-svg-path.ts similarity index 100% rename from src/pages/ContentScripts/features/developer-networks/icon-svg-path.ts rename to src/pages/ContentScripts/features/github/developer-networks/icon-svg-path.ts diff --git a/src/pages/ContentScripts/features/developer-networks/index.tsx b/src/pages/ContentScripts/features/github/developer-networks/index.tsx similarity index 83% rename from src/pages/ContentScripts/features/developer-networks/index.tsx rename to src/pages/ContentScripts/features/github/developer-networks/index.tsx index b8193ad1..fcab5e28 100644 --- a/src/pages/ContentScripts/features/developer-networks/index.tsx +++ b/src/pages/ContentScripts/features/github/developer-networks/index.tsx @@ -3,10 +3,10 @@ import $ from 'jquery'; import { createRoot } from 'react-dom/client'; import elementReady from 'element-ready'; -import features from '../../../../feature-manager'; -import { getDeveloperName, isUserProfile } from '../../../../helpers/get-developer-info'; +import features from '../../../../../feature-manager'; +import { getDeveloperName, isUserProfile } from '../../../../../helpers/get-developer-info'; import View from './view'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; const featureId = features.getFeatureID(import.meta.url); diff --git a/src/pages/ContentScripts/features/developer-networks/react-modal.scss b/src/pages/ContentScripts/features/github/developer-networks/react-modal.scss similarity index 100% rename from src/pages/ContentScripts/features/developer-networks/react-modal.scss rename to src/pages/ContentScripts/features/github/developer-networks/react-modal.scss diff --git a/src/pages/ContentScripts/features/developer-networks/view.tsx b/src/pages/ContentScripts/features/github/developer-networks/view.tsx similarity index 98% rename from src/pages/ContentScripts/features/developer-networks/view.tsx rename to src/pages/ContentScripts/features/github/developer-networks/view.tsx index 890a4586..5eacd308 100644 --- a/src/pages/ContentScripts/features/developer-networks/view.tsx +++ b/src/pages/ContentScripts/features/github/developer-networks/view.tsx @@ -1,11 +1,11 @@ import React, { useState, useEffect } from 'react'; import ReactModal from 'react-modal'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; import { iconDeveloperNetwork, iconRepoNetwork, iconInterestNetwork } from './icon-svg-path'; import './react-modal.scss'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; -import OSGraph from '../../../../components/OSGraph'; +import '../../../../../helpers/i18n'; +import OSGraph from '../../../../../components/OSGraph'; interface Props { userName: string; } diff --git a/src/pages/ContentScripts/features/perceptor-layout/index.tsx b/src/pages/ContentScripts/features/github/perceptor-layout/index.tsx similarity index 85% rename from src/pages/ContentScripts/features/perceptor-layout/index.tsx rename to src/pages/ContentScripts/features/github/perceptor-layout/index.tsx index ef303c09..0f36dd18 100644 --- a/src/pages/ContentScripts/features/perceptor-layout/index.tsx +++ b/src/pages/ContentScripts/features/github/perceptor-layout/index.tsx @@ -2,10 +2,10 @@ import React from 'react'; import $ from 'jquery'; import elementReady from 'element-ready'; import { createRoot } from 'react-dom/client'; -import features from '../../../../feature-manager'; -import isPerceptor from '../../../../helpers/is-perceptor'; +import features from '../../../../../feature-manager'; +import isPerceptor from '../../../../../helpers/is-perceptor'; import View from './view'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; const featureId = features.getFeatureID(import.meta.url); diff --git a/src/pages/ContentScripts/features/perceptor-layout/view.tsx b/src/pages/ContentScripts/features/github/perceptor-layout/view.tsx similarity index 100% rename from src/pages/ContentScripts/features/perceptor-layout/view.tsx rename to src/pages/ContentScripts/features/github/perceptor-layout/view.tsx diff --git a/src/pages/ContentScripts/features/perceptor-tab/icon-svg-path.ts b/src/pages/ContentScripts/features/github/perceptor-tab/icon-svg-path.ts similarity index 100% rename from src/pages/ContentScripts/features/perceptor-tab/icon-svg-path.ts rename to src/pages/ContentScripts/features/github/perceptor-tab/icon-svg-path.ts diff --git a/src/pages/ContentScripts/features/perceptor-tab/index.tsx b/src/pages/ContentScripts/features/github/perceptor-tab/index.tsx similarity index 90% rename from src/pages/ContentScripts/features/perceptor-tab/index.tsx rename to src/pages/ContentScripts/features/github/perceptor-tab/index.tsx index 7858106a..30bb8605 100644 --- a/src/pages/ContentScripts/features/perceptor-tab/index.tsx +++ b/src/pages/ContentScripts/features/github/perceptor-tab/index.tsx @@ -2,11 +2,12 @@ import $ from 'jquery'; import elementReady from 'element-ready'; import iconSvgPath from './icon-svg-path'; -import features from '../../../../feature-manager'; -import isPerceptor from '../../../../helpers/is-perceptor'; -import { isPublicRepo } from '../../../../helpers/get-repo-info'; -import sleep from '../../../../helpers/sleep'; -import isGithub from '../../../../helpers/is-github'; +import features from '../../../../../feature-manager'; +import isPerceptor from '../../../../../helpers/is-perceptor'; +import { isPublicRepo } from '../../../../../helpers/get-repo-info'; +import sleep from '../../../../../helpers/sleep'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); @@ -106,7 +107,7 @@ const init = async (): Promise => { }; features.add(featureId, { - asLongAs: [isGithub, isPublicRepo], + asLongAs: [isGithub, () => isPublicRepo(getPlatform())], awaitDomReady: false, init, }); diff --git a/src/pages/ContentScripts/features/repo-activity-openrank-trends/index.tsx b/src/pages/ContentScripts/features/github/repo-activity-openrank-trends/index.tsx similarity index 70% rename from src/pages/ContentScripts/features/repo-activity-openrank-trends/index.tsx rename to src/pages/ContentScripts/features/github/repo-activity-openrank-trends/index.tsx index 4afb14b6..464a9d19 100644 --- a/src/pages/ContentScripts/features/repo-activity-openrank-trends/index.tsx +++ b/src/pages/ContentScripts/features/github/repo-activity-openrank-trends/index.tsx @@ -1,12 +1,13 @@ import React from 'react'; import $ from 'jquery'; import { createRoot } from 'react-dom/client'; -import features from '../../../../feature-manager'; -import { getRepoName, isPublicRepoWithMeta, isRepoRoot } from '../../../../helpers/get-repo-info'; -import { getActivity, getOpenrank } from '../../../../api/repo'; -import { RepoMeta, metaStore } from '../../../../api/common'; +import features from '../../../../../feature-manager'; +import { getRepoName, isPublicRepoWithMeta, isRepoRoot } from '../../../../../helpers/get-repo-info'; +import { getActivity, getOpenrank } from '../../../../../api/repo'; +import { RepoMeta, metaStore } from '../../../../../api/common'; import View from './view'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); let repoName: string; @@ -15,9 +16,10 @@ let openrank: any; let meta: RepoMeta; const getData = async () => { - activity = await getActivity(repoName); - openrank = await getOpenrank(repoName); - meta = (await metaStore.get(repoName)) as RepoMeta; + const platform = getPlatform(); + activity = await getActivity(platform, repoName); + openrank = await getOpenrank(platform, repoName); + meta = (await metaStore.get(platform, repoName)) as RepoMeta; }; const renderTo = (container: any) => { @@ -54,7 +56,7 @@ const restore = async () => { }; features.add(featureId, { - asLongAs: [isGithub, isPublicRepoWithMeta, isRepoRoot], + asLongAs: [isGithub, () => isPublicRepoWithMeta(getPlatform()), isRepoRoot], awaitDomReady: true, init, restore, diff --git a/src/pages/ContentScripts/features/repo-activity-openrank-trends/view.tsx b/src/pages/ContentScripts/features/github/repo-activity-openrank-trends/view.tsx similarity index 85% rename from src/pages/ContentScripts/features/repo-activity-openrank-trends/view.tsx rename to src/pages/ContentScripts/features/github/repo-activity-openrank-trends/view.tsx index 01c263bf..c4818e8f 100644 --- a/src/pages/ContentScripts/features/repo-activity-openrank-trends/view.tsx +++ b/src/pages/ContentScripts/features/github/repo-activity-openrank-trends/view.tsx @@ -1,11 +1,11 @@ import React, { useState, useEffect } from 'react'; -import getGithubTheme from '../../../../helpers/get-github-theme'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import Bars from '../../../../components/Bars'; -import { RepoMeta } from '../../../../api/common'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import Bars from '../../../../../components/Bars'; +import { RepoMeta } from '../../../../../api/common'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); const generateBarsData = (activity: any, openrank: any, updatedAt: number) => { diff --git a/src/pages/ContentScripts/features/repo-activity-racing-bar/AvatarColorStore.ts b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/AvatarColorStore.ts similarity index 100% rename from src/pages/ContentScripts/features/repo-activity-racing-bar/AvatarColorStore.ts rename to src/pages/ContentScripts/features/github/repo-activity-racing-bar/AvatarColorStore.ts diff --git a/src/pages/ContentScripts/features/repo-activity-racing-bar/PlayerButton.tsx b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/PlayerButton.tsx similarity index 100% rename from src/pages/ContentScripts/features/repo-activity-racing-bar/PlayerButton.tsx rename to src/pages/ContentScripts/features/github/repo-activity-racing-bar/PlayerButton.tsx diff --git a/src/pages/ContentScripts/features/repo-activity-racing-bar/RacingBar.tsx b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/RacingBar.tsx similarity index 98% rename from src/pages/ContentScripts/features/repo-activity-racing-bar/RacingBar.tsx rename to src/pages/ContentScripts/features/github/repo-activity-racing-bar/RacingBar.tsx index a637203d..f3ca7636 100644 --- a/src/pages/ContentScripts/features/repo-activity-racing-bar/RacingBar.tsx +++ b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/RacingBar.tsx @@ -1,6 +1,6 @@ import { RepoActivityDetails, getOption, countLongTermContributors, DEFAULT_FREQUENCY } from './data'; import { useLoadedAvatars } from './useLoadedAvatars'; -import sleep from '../../../../helpers/sleep'; +import sleep from '../../../../../helpers/sleep'; import React, { useEffect, useState, useRef, forwardRef, useImperativeHandle, ForwardedRef } from 'react'; import { Spin } from 'antd'; diff --git a/src/pages/ContentScripts/features/repo-activity-racing-bar/SpeedController.tsx b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/SpeedController.tsx similarity index 100% rename from src/pages/ContentScripts/features/repo-activity-racing-bar/SpeedController.tsx rename to src/pages/ContentScripts/features/github/repo-activity-racing-bar/SpeedController.tsx diff --git a/src/pages/ContentScripts/features/repo-activity-racing-bar/data.ts b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/data.ts similarity index 98% rename from src/pages/ContentScripts/features/repo-activity-racing-bar/data.ts rename to src/pages/ContentScripts/features/github/repo-activity-racing-bar/data.ts index f31ebdfc..1834e8b8 100644 --- a/src/pages/ContentScripts/features/repo-activity-racing-bar/data.ts +++ b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/data.ts @@ -1,5 +1,5 @@ import { avatarColorStore } from './AvatarColorStore'; -import getGithubTheme from '../../../../helpers/get-github-theme'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; import type { BarSeriesOption, EChartsOption } from 'echarts'; import { orderBy, take } from 'lodash-es'; diff --git a/src/pages/ContentScripts/features/repo-activity-racing-bar/index.tsx b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/index.tsx similarity index 70% rename from src/pages/ContentScripts/features/repo-activity-racing-bar/index.tsx rename to src/pages/ContentScripts/features/github/repo-activity-racing-bar/index.tsx index 84241141..fe19051b 100644 --- a/src/pages/ContentScripts/features/repo-activity-racing-bar/index.tsx +++ b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/index.tsx @@ -1,20 +1,22 @@ import React from 'react'; import $ from 'jquery'; -import features from '../../../../feature-manager'; -import isPerceptor from '../../../../helpers/is-perceptor'; -import { getRepoName, isPublicRepoWithMeta } from '../../../../helpers/get-repo-info'; -import { getActivityDetails } from '../../../../api/repo'; +import features from '../../../../../feature-manager'; +import isPerceptor from '../../../../../helpers/is-perceptor'; +import { getRepoName, isPublicRepoWithMeta } from '../../../../../helpers/get-repo-info'; +import { getActivityDetails } from '../../../../../api/repo'; import View from './view'; import DataNotFound from '../repo-networks/DataNotFound'; import { RepoActivityDetails } from './data'; import { createRoot } from 'react-dom/client'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); let repoName: string; let repoActivityDetails: RepoActivityDetails; const getData = async () => { - repoActivityDetails = await getActivityDetails(repoName); + const platform = getPlatform(); + repoActivityDetails = await getActivityDetails(platform, repoName); }; const renderTo = (container: any) => { @@ -47,7 +49,7 @@ const restore = async () => { }; features.add(featureId, { - asLongAs: [isGithub, isPerceptor, isPublicRepoWithMeta], + asLongAs: [isGithub, isPerceptor, () => isPublicRepoWithMeta(getPlatform())], awaitDomReady: false, init, restore, diff --git a/src/pages/ContentScripts/features/repo-activity-racing-bar/useLoadedAvatars.ts b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/useLoadedAvatars.ts similarity index 100% rename from src/pages/ContentScripts/features/repo-activity-racing-bar/useLoadedAvatars.ts rename to src/pages/ContentScripts/features/github/repo-activity-racing-bar/useLoadedAvatars.ts diff --git a/src/pages/ContentScripts/features/repo-activity-racing-bar/view.tsx b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/view.tsx similarity index 98% rename from src/pages/ContentScripts/features/repo-activity-racing-bar/view.tsx rename to src/pages/ContentScripts/features/github/repo-activity-racing-bar/view.tsx index c21eb125..903618a9 100644 --- a/src/pages/ContentScripts/features/repo-activity-racing-bar/view.tsx +++ b/src/pages/ContentScripts/features/github/repo-activity-racing-bar/view.tsx @@ -1,4 +1,4 @@ -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; import RacingBar, { MediaControlers } from './RacingBar'; import { RepoActivityDetails, getMonthlyData } from './data'; import { PlayerButton } from './PlayerButton'; @@ -8,7 +8,7 @@ import React, { useState, useEffect, useRef } from 'react'; import { Space } from 'antd'; import { PlayCircleFilled, StepBackwardFilled, StepForwardFilled, PauseCircleFilled } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; interface Props { currentRepo: string; repoActivityDetails: RepoActivityDetails; diff --git a/src/pages/ContentScripts/features/repo-fork-tooltip/ForkChart.tsx b/src/pages/ContentScripts/features/github/repo-fork-tooltip/ForkChart.tsx similarity index 95% rename from src/pages/ContentScripts/features/repo-fork-tooltip/ForkChart.tsx rename to src/pages/ContentScripts/features/github/repo-fork-tooltip/ForkChart.tsx index 85fcbacf..dd9a179d 100644 --- a/src/pages/ContentScripts/features/repo-fork-tooltip/ForkChart.tsx +++ b/src/pages/ContentScripts/features/github/repo-fork-tooltip/ForkChart.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef } from 'react'; import * as echarts from 'echarts'; -import { formatNum, numberWithCommas } from '../../../../helpers/formatter'; -import { getInterval, judgeInterval } from '../../../../helpers/judge-interval'; +import { formatNum, numberWithCommas } from '../../../../../helpers/formatter'; +import { getInterval, judgeInterval } from '../../../../../helpers/judge-interval'; const LIGHT_THEME = { FG_COLOR: '#24292F', BG_COLOR: '#ffffff', diff --git a/src/pages/ContentScripts/features/repo-fork-tooltip/index.tsx b/src/pages/ContentScripts/features/github/repo-fork-tooltip/index.tsx similarity index 60% rename from src/pages/ContentScripts/features/repo-fork-tooltip/index.tsx rename to src/pages/ContentScripts/features/github/repo-fork-tooltip/index.tsx index ff8d0fe4..4e7761cf 100644 --- a/src/pages/ContentScripts/features/repo-fork-tooltip/index.tsx +++ b/src/pages/ContentScripts/features/github/repo-fork-tooltip/index.tsx @@ -1,15 +1,16 @@ -import features from '../../../../feature-manager'; +import features from '../../../../../feature-manager'; import View from './view'; -import { NativePopover } from '../../components/NativePopover'; +import { NativePopover } from '../../../components/NativePopover'; import elementReady from 'element-ready'; -import { getRepoName, hasRepoContainerHeader, isPublicRepoWithMeta } from '../../../../helpers/get-repo-info'; -import { getForks } from '../../../../api/repo'; -import { RepoMeta, metaStore } from '../../../../api/common'; +import { getRepoName, hasRepoContainerHeader, isPublicRepoWithMeta } from '../../../../../helpers/get-repo-info'; +import { getForks } from '../../../../../api/repo'; +import { RepoMeta, metaStore } from '../../../../../api/common'; import React from 'react'; import { createRoot } from 'react-dom/client'; import $ from 'jquery'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); let repoName: string; @@ -17,8 +18,9 @@ let forks: any; let meta: RepoMeta; const getData = async () => { - forks = await getForks(repoName); - meta = (await metaStore.get(repoName)) as RepoMeta; + const platform = getPlatform(); + forks = await getForks(platform, repoName); + meta = (await metaStore.get(platform, repoName)) as RepoMeta; }; const init = async (): Promise => { @@ -39,7 +41,7 @@ const init = async (): Promise => { const restore = async () => {}; features.add(featureId, { - asLongAs: [isGithub, isPublicRepoWithMeta, hasRepoContainerHeader], + asLongAs: [isGithub, () => isPublicRepoWithMeta(getPlatform()), hasRepoContainerHeader], awaitDomReady: false, init, restore, diff --git a/src/pages/ContentScripts/features/repo-fork-tooltip/view.tsx b/src/pages/ContentScripts/features/github/repo-fork-tooltip/view.tsx similarity index 78% rename from src/pages/ContentScripts/features/repo-fork-tooltip/view.tsx rename to src/pages/ContentScripts/features/github/repo-fork-tooltip/view.tsx index 091ef5e1..6ec81e41 100644 --- a/src/pages/ContentScripts/features/repo-fork-tooltip/view.tsx +++ b/src/pages/ContentScripts/features/github/repo-fork-tooltip/view.tsx @@ -1,12 +1,12 @@ import React, { useState, useEffect } from 'react'; -import getGithubTheme from '../../../../helpers/get-github-theme'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; import ForkChart from './ForkChart'; -import { RepoMeta } from '../../../../api/common'; -import TooltipTrigger from '../../../../components/TooltipTrigger'; +import { RepoMeta } from '../../../../../api/common'; +import TooltipTrigger from '../../../../../components/TooltipTrigger'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); diff --git a/src/pages/ContentScripts/features/repo-header-labels/ActivityChart.tsx b/src/pages/ContentScripts/features/github/repo-header-labels/ActivityChart.tsx similarity index 95% rename from src/pages/ContentScripts/features/repo-header-labels/ActivityChart.tsx rename to src/pages/ContentScripts/features/github/repo-header-labels/ActivityChart.tsx index b6551471..70586061 100644 --- a/src/pages/ContentScripts/features/repo-header-labels/ActivityChart.tsx +++ b/src/pages/ContentScripts/features/github/repo-header-labels/ActivityChart.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef } from 'react'; import * as echarts from 'echarts'; -import { formatNum, numberWithCommas } from '../../../../helpers/formatter'; -import { getInterval, judgeInterval } from '../../../../helpers/judge-interval'; +import { formatNum, numberWithCommas } from '../../../../../helpers/formatter'; +import { getInterval, judgeInterval } from '../../../../../helpers/judge-interval'; const LIGHT_THEME = { FG_COLOR: '#24292F', BG_COLOR: '#ffffff', diff --git a/src/pages/ContentScripts/features/repo-header-labels/ContributorChart.tsx b/src/pages/ContentScripts/features/github/repo-header-labels/ContributorChart.tsx similarity index 95% rename from src/pages/ContentScripts/features/repo-header-labels/ContributorChart.tsx rename to src/pages/ContentScripts/features/github/repo-header-labels/ContributorChart.tsx index fd38ff81..564c3351 100644 --- a/src/pages/ContentScripts/features/repo-header-labels/ContributorChart.tsx +++ b/src/pages/ContentScripts/features/github/repo-header-labels/ContributorChart.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef } from 'react'; import * as echarts from 'echarts'; -import { formatNum, numberWithCommas } from '../../../../helpers/formatter'; -import { getInterval, judgeInterval } from '../../../../helpers/judge-interval'; +import { formatNum, numberWithCommas } from '../../../../../helpers/formatter'; +import { getInterval, judgeInterval } from '../../../../../helpers/judge-interval'; const LIGHT_THEME = { FG_COLOR: '#24292F', BG_COLOR: '#ffffff', diff --git a/src/pages/ContentScripts/features/repo-header-labels/OpenRankChart.tsx b/src/pages/ContentScripts/features/github/repo-header-labels/OpenRankChart.tsx similarity index 95% rename from src/pages/ContentScripts/features/repo-header-labels/OpenRankChart.tsx rename to src/pages/ContentScripts/features/github/repo-header-labels/OpenRankChart.tsx index 92ff065a..b1f5ef21 100644 --- a/src/pages/ContentScripts/features/repo-header-labels/OpenRankChart.tsx +++ b/src/pages/ContentScripts/features/github/repo-header-labels/OpenRankChart.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef } from 'react'; import * as echarts from 'echarts'; -import { formatNum, numberWithCommas } from '../../../../helpers/formatter'; -import { getInterval, judgeInterval } from '../../../../helpers/judge-interval'; +import { formatNum, numberWithCommas } from '../../../../../helpers/formatter'; +import { getInterval, judgeInterval } from '../../../../../helpers/judge-interval'; const LIGHT_THEME = { FG_COLOR: '#24292F', BG_COLOR: '#ffffff', diff --git a/src/pages/ContentScripts/features/repo-header-labels/ParticipantChart.tsx b/src/pages/ContentScripts/features/github/repo-header-labels/ParticipantChart.tsx similarity index 95% rename from src/pages/ContentScripts/features/repo-header-labels/ParticipantChart.tsx rename to src/pages/ContentScripts/features/github/repo-header-labels/ParticipantChart.tsx index 86324646..985e2b86 100644 --- a/src/pages/ContentScripts/features/repo-header-labels/ParticipantChart.tsx +++ b/src/pages/ContentScripts/features/github/repo-header-labels/ParticipantChart.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef } from 'react'; import * as echarts from 'echarts'; -import { formatNum, numberWithCommas } from '../../../../helpers/formatter'; -import { getInterval, judgeInterval } from '../../../../helpers/judge-interval'; +import { formatNum, numberWithCommas } from '../../../../../helpers/formatter'; +import { getInterval, judgeInterval } from '../../../../../helpers/judge-interval'; const LIGHT_THEME = { FG_COLOR: '#24292F', BG_COLOR: '#ffffff', diff --git a/src/pages/ContentScripts/features/repo-header-labels/activityView.tsx b/src/pages/ContentScripts/features/github/repo-header-labels/activityView.tsx similarity index 76% rename from src/pages/ContentScripts/features/repo-header-labels/activityView.tsx rename to src/pages/ContentScripts/features/github/repo-header-labels/activityView.tsx index 256f48f2..29b243ef 100644 --- a/src/pages/ContentScripts/features/repo-header-labels/activityView.tsx +++ b/src/pages/ContentScripts/features/github/repo-header-labels/activityView.tsx @@ -1,14 +1,14 @@ -import getGithubTheme from '../../../../helpers/get-github-theme'; -import { isNull } from '../../../../helpers/is-null'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import { isNull } from '../../../../../helpers/is-null'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; import ActivityChart from './ActivityChart'; -import { RepoMeta } from '../../../../api/common'; +import { RepoMeta } from '../../../../../api/common'; import React, { useState, useEffect } from 'react'; -import TooltipTrigger from '../../../../components/TooltipTrigger'; +import TooltipTrigger from '../../../../../components/TooltipTrigger'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); interface Props { diff --git a/src/pages/ContentScripts/features/repo-header-labels/index.tsx b/src/pages/ContentScripts/features/github/repo-header-labels/index.tsx similarity index 78% rename from src/pages/ContentScripts/features/repo-header-labels/index.tsx rename to src/pages/ContentScripts/features/github/repo-header-labels/index.tsx index fe4f9a6e..8a9c46dc 100644 --- a/src/pages/ContentScripts/features/repo-header-labels/index.tsx +++ b/src/pages/ContentScripts/features/github/repo-header-labels/index.tsx @@ -1,17 +1,18 @@ -import features from '../../../../feature-manager'; +import features from '../../../../../feature-manager'; import View from './view'; import ActivityView from './activityView'; import OpenrankView from './openrankView'; import ParticipantView from './participantView'; -import { NativePopover } from '../../components/NativePopover'; +import { NativePopover } from '../../../components/NativePopover'; import elementReady from 'element-ready'; -import { getRepoName, hasRepoContainerHeader, isPublicRepoWithMeta } from '../../../../helpers/get-repo-info'; -import { getActivity, getOpenrank, getParticipant, getContributor } from '../../../../api/repo'; -import { RepoMeta, metaStore } from '../../../../api/common'; +import { getRepoName, hasRepoContainerHeader, isPublicRepoWithMeta } from '../../../../../helpers/get-repo-info'; +import { getActivity, getOpenrank, getParticipant, getContributor } from '../../../../../api/repo'; +import { RepoMeta, metaStore } from '../../../../../api/common'; import React from 'react'; import $ from 'jquery'; import { createRoot } from 'react-dom/client'; -import isGithub from '../../../../helpers/is-github'; +import isGitHub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); let repoName: string; @@ -22,11 +23,12 @@ let contributor: any; let meta: RepoMeta; const getData = async () => { - activity = await getActivity(repoName); - openrank = await getOpenrank(repoName); - participant = await getParticipant(repoName); - contributor = await getContributor(repoName); - meta = (await metaStore.get(repoName)) as RepoMeta; + const platform = getPlatform(); + activity = await getActivity(platform, repoName); + openrank = await getOpenrank(platform, repoName); + participant = await getParticipant(platform, repoName); + contributor = await getContributor(platform, repoName); + meta = (await metaStore.get(platform, repoName)) as RepoMeta; }; const renderTo = (container: any) => { @@ -87,7 +89,7 @@ const restore = async () => { }; features.add(featureId, { - asLongAs: [isGithub, isPublicRepoWithMeta, hasRepoContainerHeader], + asLongAs: [isGitHub, () => isPublicRepoWithMeta(getPlatform()), hasRepoContainerHeader], awaitDomReady: false, init, restore, diff --git a/src/pages/ContentScripts/features/repo-header-labels/openrankView.tsx b/src/pages/ContentScripts/features/github/repo-header-labels/openrankView.tsx similarity index 76% rename from src/pages/ContentScripts/features/repo-header-labels/openrankView.tsx rename to src/pages/ContentScripts/features/github/repo-header-labels/openrankView.tsx index 56907955..3950d6ca 100644 --- a/src/pages/ContentScripts/features/repo-header-labels/openrankView.tsx +++ b/src/pages/ContentScripts/features/github/repo-header-labels/openrankView.tsx @@ -1,14 +1,14 @@ -import getGithubTheme from '../../../../helpers/get-github-theme'; -import { isNull } from '../../../../helpers/is-null'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import { isNull } from '../../../../../helpers/is-null'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; import OpenRankChart from './OpenRankChart'; -import { RepoMeta } from '../../../../api/common'; +import { RepoMeta } from '../../../../../api/common'; import React, { useState, useEffect } from 'react'; -import TooltipTrigger from '../../../../components/TooltipTrigger'; +import TooltipTrigger from '../../../../../components/TooltipTrigger'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); interface Props { diff --git a/src/pages/ContentScripts/features/repo-header-labels/participantView.tsx b/src/pages/ContentScripts/features/github/repo-header-labels/participantView.tsx similarity index 84% rename from src/pages/ContentScripts/features/repo-header-labels/participantView.tsx rename to src/pages/ContentScripts/features/github/repo-header-labels/participantView.tsx index 2066ff15..3b2479e2 100644 --- a/src/pages/ContentScripts/features/repo-header-labels/participantView.tsx +++ b/src/pages/ContentScripts/features/github/repo-header-labels/participantView.tsx @@ -1,15 +1,15 @@ -import getGithubTheme from '../../../../helpers/get-github-theme'; -import { isNull } from '../../../../helpers/is-null'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import { isNull } from '../../../../../helpers/is-null'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; import ParticipantChart from './ParticipantChart'; import ContributorChart from './ContributorChart'; -import { RepoMeta } from '../../../../api/common'; +import { RepoMeta } from '../../../../../api/common'; import React, { useState, useEffect } from 'react'; -import TooltipTrigger from '../../../../components/TooltipTrigger'; +import TooltipTrigger from '../../../../../components/TooltipTrigger'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); interface Props { diff --git a/src/pages/ContentScripts/features/repo-header-labels/view.tsx b/src/pages/ContentScripts/features/github/repo-header-labels/view.tsx similarity index 93% rename from src/pages/ContentScripts/features/repo-header-labels/view.tsx rename to src/pages/ContentScripts/features/github/repo-header-labels/view.tsx index 28554d02..724834a4 100644 --- a/src/pages/ContentScripts/features/repo-header-labels/view.tsx +++ b/src/pages/ContentScripts/features/github/repo-header-labels/view.tsx @@ -1,12 +1,12 @@ -import getGithubTheme from '../../../../helpers/get-github-theme'; -import { isNull } from '../../../../helpers/is-null'; -import { numberWithCommas } from '../../../../helpers/formatter'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; -import { RepoMeta } from '../../../../api/common'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import { isNull } from '../../../../../helpers/is-null'; +import { numberWithCommas } from '../../../../../helpers/formatter'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; +import { RepoMeta } from '../../../../../api/common'; import React, { useState, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); interface Props { diff --git a/src/pages/ContentScripts/features/repo-issue-tooltip/IssueChart.tsx b/src/pages/ContentScripts/features/github/repo-issue-tooltip/IssueChart.tsx similarity index 96% rename from src/pages/ContentScripts/features/repo-issue-tooltip/IssueChart.tsx rename to src/pages/ContentScripts/features/github/repo-issue-tooltip/IssueChart.tsx index 177f67e9..005c88b3 100644 --- a/src/pages/ContentScripts/features/repo-issue-tooltip/IssueChart.tsx +++ b/src/pages/ContentScripts/features/github/repo-issue-tooltip/IssueChart.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef } from 'react'; import * as echarts from 'echarts'; -import { formatNum, numberWithCommas } from '../../../../helpers/formatter'; -import { getInterval, judgeInterval } from '../../../../helpers/judge-interval'; +import { formatNum, numberWithCommas } from '../../../../../helpers/formatter'; +import { getInterval, judgeInterval } from '../../../../../helpers/judge-interval'; const LIGHT_THEME = { FG_COLOR: '#24292F', BG_COLOR: '#ffffff', diff --git a/src/pages/ContentScripts/features/repo-issue-tooltip/index.tsx b/src/pages/ContentScripts/features/github/repo-issue-tooltip/index.tsx similarity index 56% rename from src/pages/ContentScripts/features/repo-issue-tooltip/index.tsx rename to src/pages/ContentScripts/features/github/repo-issue-tooltip/index.tsx index 3453e368..fe9a90f5 100644 --- a/src/pages/ContentScripts/features/repo-issue-tooltip/index.tsx +++ b/src/pages/ContentScripts/features/github/repo-issue-tooltip/index.tsx @@ -1,16 +1,17 @@ -import features from '../../../../feature-manager'; +import features from '../../../../../feature-manager'; import View, { IssueDetail } from './view'; -import { NativePopover } from '../../components/NativePopover'; +import { NativePopover } from '../../../components/NativePopover'; import elementReady from 'element-ready'; -import { getRepoName, isPublicRepoWithMeta } from '../../../../helpers/get-repo-info'; -import { getIssuesOpened, getIssuesClosed, getIssueComments } from '../../../../api/repo'; +import { getRepoName, isPublicRepoWithMeta } from '../../../../../helpers/get-repo-info'; +import { getIssuesOpened, getIssuesClosed, getIssueComments } from '../../../../../api/repo'; -import { RepoMeta, metaStore } from '../../../../api/common'; +import { RepoMeta, metaStore } from '../../../../../api/common'; import React from 'react'; import { createRoot } from 'react-dom/client'; import $ from 'jquery'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); let repoName: string; @@ -22,10 +23,11 @@ let issueDetail: IssueDetail = { let meta: RepoMeta; const getData = async () => { - issueDetail.issuesOpened = await getIssuesOpened(repoName); - issueDetail.issuesClosed = await getIssuesClosed(repoName); - issueDetail.issueComments = await getIssueComments(repoName); - meta = (await metaStore.get(repoName)) as RepoMeta; + const platform = getPlatform(); + issueDetail.issuesOpened = await getIssuesOpened(platform, repoName); + issueDetail.issuesClosed = await getIssuesClosed(platform, repoName); + issueDetail.issueComments = await getIssueComments(platform, repoName); + meta = (await metaStore.get(getPlatform(), repoName)) as RepoMeta; }; const init = async (): Promise => { @@ -45,7 +47,7 @@ const init = async (): Promise => { const restore = async () => {}; features.add(featureId, { - asLongAs: [isGithub, isPublicRepoWithMeta], + asLongAs: [isGithub, () => isPublicRepoWithMeta(getPlatform())], awaitDomReady: false, init, restore, diff --git a/src/pages/ContentScripts/features/repo-issue-tooltip/view.tsx b/src/pages/ContentScripts/features/github/repo-issue-tooltip/view.tsx similarity index 85% rename from src/pages/ContentScripts/features/repo-issue-tooltip/view.tsx rename to src/pages/ContentScripts/features/github/repo-issue-tooltip/view.tsx index c684e4b1..5e270c14 100644 --- a/src/pages/ContentScripts/features/repo-issue-tooltip/view.tsx +++ b/src/pages/ContentScripts/features/github/repo-issue-tooltip/view.tsx @@ -1,14 +1,14 @@ import React, { useState, useEffect } from 'react'; -import getGithubTheme from '../../../../helpers/get-github-theme'; -import { isNull, isAllNull } from '../../../../helpers/is-null'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import { isNull, isAllNull } from '../../../../../helpers/is-null'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; import IssueChart from './IssueChart'; -import { RepoMeta } from '../../../../api/common'; -import TooltipTrigger from '../../../../components/TooltipTrigger'; +import { RepoMeta } from '../../../../../api/common'; +import TooltipTrigger from '../../../../../components/TooltipTrigger'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); export interface IssueDetail { diff --git a/src/pages/ContentScripts/features/repo-networks/DataNotFound.tsx b/src/pages/ContentScripts/features/github/repo-networks/DataNotFound.tsx similarity index 100% rename from src/pages/ContentScripts/features/repo-networks/DataNotFound.tsx rename to src/pages/ContentScripts/features/github/repo-networks/DataNotFound.tsx diff --git a/src/pages/ContentScripts/features/repo-networks/index.tsx b/src/pages/ContentScripts/features/github/repo-networks/index.tsx similarity index 79% rename from src/pages/ContentScripts/features/repo-networks/index.tsx rename to src/pages/ContentScripts/features/github/repo-networks/index.tsx index f643b976..7933c2be 100644 --- a/src/pages/ContentScripts/features/repo-networks/index.tsx +++ b/src/pages/ContentScripts/features/github/repo-networks/index.tsx @@ -1,13 +1,13 @@ import React from 'react'; import $ from 'jquery'; -import features from '../../../../feature-manager'; -import isPerceptor from '../../../../helpers/is-perceptor'; +import features from '../../../../../feature-manager'; +import isPerceptor from '../../../../../helpers/is-perceptor'; import View from './view'; import elementReady from 'element-ready'; import { createRoot } from 'react-dom/client'; -import { getRepoName } from '../../../../helpers/get-repo-info'; -import isGithub from '../../../../helpers/is-github'; +import { getRepoName } from '../../../../../helpers/get-repo-info'; +import isGithub from '../../../../../helpers/is-github'; const featureId = features.getFeatureID(import.meta.url); let repoName: string; diff --git a/src/pages/ContentScripts/features/repo-networks/view.tsx b/src/pages/ContentScripts/features/github/repo-networks/view.tsx similarity index 97% rename from src/pages/ContentScripts/features/repo-networks/view.tsx rename to src/pages/ContentScripts/features/github/repo-networks/view.tsx index ee54d279..53d1b18c 100644 --- a/src/pages/ContentScripts/features/repo-networks/view.tsx +++ b/src/pages/ContentScripts/features/github/repo-networks/view.tsx @@ -1,9 +1,9 @@ import React, { useState, useEffect } from 'react'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; -import OSGraph from '../../../../components/OSGraph'; +import '../../../../../helpers/i18n'; +import OSGraph from '../../../../../components/OSGraph'; interface Props { repoName: string; diff --git a/src/pages/ContentScripts/features/repo-pr-tooltip/MergedLinesChart.tsx b/src/pages/ContentScripts/features/github/repo-pr-tooltip/MergedLinesChart.tsx similarity index 96% rename from src/pages/ContentScripts/features/repo-pr-tooltip/MergedLinesChart.tsx rename to src/pages/ContentScripts/features/github/repo-pr-tooltip/MergedLinesChart.tsx index 7ff01b06..966052c2 100644 --- a/src/pages/ContentScripts/features/repo-pr-tooltip/MergedLinesChart.tsx +++ b/src/pages/ContentScripts/features/github/repo-pr-tooltip/MergedLinesChart.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef } from 'react'; import * as echarts from 'echarts'; -import { formatNum, numberWithCommas } from '../../../../helpers/formatter'; -import { getInterval, judgeInterval } from '../../../../helpers/judge-interval'; +import { formatNum, numberWithCommas } from '../../../../../helpers/formatter'; +import { getInterval, judgeInterval } from '../../../../../helpers/judge-interval'; const LIGHT_THEME = { FG_COLOR: '#24292F', BG_COLOR: '#ffffff', diff --git a/src/pages/ContentScripts/features/repo-pr-tooltip/PRChart.tsx b/src/pages/ContentScripts/features/github/repo-pr-tooltip/PRChart.tsx similarity index 96% rename from src/pages/ContentScripts/features/repo-pr-tooltip/PRChart.tsx rename to src/pages/ContentScripts/features/github/repo-pr-tooltip/PRChart.tsx index e2163a52..ecf26ce7 100644 --- a/src/pages/ContentScripts/features/repo-pr-tooltip/PRChart.tsx +++ b/src/pages/ContentScripts/features/github/repo-pr-tooltip/PRChart.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef } from 'react'; import * as echarts from 'echarts'; -import { formatNum, numberWithCommas } from '../../../../helpers/formatter'; -import { getInterval, judgeInterval } from '../../../../helpers/judge-interval'; +import { formatNum, numberWithCommas } from '../../../../../helpers/formatter'; +import { getInterval, judgeInterval } from '../../../../../helpers/judge-interval'; const LIGHT_THEME = { FG_COLOR: '#24292F', diff --git a/src/pages/ContentScripts/features/repo-pr-tooltip/index.tsx b/src/pages/ContentScripts/features/github/repo-pr-tooltip/index.tsx similarity index 54% rename from src/pages/ContentScripts/features/repo-pr-tooltip/index.tsx rename to src/pages/ContentScripts/features/github/repo-pr-tooltip/index.tsx index bf3fa221..25cacad3 100644 --- a/src/pages/ContentScripts/features/repo-pr-tooltip/index.tsx +++ b/src/pages/ContentScripts/features/github/repo-pr-tooltip/index.tsx @@ -1,8 +1,8 @@ -import features from '../../../../feature-manager'; +import features from '../../../../../feature-manager'; import View, { PRDetail } from './view'; -import { NativePopover } from '../../components/NativePopover'; +import { NativePopover } from '../../../components/NativePopover'; import elementReady from 'element-ready'; -import { getRepoName, isPublicRepoWithMeta } from '../../../../helpers/get-repo-info'; +import { getRepoName, isPublicRepoWithMeta } from '../../../../../helpers/get-repo-info'; import { createRoot } from 'react-dom/client'; import { getPROpened, @@ -10,12 +10,13 @@ import { getPRReviews, getMergedCodeAddition, getMergedCodeDeletion, -} from '../../../../api/repo'; -import { RepoMeta, metaStore } from '../../../../api/common'; +} from '../../../../../api/repo'; +import { RepoMeta, metaStore } from '../../../../../api/common'; import React from 'react'; import $ from 'jquery'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); let repoName: string; @@ -29,12 +30,13 @@ let PRDetail: PRDetail = { let meta: RepoMeta; const getData = async () => { - PRDetail.PROpened = await getPROpened(repoName); - PRDetail.PRMerged = await getPRMerged(repoName); - PRDetail.PRReviews = await getPRReviews(repoName); - PRDetail.mergedCodeAddition = await getMergedCodeAddition(repoName); - PRDetail.mergedCodeDeletion = await getMergedCodeDeletion(repoName); - meta = (await metaStore.get(repoName)) as RepoMeta; + const platform = getPlatform(); + PRDetail.PROpened = await getPROpened(platform, repoName); + PRDetail.PRMerged = await getPRMerged(platform, repoName); + PRDetail.PRReviews = await getPRReviews(platform, repoName); + PRDetail.mergedCodeAddition = await getMergedCodeAddition(platform, repoName); + PRDetail.mergedCodeDeletion = await getMergedCodeDeletion(platform, repoName); + meta = (await metaStore.get(platform, repoName)) as RepoMeta; }; const init = async (): Promise => { @@ -54,7 +56,7 @@ const init = async (): Promise => { const restore = async () => {}; features.add(featureId, { - asLongAs: [isGithub, isPublicRepoWithMeta], + asLongAs: [isGithub, () => isPublicRepoWithMeta(getPlatform())], awaitDomReady: false, init, restore, diff --git a/src/pages/ContentScripts/features/repo-pr-tooltip/view.tsx b/src/pages/ContentScripts/features/github/repo-pr-tooltip/view.tsx similarity index 89% rename from src/pages/ContentScripts/features/repo-pr-tooltip/view.tsx rename to src/pages/ContentScripts/features/github/repo-pr-tooltip/view.tsx index 772d7959..7f392e29 100644 --- a/src/pages/ContentScripts/features/repo-pr-tooltip/view.tsx +++ b/src/pages/ContentScripts/features/github/repo-pr-tooltip/view.tsx @@ -1,14 +1,14 @@ import React, { useState, useEffect } from 'react'; -import getGithubTheme from '../../../../helpers/get-github-theme'; -import { isNull, isAllNull } from '../../../../helpers/is-null'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import { isNull, isAllNull } from '../../../../../helpers/is-null'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; import PRChart from './PRChart'; import MergedLinesChart from './MergedLinesChart'; -import { RepoMeta } from '../../../../api/common'; -import TooltipTrigger from '../../../../components/TooltipTrigger'; +import { RepoMeta } from '../../../../../api/common'; +import TooltipTrigger from '../../../../../components/TooltipTrigger'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); export interface PRDetail { PROpened: any; diff --git a/src/pages/ContentScripts/features/repo-sidebar-labels/OpenDiggerLabel.tsx b/src/pages/ContentScripts/features/github/repo-sidebar-labels/OpenDiggerLabel.tsx similarity index 93% rename from src/pages/ContentScripts/features/repo-sidebar-labels/OpenDiggerLabel.tsx rename to src/pages/ContentScripts/features/github/repo-sidebar-labels/OpenDiggerLabel.tsx index 2145681d..35e6459d 100644 --- a/src/pages/ContentScripts/features/repo-sidebar-labels/OpenDiggerLabel.tsx +++ b/src/pages/ContentScripts/features/github/repo-sidebar-labels/OpenDiggerLabel.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Label } from '../../../../api/common'; +import { Label } from '../../../../../api/common'; interface OpenDiggerLabelProps { label: Label; diff --git a/src/pages/ContentScripts/features/repo-sidebar-labels/index.tsx b/src/pages/ContentScripts/features/github/repo-sidebar-labels/index.tsx similarity index 77% rename from src/pages/ContentScripts/features/repo-sidebar-labels/index.tsx rename to src/pages/ContentScripts/features/github/repo-sidebar-labels/index.tsx index 90bee42e..ca037ed3 100644 --- a/src/pages/ContentScripts/features/repo-sidebar-labels/index.tsx +++ b/src/pages/ContentScripts/features/github/repo-sidebar-labels/index.tsx @@ -1,17 +1,18 @@ -import features from '../../../../feature-manager'; -import { getRepoName, hasRepoContainerHeader, isPublicRepoWithMeta } from '../../../../helpers/get-repo-info'; -import { Label, RepoMeta, metaStore } from '../../../../api/common'; +import features from '../../../../../feature-manager'; +import { getRepoName, hasRepoContainerHeader, isPublicRepoWithMeta } from '../../../../../helpers/get-repo-info'; +import { Label, RepoMeta, metaStore } from '../../../../../api/common'; import { createRoot } from 'react-dom/client'; import OpenDiggerLabel from './OpenDiggerLabel'; import React from 'react'; import $ from 'jquery'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); const getLabels = async (repoName: string) => { - const meta = (await metaStore.get(repoName)) as RepoMeta; + const meta = (await metaStore.get(getPlatform(), repoName)) as RepoMeta; // filtered all xxx-n and n is not 0 return meta.labels?.filter((label) => { return !(label.type.includes('-') && parseInt(label.type.split('-')[1]) > 0); @@ -49,7 +50,7 @@ const init = async (): Promise => { }; features.add(featureId, { - asLongAs: [isGithub, isPublicRepoWithMeta, hasRepoContainerHeader], + asLongAs: [isGithub, () => isPublicRepoWithMeta(getPlatform()), hasRepoContainerHeader], awaitDomReady: true, init, }); diff --git a/src/pages/ContentScripts/features/repo-star-tooltip/StarChart.tsx b/src/pages/ContentScripts/features/github/repo-star-tooltip/StarChart.tsx similarity index 95% rename from src/pages/ContentScripts/features/repo-star-tooltip/StarChart.tsx rename to src/pages/ContentScripts/features/github/repo-star-tooltip/StarChart.tsx index a98a7d28..1ca53bcb 100644 --- a/src/pages/ContentScripts/features/repo-star-tooltip/StarChart.tsx +++ b/src/pages/ContentScripts/features/github/repo-star-tooltip/StarChart.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef } from 'react'; import * as echarts from 'echarts'; -import { formatNum, numberWithCommas } from '../../../../helpers/formatter'; -import { getInterval, judgeInterval } from '../../../../helpers/judge-interval'; +import { formatNum, numberWithCommas } from '../../../../../helpers/formatter'; +import { getInterval, judgeInterval } from '../../../../../helpers/judge-interval'; const LIGHT_THEME = { FG_COLOR: '#24292F', BG_COLOR: '#ffffff', diff --git a/src/pages/ContentScripts/features/repo-star-tooltip/index.tsx b/src/pages/ContentScripts/features/github/repo-star-tooltip/index.tsx similarity index 66% rename from src/pages/ContentScripts/features/repo-star-tooltip/index.tsx rename to src/pages/ContentScripts/features/github/repo-star-tooltip/index.tsx index 53bc9354..c730af3b 100644 --- a/src/pages/ContentScripts/features/repo-star-tooltip/index.tsx +++ b/src/pages/ContentScripts/features/github/repo-star-tooltip/index.tsx @@ -1,15 +1,16 @@ -import features from '../../../../feature-manager'; +import features from '../../../../../feature-manager'; import View from './view'; -import { NativePopover } from '../../components/NativePopover'; -import { checkLogined } from '../../../../helpers/get-developer-info'; +import { NativePopover } from '../../../components/NativePopover'; +import { checkLogined } from '../../../../../helpers/get-developer-info'; import elementReady from 'element-ready'; -import { getRepoName, hasRepoContainerHeader, isPublicRepoWithMeta } from '../../../../helpers/get-repo-info'; -import { getStars } from '../../../../api/repo'; -import { RepoMeta, metaStore } from '../../../../api/common'; +import { getRepoName, hasRepoContainerHeader, isPublicRepoWithMeta } from '../../../../../helpers/get-repo-info'; +import { getStars } from '../../../../../api/repo'; +import { RepoMeta, metaStore } from '../../../../../api/common'; import { createRoot } from 'react-dom/client'; import React from 'react'; import $ from 'jquery'; -import isGithub from '../../../../helpers/is-github'; +import isGithub from '../../../../../helpers/is-github'; +import { getPlatform } from '../../../../../helpers/platform-detection'; const featureId = features.getFeatureID(import.meta.url); let repoName: string; @@ -17,8 +18,9 @@ let stars: any; let meta: RepoMeta; const getData = async () => { - stars = await getStars(repoName); - meta = (await metaStore.get(repoName)) as RepoMeta; + const platform = getPlatform(); + stars = await getStars(platform, repoName); + meta = (await metaStore.get(platform, repoName)) as RepoMeta; }; const init = async (): Promise => { @@ -46,7 +48,7 @@ const init = async (): Promise => { const restore = async () => {}; features.add(featureId, { - asLongAs: [isGithub, isPublicRepoWithMeta, hasRepoContainerHeader], + asLongAs: [isGithub, () => isPublicRepoWithMeta(getPlatform()), hasRepoContainerHeader], awaitDomReady: false, init, restore, diff --git a/src/pages/ContentScripts/features/repo-star-tooltip/view.tsx b/src/pages/ContentScripts/features/github/repo-star-tooltip/view.tsx similarity index 78% rename from src/pages/ContentScripts/features/repo-star-tooltip/view.tsx rename to src/pages/ContentScripts/features/github/repo-star-tooltip/view.tsx index 87dbb1dc..d448087e 100644 --- a/src/pages/ContentScripts/features/repo-star-tooltip/view.tsx +++ b/src/pages/ContentScripts/features/github/repo-star-tooltip/view.tsx @@ -1,12 +1,12 @@ import React, { useState, useEffect } from 'react'; -import getGithubTheme from '../../../../helpers/get-github-theme'; -import optionsStorage, { HypercrxOptions, defaults } from '../../../../options-storage'; -import generateDataByMonth from '../../../../helpers/generate-data-by-month'; +import getGithubTheme from '../../../../../helpers/get-github-theme'; +import optionsStorage, { HypercrxOptions, defaults } from '../../../../../options-storage'; +import generateDataByMonth from '../../../../../helpers/generate-data-by-month'; import StarChart from './StarChart'; -import { RepoMeta } from '../../../../api/common'; -import TooltipTrigger from '../../../../components/TooltipTrigger'; +import { RepoMeta } from '../../../../../api/common'; +import TooltipTrigger from '../../../../../components/TooltipTrigger'; import { useTranslation } from 'react-i18next'; -import '../../../../helpers/i18n'; +import '../../../../../helpers/i18n'; const githubTheme = getGithubTheme(); diff --git a/src/pages/ContentScripts/index.ts b/src/pages/ContentScripts/index.ts index 6ae3b54e..1ab94d69 100644 --- a/src/pages/ContentScripts/index.ts +++ b/src/pages/ContentScripts/index.ts @@ -1,18 +1,18 @@ import './index.scss'; -import './features/repo-activity-openrank-trends'; -import './features/developer-activity-openrank-trends'; -import './features/repo-header-labels'; -import './features/repo-fork-tooltip'; -import './features/repo-star-tooltip'; -import './features/repo-pr-tooltip'; -import './features/repo-issue-tooltip'; -import './features/perceptor-tab'; -import './features/perceptor-layout'; -import './features/repo-networks'; -import './features/developer-networks'; -import './features/oss-gpt'; -import './features/repo-activity-racing-bar'; -import './features/developer-hovercard-info'; -import './features/repo-sidebar-labels'; -import './features/fast-pr'; +import './features/github/repo-activity-openrank-trends'; +import './features/github/developer-activity-openrank-trends'; +import './features/github/repo-header-labels'; +import './features/github/repo-fork-tooltip'; +import './features/github/repo-star-tooltip'; +import './features/github/repo-pr-tooltip'; +import './features/github/repo-issue-tooltip'; +import './features/github/perceptor-tab'; +import './features/github/perceptor-layout'; +import './features/github/repo-networks'; +import './features/github/developer-networks'; +import './features/common/oss-gpt'; +import './features/github/repo-activity-racing-bar'; +import './features/github/developer-hovercard-info'; +import './features/github/repo-sidebar-labels'; +import './features/common/fast-pr';