From e5bd5534db78103b522ab7f977a45c238492c870 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sun, 14 Apr 2024 01:35:04 +0200 Subject: [PATCH] Fix SpotifyControls --- .../spotifyControls/PlayerComponent.tsx | 18 ++++------- src/plugins/spotifyControls/index.tsx | 30 +++++++++++++++---- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/plugins/spotifyControls/PlayerComponent.tsx b/src/plugins/spotifyControls/PlayerComponent.tsx index ae28631c9..105b3b18a 100644 --- a/src/plugins/spotifyControls/PlayerComponent.tsx +++ b/src/plugins/spotifyControls/PlayerComponent.tsx @@ -18,7 +18,6 @@ import "./spotifyStyles.css"; -import ErrorBoundary from "@components/ErrorBoundary"; import { Flex } from "@components/Flex"; import { ImageIcon, LinkIcon, OpenExternalIcon } from "@components/Icons"; import { debounce } from "@shared/debounce"; @@ -376,17 +375,10 @@ export function Player() { } as React.CSSProperties; return ( - ( -
-

Failed to render Spotify Modal :(

-

Check the console for errors

-
- )}> -
- - - -
-
+
+ + + +
); } diff --git a/src/plugins/spotifyControls/index.tsx b/src/plugins/spotifyControls/index.tsx index d7e4f6454..06595892f 100644 --- a/src/plugins/spotifyControls/index.tsx +++ b/src/plugins/spotifyControls/index.tsx @@ -18,6 +18,7 @@ import { Settings } from "@api/Settings"; import { disableStyle, enableStyle } from "@api/Styles"; +import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; @@ -49,10 +50,10 @@ export default definePlugin({ { find: "showTaglessAccountPanel:", replacement: { - // return React.createElement(AccountPanel, { ..., showTaglessAccountPanel: blah }) - match: /return ?(.{0,30}\(.{1,3},\{[^}]+?,showTaglessAccountPanel:.+?\}\))/, - // return [Player, Panel] - replace: "return [$self.renderPlayer(),$1]" + // react.jsx)(AccountPanel, { ..., showTaglessAccountPanel: blah }) + match: /(?<=\i\.jsxs?\)\()(\i),{(?=[^}]*?showTaglessAccountPanel:)/, + // react.jsx(WrapperComponent, { VencordOriginal: AccountPanel, ... + replace: "$self.PanelWrapper,{VencordOriginal:$1," } }, { @@ -78,6 +79,25 @@ export default definePlugin({ } } ], + start: () => toggleHoverControls(Settings.plugins.SpotifyControls.hoverControls), - renderPlayer: () => + + PanelWrapper({ VencordOriginal, ...props }) { + return ( + <> + ( +
+

Failed to render Spotify Modal :(

+

Check the console for errors

+
+ )} + > + +
+ + + + ); + } });