mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-28 12:36:35 +00:00
Fix windowId type errors
This commit is contained in:
parent
b444578571
commit
d529cbf486
4 changed files with 22 additions and 20 deletions
|
|
@ -6,7 +6,7 @@ import { Hr, Node, Parent, LinkNode } from "../ContextMenu";
|
|||
import PlaybackContextMenu from "../PlaybackContextMenu";
|
||||
import OptionsContextMenu from "../OptionsContextMenu";
|
||||
import SkinsContextMenu from "../SkinsContextMenu";
|
||||
import { FilePicker } from "../../types";
|
||||
import { FilePicker, WindowId } from "../../types";
|
||||
import { useTypedSelector, useActionCreator } from "../../hooks";
|
||||
|
||||
interface Props {
|
||||
|
|
@ -64,7 +64,7 @@ const MainContextMenu = memo(({ filePickers }: Props) => {
|
|||
key={i}
|
||||
label={genWindows[i].title}
|
||||
checked={genWindows[i].open}
|
||||
onClick={() => toggleWindow(i)}
|
||||
onClick={() => toggleWindow(i as WindowId)}
|
||||
hotkey={genWindows[i].hotkey}
|
||||
/>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -244,9 +244,9 @@ describe("resizeUtils", () => {
|
|||
describe("generateGraph", () => {
|
||||
it("of stacked windows", () => {
|
||||
const actual = generateGraph([
|
||||
{ key: "a", x: 0, y: 0, width: 100, height: 100 },
|
||||
{ key: "b", x: 0, y: 100, width: 100, height: 100 },
|
||||
{ key: "c", x: 0, y: 200, width: 100, height: 100 },
|
||||
{ key: "main", x: 0, y: 0, width: 100, height: 100 },
|
||||
{ key: "equalizer", x: 0, y: 100, width: 100, height: 100 },
|
||||
{ key: "playlist", x: 0, y: 200, width: 100, height: 100 },
|
||||
]);
|
||||
expect(actual).toEqual({
|
||||
a: {},
|
||||
|
|
@ -256,8 +256,8 @@ describe("generateGraph", () => {
|
|||
});
|
||||
it("of disconnected windows", () => {
|
||||
const actual = generateGraph([
|
||||
{ key: "a", x: 0, y: 0, width: 100, height: 100 },
|
||||
{ key: "b", x: 0, y: 110, width: 100, height: 100 },
|
||||
{ key: "main", x: 0, y: 0, width: 100, height: 100 },
|
||||
{ key: "equalizer", x: 0, y: 110, width: 100, height: 100 },
|
||||
]);
|
||||
expect(actual).toEqual({
|
||||
a: {},
|
||||
|
|
@ -266,8 +266,8 @@ describe("generateGraph", () => {
|
|||
});
|
||||
it("of windows that touch in y, but the lower one is to the right", () => {
|
||||
const actual = generateGraph([
|
||||
{ key: "a", x: 0, y: 0, width: 100, height: 100 },
|
||||
{ key: "b", x: 110, y: 100, width: 100, height: 100 },
|
||||
{ key: "main", x: 0, y: 0, width: 100, height: 100 },
|
||||
{ key: "equalizer", x: 110, y: 100, width: 100, height: 100 },
|
||||
]);
|
||||
expect(actual).toEqual({
|
||||
a: {},
|
||||
|
|
@ -276,8 +276,8 @@ describe("generateGraph", () => {
|
|||
});
|
||||
it("of windows that touch in y, but the lower one is to the left", () => {
|
||||
const actual = generateGraph([
|
||||
{ key: "a", x: 110, y: 0, width: 100, height: 100 },
|
||||
{ key: "b", x: 0, y: 100, width: 100, height: 100 },
|
||||
{ key: "main", x: 110, y: 0, width: 100, height: 100 },
|
||||
{ key: "equalizer", x: 0, y: 100, width: 100, height: 100 },
|
||||
]);
|
||||
expect(actual).toEqual({
|
||||
a: {},
|
||||
|
|
@ -286,8 +286,8 @@ describe("generateGraph", () => {
|
|||
});
|
||||
it("of windows that touch in x, but the right one is below", () => {
|
||||
const actual = generateGraph([
|
||||
{ key: "a", x: 0, y: 0, width: 100, height: 100 },
|
||||
{ key: "b", x: 100, y: 110, width: 100, height: 100 },
|
||||
{ key: "main", x: 0, y: 0, width: 100, height: 100 },
|
||||
{ key: "equalizer", x: 100, y: 110, width: 100, height: 100 },
|
||||
]);
|
||||
expect(actual).toEqual({
|
||||
a: {},
|
||||
|
|
@ -296,8 +296,8 @@ describe("generateGraph", () => {
|
|||
});
|
||||
it("of windows that touch in x, but the right one is above", () => {
|
||||
const actual = generateGraph([
|
||||
{ key: "a", x: 0, y: 110, width: 100, height: 100 },
|
||||
{ key: "b", x: 100, y: 0, width: 100, height: 100 },
|
||||
{ key: "main", x: 0, y: 110, width: 100, height: 100 },
|
||||
{ key: "equalizer", x: 100, y: 0, width: 100, height: 100 },
|
||||
]);
|
||||
expect(actual).toEqual({
|
||||
a: {},
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export function getPositionDiff(
|
|||
}
|
||||
}
|
||||
|
||||
function walkRight(key: WindowId) {
|
||||
function walkRight(key: string) {
|
||||
const node = newGraph[key];
|
||||
const nodeSizeDiff = sizeDiff[key];
|
||||
node.left.forEach((left) => {
|
||||
|
|
@ -52,7 +52,7 @@ export function getPositionDiff(
|
|||
});
|
||||
}
|
||||
|
||||
function walkDown(key: WindowId) {
|
||||
function walkDown(key: string) {
|
||||
const node = newGraph[key];
|
||||
const nodeSizeDiff = sizeDiff[key];
|
||||
node.above.forEach((above) => {
|
||||
|
|
@ -75,8 +75,8 @@ export function getPositionDiff(
|
|||
}
|
||||
|
||||
interface Edges {
|
||||
below?: WindowId;
|
||||
right?: WindowId;
|
||||
below?: string;
|
||||
right?: string;
|
||||
}
|
||||
|
||||
export interface Graph {
|
||||
|
|
|
|||
|
|
@ -203,7 +203,9 @@ export const getNextTrackId = (state: AppState, n = 1) => {
|
|||
return trackOrder[nextIndex];
|
||||
};
|
||||
|
||||
export const getGenWindows = (state: AppState) => {
|
||||
export const getGenWindows = (
|
||||
state: AppState
|
||||
): { [name: string]: WebampWindow } => {
|
||||
return state.windows.genWindows;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue