Rename ReactComponentHelpers to ReactHelpers
This commit is contained in:
parent
7f5fa44fd3
commit
554b8d195b
|
@ -16,7 +16,7 @@ export { default as Vendor } from './vendor';
|
|||
|
||||
export * from './webpackmodules';
|
||||
export * from './patcher';
|
||||
export { ReactComponents, ReactAutoPatcher, Helpers as ReactComponentHelpers } from './reactcomponents';
|
||||
export * from './reactcomponents';
|
||||
export { default as EventListener } from './eventlistener';
|
||||
export { default as SocketProxy } from './socketproxy';
|
||||
export { default as EventHook } from './eventhook';
|
||||
|
|
|
@ -16,7 +16,7 @@ import { MonkeyPatch, Patcher } from './patcher';
|
|||
import { WebpackModules, Filters } from './webpackmodules';
|
||||
import DiscordApi from './discordapi';
|
||||
|
||||
export class Helpers {
|
||||
class Helpers {
|
||||
static get plannedActions() {
|
||||
return this._plannedActions || (this._plannedActions = new Map());
|
||||
}
|
||||
|
@ -163,6 +163,8 @@ export class Helpers {
|
|||
}
|
||||
}
|
||||
|
||||
export { Helpers as ReactHelpers };
|
||||
|
||||
class ReactComponent {
|
||||
constructor(id, component, retVal) {
|
||||
this._id = id;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import { EventListener, ReactComponents, ReactComponentHelpers as Helpers, MonkeyPatch } from 'modules';
|
||||
import { EventListener, ReactComponents, ReactHelpers, MonkeyPatch } from 'modules';
|
||||
import { ClientLogger as Logger } from 'common';
|
||||
import DOM from './dom';
|
||||
import { BdBadge, BdMessageBadge } from './components/bd';
|
||||
|
@ -110,7 +110,7 @@ export default class extends EventListener {
|
|||
this.unpatchChannelMemberRender = MonkeyPatch('ProfileBadges', ChannelMember.component.prototype).after('render', (component, args, retVal) => {
|
||||
if (!retVal.props || !retVal.props.children) return;
|
||||
|
||||
const user = Helpers.findProp(component, 'user');
|
||||
const user = ReactHelpers.findProp(component, 'user');
|
||||
if (!user) return;
|
||||
const c = contributors.find(c => c.id === user.id);
|
||||
if (!c) return;
|
||||
|
@ -135,7 +135,7 @@ export default class extends EventListener {
|
|||
try {
|
||||
if (!retVal.props || !retVal.props.children) return;
|
||||
|
||||
const user = Helpers.findProp(this, 'user');
|
||||
const user = ReactHelpers.findProp(this, 'user');
|
||||
if (!user) return;
|
||||
const c = contributors.find(c => c.id === user.id);
|
||||
if (!c) return;
|
||||
|
@ -151,24 +151,28 @@ export default class extends EventListener {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const element = Helpers.ReactDOM.findDOMNode(this);
|
||||
const element = ReactHelpers.ReactDOM.findDOMNode(this);
|
||||
if (!element) return;
|
||||
ProfileBadges.injectMessageBadges(element);
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const element = Helpers.ReactDOM.findDOMNode(this);
|
||||
const element = ReactHelpers.ReactDOM.findDOMNode(this);
|
||||
if (!element) return;
|
||||
// ProfileBadges.injectMessageBadges(element);
|
||||
ProfileBadges.injectMessageBadges(element);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
injectMessageBadges(element) {
|
||||
for (const beo of element.getElementsByClassName('bd-badge-outer')) this.injectNameTagBadge(beo);
|
||||
for (const beo of element.getElementsByClassName('bd-badge-outer')) this.injectMessageBadge(beo);
|
||||
}
|
||||
|
||||
injectMessageBadge(root) {
|
||||
while (root.firstChild) {
|
||||
root.removeChild(root.firstChild);
|
||||
}
|
||||
|
||||
const { userid } = root.dataset;
|
||||
if (!userid) return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue