mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-19 09:30:08 +02:00
fix: fix <Menu /> for new Steam Client Beta
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { FC, ReactNode } from 'react';
|
import { FC, ReactNode } from 'react';
|
||||||
|
|
||||||
import { Export, findModuleByExport, findModuleExport } from '../webpack';
|
import { Export, findModuleByExport, findModuleDetailsByExport, findModuleExport } from '../webpack';
|
||||||
import { FooterLegendProps } from './FooterLegend';
|
import { FooterLegendProps } from './FooterLegend';
|
||||||
|
|
||||||
interface PopupCreationOptions {
|
interface PopupCreationOptions {
|
||||||
@@ -134,9 +134,11 @@ export interface MenuProps extends FooterLegendProps {
|
|||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Menu: FC<MenuProps> = findModuleExport(
|
const MenuModule = findModuleDetailsByExport((e: Export) => e?.render?.toString()?.includes('bPlayAudio:') || (e?.prototype?.OnOKButton && e?.prototype?.OnMouseEnter));
|
||||||
(e: Export) => e?.prototype?.HideIfSubmenu && e?.prototype?.HideMenu,
|
|
||||||
);
|
export const Menu: FC<MenuProps> =
|
||||||
|
findModuleExport((e: Export) => e?.prototype?.HideIfSubmenu && e?.prototype?.HideMenu) || // Legacy Menu
|
||||||
|
(Object.values(MenuModule?.[0]).find((e) => e?.toString().includes(`useId`) && e?.toString().includes(`labelId`)) as FC<MenuProps>); // New Menu 6/15/2025
|
||||||
|
|
||||||
export interface MenuGroupProps {
|
export interface MenuGroupProps {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -159,10 +161,7 @@ export interface MenuItemProps extends FooterLegendProps {
|
|||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MenuItem: FC<MenuItemProps> = findModuleExport(
|
export const MenuItem: FC<MenuItemProps> = MenuModule?.[1];
|
||||||
(e: Export) =>
|
|
||||||
e?.render?.toString?.()?.includes('bPlayAudio:') || (e?.prototype?.OnOKButton && e?.prototype?.OnMouseEnter),
|
|
||||||
);
|
|
||||||
|
|
||||||
export const MenuSeparator: FC = findModuleExport(
|
export const MenuSeparator: FC = findModuleExport(
|
||||||
(e: Export) => typeof e === 'function' && /className:.+?\.ContextMenuSeparator/.test(e.toString()),
|
(e: Export) => typeof e === 'function' && /className:.+?\.ContextMenuSeparator/.test(e.toString()),
|
||||||
|
|||||||
Reference in New Issue
Block a user