Skip to content

Commit

Permalink
fix(components): fix missing components on oct 2 2024 beta
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Oct 3, 2024
1 parent 8c6043b commit 0f9fb5a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
9 changes: 6 additions & 3 deletions src/components/DialogCheckbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ export const DialogCheckbox = Object.values(
}),
).find(
(m: any) =>
m.contextType &&
m.prototype?.render.toString().includes('fallback:') &&
m?.prototype?.SetChecked &&
m?.prototype?.Toggle &&
m?.prototype?.GetPanelElementProps,
m?.prototype?.GetPanelElementProps &&
// beta || stable as of oct 2 2024
(m?.prototype?.render?.toString().includes('="DialogCheckbox"') || (
m.contextType &&
m.prototype?.render.toString().includes('fallback:')
))
) as FC<DialogCheckboxProps>;
8 changes: 3 additions & 5 deletions src/components/Modal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC, ReactNode } from 'react';

import { findSP } from '../utils';
import { Export, findModule, findModuleByExport, findModuleExport } from '../webpack';
import { Export, findModule, findModuleDetailsByExport, findModuleExport } from '../webpack';

// All of the popout options + strTitle are related. Proper usage is not yet known...
export interface ShowModalProps {
Expand Down Expand Up @@ -105,7 +105,7 @@ interface SimpleModalProps {
children: ReactNode;
}

const ModalModule = findModuleByExport((e: Export) => e?.toString().includes('.ModalPosition,fallback:'), 5);
const [ModalModule, _ModalPosition] = findModuleDetailsByExport((e: Export) => e?.toString().includes('.ModalPosition'), 5)

const ModalModuleProps = ModalModule ? Object.values(ModalModule) : [];

Expand All @@ -114,6 +114,4 @@ export const SimpleModal = ModalModuleProps.find((prop) => {
return string?.includes('.ShowPortalModal()') && string?.includes('.OnElementReadyCallbacks.Register(');
}) as FC<SimpleModalProps>;

export const ModalPosition = ModalModuleProps.find((prop) =>
prop?.toString().includes('.ModalPosition,fallback:'),
) as FC<SimpleModalProps>;
export const ModalPosition = _ModalPosition as FC<SimpleModalProps>;
3 changes: 2 additions & 1 deletion src/components/SliderField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ export interface SliderFieldProps extends ItemProps {
}

export const SliderField = Object.values(CommonUIModule).find((mod: any) =>
mod?.toString()?.includes('SliderField,fallback'),
// stable || beta as of oct 2 2024
mod?.toString()?.includes('SliderField,fallback') || mod?.toString()?.includes("SliderField\",")
) as FC<SliderFieldProps>;
3 changes: 2 additions & 1 deletion src/components/ToggleField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export interface ToggleFieldProps extends ItemProps {
}

export const ToggleField = Object.values(CommonUIModule).find((mod: any) =>
mod?.render?.toString()?.includes('ToggleField,fallback'),
// stable || beta as of oct 2 2024
mod?.render?.toString()?.includes('ToggleField,fallback') || mod?.render?.toString()?.includes("ToggleField\",")
) as FC<ToggleFieldProps>;

0 comments on commit 0f9fb5a

Please sign in to comment.