forked from hypertrons/hypertrons-crx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitee-index.tsx
More file actions
32 lines (25 loc) · 882 Bytes
/
Copy pathgitee-index.tsx
File metadata and controls
32 lines (25 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react';
import $ from 'jquery';
import { createRoot } from 'react-dom/client';
import features from '../../../../feature-manager';
import isPerceptor from '../../../../helpers/is-perceptor';
import View from './view';
import isGitee from '../../../../helpers/is-gitee';
const featureId = features.getFeatureID(import.meta.url);
const renderTo = (container: any) => {
createRoot(container).render(<View />);
};
const init = async (): Promise<void> => {
const uiContainer = $('.site-content > .ui.container');
uiContainer.empty();
// create the new one: the percepter container
const percepterContainer = document.createElement('div');
percepterContainer.id = featureId;
uiContainer.append(percepterContainer);
renderTo(percepterContainer);
};
features.add(featureId, {
asLongAs: [isGitee, isPerceptor],
awaitDomReady: false,
init,
});