mirror of https://github.com/vizality/vizality
Merge pull request #93 from doggybootsy/stable
Add 'wrapInHooks' and fixes for modules and csspull/95/head
commit
df56ba62f9
@ -1,14 +1,14 @@
|
||||
import { getModuleByDisplayName } from '@vizality/webpack';
|
||||
import { findInReactTree } from '@vizality/util/react';
|
||||
import { findInReactTree, wrapInHooks } from '@vizality/util/react';
|
||||
|
||||
import AsyncComponent from './AsyncComponent';
|
||||
|
||||
export default AsyncComponent.from((async () => {
|
||||
/* Thanks to Harley for this~ */
|
||||
const GuildFolderNode = await getModuleByDisplayName('GuildFolderNode', true);
|
||||
const ModalRoot = GuildFolderNode?.prototype?.render?.call({ props: { transitionState: 0 }, state: { name: '', color: '' } });
|
||||
const SuspendedPicker = findInReactTree(ModalRoot, n => n.props?.defaultColor)?.type;
|
||||
const LazyWebpackModule = await SuspendedPicker()?.props?.children?.type;
|
||||
const mdl = await (LazyWebpackModule?._ctor || LazyWebpackModule?._payload?._result)();
|
||||
return mdl?.default;
|
||||
const GuildSettingsRolesEditDisplay = await getModuleByDisplayName('GuildSettingsRolesEditDisplay', true);
|
||||
const SettingsPageContent = wrapInHooks(() => new GuildSettingsRolesEditDisplay({ guild: { id: '' }, role: { id: '' } }))();
|
||||
const ColorPickerFormItem = findInReactTree(SettingsPageContent, (n) => n.type?.displayName === 'ColorPickerFormItem').type({ role: { id: '' } });
|
||||
const SuspendedPicker = findInReactTree(ColorPickerFormItem, (n) => n.props?.defaultColor).type;
|
||||
const LazyWebpackModule = await SuspendedPicker().props.children.type;
|
||||
const mdl = await (LazyWebpackModule._ctor || LazyWebpackModule._payload._result)();
|
||||
return mdl.default;
|
||||
})());
|
||||
|
Loading…
Reference in new issue