mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Hide milkdrop context window if not enabled
This commit is contained in:
parent
b66667019c
commit
90625614f0
4 changed files with 26 additions and 10 deletions
|
|
@ -20,6 +20,7 @@
|
|||
- Fix bug where scrolling the main window or playlist window would change the volume but also (incorrectly) scroll the page.
|
||||
- Fix bug where resizing the window such that the current layout cannot fit on the page, while also scrolled down the page, would cause the layout to be recentered out of view.
|
||||
- Avoid a console log from Redux Dev Tools.
|
||||
- Don't show Milkdrop window option in context menu if Milkdrop is not enabled.
|
||||
|
||||
## 2.1.2 [CURRENT]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { memo, Fragment, useEffect } from "react";
|
||||
import * as Actions from "../../actionCreators";
|
||||
import * as Selectors from "../../selectors";
|
||||
import { LOAD_STYLE } from "../../constants";
|
||||
import { LOAD_STYLE, WINDOWS } from "../../constants";
|
||||
import { Hr, Node, Parent, LinkNode } from "../ContextMenu";
|
||||
import PlaybackContextMenu from "../PlaybackContextMenu";
|
||||
import OptionsContextMenu from "../OptionsContextMenu";
|
||||
|
|
@ -24,6 +24,8 @@ const MainContextMenu = memo(({ filePickers }: Props) => {
|
|||
const menuOpened = useActionCreator(() => ({
|
||||
type: "MAIN_CONTEXT_MENU_OPENED",
|
||||
}));
|
||||
const isMilkdropEnabled = useTypedSelector(Selectors.getMilkdropEnabled);
|
||||
|
||||
useEffect(() => {
|
||||
menuOpened();
|
||||
}, [menuOpened]);
|
||||
|
|
@ -59,15 +61,20 @@ const MainContextMenu = memo(({ filePickers }: Props) => {
|
|||
)}
|
||||
</Parent>
|
||||
<Hr />
|
||||
{Object.keys(genWindows).map((i) => (
|
||||
<Node
|
||||
key={i}
|
||||
label={genWindows[i].title}
|
||||
checked={genWindows[i].open}
|
||||
onClick={() => toggleWindow(i as WindowId)}
|
||||
hotkey={genWindows[i].hotkey}
|
||||
/>
|
||||
))}
|
||||
{Object.keys(genWindows).map((i) => {
|
||||
if (i === WINDOWS.MILKDROP && !isMilkdropEnabled) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<Node
|
||||
key={i}
|
||||
label={genWindows[i].title}
|
||||
checked={genWindows[i].open}
|
||||
onClick={() => toggleWindow(i as WindowId)}
|
||||
hotkey={genWindows[i].hotkey}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
<Hr />
|
||||
<SkinsContextMenu />
|
||||
<Hr />
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ export interface WindowsState {
|
|||
browserWindowSize: { height: number; width: number };
|
||||
positionsAreRelative: boolean;
|
||||
windowOrder: WindowId[];
|
||||
milkdropEnabled: boolean;
|
||||
}
|
||||
|
||||
const defaultWindowsState: WindowsState = {
|
||||
|
|
@ -98,6 +99,7 @@ const defaultWindowsState: WindowsState = {
|
|||
WINDOWS.MILKDROP,
|
||||
WINDOWS.MAIN,
|
||||
],
|
||||
milkdropEnabled: false,
|
||||
};
|
||||
|
||||
const windows = (
|
||||
|
|
@ -108,6 +110,7 @@ const windows = (
|
|||
case ENABLE_MILKDROP:
|
||||
return {
|
||||
...state,
|
||||
milkdropEnabled: true,
|
||||
genWindows: {
|
||||
...state.genWindows,
|
||||
[WINDOWS.MILKDROP]: {
|
||||
|
|
|
|||
|
|
@ -687,6 +687,11 @@ export function getMilkdropMessage(state: AppState): MilkdropMessage | null {
|
|||
return state.milkdrop.message;
|
||||
}
|
||||
|
||||
// Has Butterchurn been injected?
|
||||
export function getMilkdropEnabled(state: AppState): boolean {
|
||||
return state.windows.milkdropEnabled;
|
||||
}
|
||||
|
||||
export function getMilkdropWindowEnabled(state: AppState): boolean {
|
||||
return state.milkdrop.display === "WINDOW";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue