From a55c758b0ea7fd4ea804d3174f033b1bc5780aac Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 4 Apr 2023 21:27:44 +0200 Subject: [PATCH] Fix SpotifyControls --- .../spotifyControls/PlayerComponent.tsx | 20 +++++++------------ src/webpack/common/types/menu.d.ts | 10 ++++++---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/plugins/spotifyControls/PlayerComponent.tsx b/src/plugins/spotifyControls/PlayerComponent.tsx index 3de16870..7076085a 100644 --- a/src/plugins/spotifyControls/PlayerComponent.tsx +++ b/src/plugins/spotifyControls/PlayerComponent.tsx @@ -22,8 +22,7 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Flex } from "@components/Flex"; import { Link } from "@components/Link"; import { debounce } from "@utils/debounce"; -import { classes, copyWithToast, LazyComponent } from "@utils/misc"; -import { filters, find } from "@webpack"; +import { classes, copyWithToast } from "@utils/misc"; import { ContextMenu, FluxDispatcher, Forms, Menu, React, useEffect, useState, useStateFromStores } from "@webpack/common"; import { SpotifyStore, Track } from "./SpotifyStore"; @@ -79,7 +78,7 @@ function CopyContextMenu({ name, path }: { name: string; path: string; }) { const openId = `spotify-open-${name}`; return ( - FluxDispatcher.dispatch({ type: "CONTEXT_MENU_CLOSE" })} aria-label={`Spotify ${name} Menu`} @@ -96,7 +95,7 @@ function CopyContextMenu({ name, path }: { name: string; path: string; }) { label={`Open ${name} in Spotify`} action={() => SpotifyStore.openExternal(path)} /> - + ); } @@ -154,11 +153,6 @@ const seek = debounce((v: number) => { SpotifyStore.seek(v); }); -const Slider = LazyComponent(() => { - const filter = filters.byCode("sliderContainer"); - return find(m => m.render && filter(m.render)); -}); - function SeekBar() { const { duration } = SpotifyStore.track!; @@ -190,7 +184,7 @@ function SeekBar() { > {msToHuman(position)} - SpotifyStore.volume); return ( - FluxDispatcher.dispatch({ type: "CONTEXT_MENU_CLOSE" })} aria-label="Spotify Album Menu" @@ -240,7 +234,7 @@ function AlbumContextMenu({ track }: { track: Track; }) { key="spotify-volume" label="Volume" control={(props, ref) => ( - )} /> - + ); } diff --git a/src/webpack/common/types/menu.d.ts b/src/webpack/common/types/menu.d.ts index e48d5945..bf5508ae 100644 --- a/src/webpack/common/types/menu.d.ts +++ b/src/webpack/common/types/menu.d.ts @@ -21,7 +21,7 @@ import type { ComponentType, CSSProperties, PropsWithChildren, UIEvent } from "r type RC = ComponentType>>; export interface Menu { - ContextMenu: RC<{ + Menu: RC<{ navId: string; onClose(): void; className?: string; @@ -49,19 +49,21 @@ export interface Menu { id: string; interactive?: boolean; }>; + // TODO: Type me + MenuSliderControl: RC; } export interface ContextMenuApi { close(): void; open( event: UIEvent, - render?: Menu["ContextMenu"], + render?: Menu["Menu"], options?: { enableSpellCheck?: boolean; }, - renderLazy?: () => Promise + renderLazy?: () => Promise ): void; openLazy( event: UIEvent, - renderLazy?: () => Promise, + renderLazy?: () => Promise, options?: { enableSpellCheck?: boolean; } ): void; }