diff --git a/js/components/PlaylistWindow/TrackList.tsx b/js/components/PlaylistWindow/TrackList.tsx index 7648bf5d..16e66c83 100644 --- a/js/components/PlaylistWindow/TrackList.tsx +++ b/js/components/PlaylistWindow/TrackList.tsx @@ -75,6 +75,10 @@ class TrackList extends React.Component { window.addEventListener("mousemove", handleMouseMove); }; + _handleRef = (node: HTMLDivElement | null) => { + this._node = node; + }; + render() { const { tracks, offset } = this.props; const maxTrackNumberLength = getNumberLength(this.props.numberOfTracks); @@ -82,9 +86,7 @@ class TrackList extends React.Component { (i + 1 + offset).toString().padStart(maxTrackNumberLength, "\u00A0"); return (
{ - this._node = node; - }} + ref={this._handleRef} className="playlist-tracks" style={{ height: "100%" }} onClick={this.props.selectZero} diff --git a/js/selectors.ts b/js/selectors.ts index b895baf4..49e61376 100644 --- a/js/selectors.ts +++ b/js/selectors.ts @@ -401,22 +401,6 @@ function getWPixelSize(w: WebampWindow, doubled: boolean) { }; } -export function getWindowSize(state: AppState) { - return (windowId: WindowId) => state.windows.genWindows[windowId].size; -} - -export function getWindowOpen(state: AppState) { - return (windowId: WindowId) => state.windows.genWindows[windowId].open; -} - -export function getWindowShade(state: AppState) { - return (windowId: WindowId) => state.windows.genWindows[windowId].shade; -} - -export function getWindowHidden(state: AppState) { - return (windowId: WindowId) => state.windows.genWindows[windowId].hidden; -} - export function getFocusedWindow(state: AppState): WindowId | null { return state.windows.focused; } @@ -433,6 +417,34 @@ export const getGenWindows = (state: AppState) => { return state.windows.genWindows; }; +export const getWindowOpen = createSelector( + getGenWindows, + genWindows => { + return (windowId: WindowId) => genWindows[windowId].open; + } +); + +export const getWindowHidden = createSelector( + getGenWindows, + genWindows => { + return (windowId: WindowId) => genWindows[windowId].hidden; + } +); + +export const getWindowShade = createSelector( + getGenWindows, + genWindows => { + return (windowId: WindowId) => genWindows[windowId].shade; + } +); + +export const getWindowSize = createSelector( + getGenWindows, + genWindows => { + return (windowId: WindowId) => genWindows[windowId].size; + } +); + export const getWindowPositions = createSelector( getGenWindows, (windows): WindowPositions => Utils.objectMap(windows, w => w.position) @@ -474,16 +486,16 @@ export const getWindowGraph = createSelector( generateGraph ); +const defaultPlaylistStyle = { + normal: "#00FF00", + current: "#FFFFFF", + normalbg: "#000000", + selectedbg: "#0000C6", + font: "Arial", +}; + export const getSkinPlaylistStyle = (state: AppState): PlaylistStyle => { - return ( - state.display.skinPlaylistStyle || { - normal: "#00FF00", - current: "#FFFFFF", - normalbg: "#000000", - selectedbg: "#0000C6", - font: "Arial", - } - ); + return state.display.skinPlaylistStyle || defaultPlaylistStyle; }; export const getSkinGenExColors = (state: AppState) => {