Fix SpotifyControls
This commit is contained in:
parent
89dc74d5d7
commit
e5bd5534db
2 changed files with 30 additions and 18 deletions
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
import "./spotifyStyles.css";
|
import "./spotifyStyles.css";
|
||||||
|
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
|
||||||
import { Flex } from "@components/Flex";
|
import { Flex } from "@components/Flex";
|
||||||
import { ImageIcon, LinkIcon, OpenExternalIcon } from "@components/Icons";
|
import { ImageIcon, LinkIcon, OpenExternalIcon } from "@components/Icons";
|
||||||
import { debounce } from "@shared/debounce";
|
import { debounce } from "@shared/debounce";
|
||||||
|
@ -376,17 +375,10 @@ export function Player() {
|
||||||
} as React.CSSProperties;
|
} as React.CSSProperties;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary fallback={() => (
|
|
||||||
<div className="vc-spotify-fallback">
|
|
||||||
<p>Failed to render Spotify Modal :(</p>
|
|
||||||
<p >Check the console for errors</p>
|
|
||||||
</div>
|
|
||||||
)}>
|
|
||||||
<div id={cl("player")} style={exportTrackImageStyle}>
|
<div id={cl("player")} style={exportTrackImageStyle}>
|
||||||
<Info track={track} />
|
<Info track={track} />
|
||||||
<SeekBar />
|
<SeekBar />
|
||||||
<Controls />
|
<Controls />
|
||||||
</div>
|
</div>
|
||||||
</ErrorBoundary>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import { Settings } from "@api/Settings";
|
import { Settings } from "@api/Settings";
|
||||||
import { disableStyle, enableStyle } from "@api/Styles";
|
import { disableStyle, enableStyle } from "@api/Styles";
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
|
||||||
|
@ -49,10 +50,10 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "showTaglessAccountPanel:",
|
find: "showTaglessAccountPanel:",
|
||||||
replacement: {
|
replacement: {
|
||||||
// return React.createElement(AccountPanel, { ..., showTaglessAccountPanel: blah })
|
// react.jsx)(AccountPanel, { ..., showTaglessAccountPanel: blah })
|
||||||
match: /return ?(.{0,30}\(.{1,3},\{[^}]+?,showTaglessAccountPanel:.+?\}\))/,
|
match: /(?<=\i\.jsxs?\)\()(\i),{(?=[^}]*?showTaglessAccountPanel:)/,
|
||||||
// return [Player, Panel]
|
// react.jsx(WrapperComponent, { VencordOriginal: AccountPanel, ...
|
||||||
replace: "return [$self.renderPlayer(),$1]"
|
replace: "$self.PanelWrapper,{VencordOriginal:$1,"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -78,6 +79,25 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
start: () => toggleHoverControls(Settings.plugins.SpotifyControls.hoverControls),
|
start: () => toggleHoverControls(Settings.plugins.SpotifyControls.hoverControls),
|
||||||
renderPlayer: () => <Player />
|
|
||||||
|
PanelWrapper({ VencordOriginal, ...props }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ErrorBoundary
|
||||||
|
fallback={() => (
|
||||||
|
<div className="vc-spotify-fallback">
|
||||||
|
<p>Failed to render Spotify Modal :(</p>
|
||||||
|
<p >Check the console for errors</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<Player />
|
||||||
|
</ErrorBoundary>
|
||||||
|
|
||||||
|
<VencordOriginal {...props} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue