diff --git a/js/components/Balance.tsx b/js/components/Balance.tsx index 11c0b9d2..24862fc1 100644 --- a/js/components/Balance.tsx +++ b/js/components/Balance.tsx @@ -1,7 +1,6 @@ import React, { ChangeEvent } from "react"; import { connect } from "react-redux"; -import { setBalance } from "../actionCreators"; import * as Actions from "../actionCreators"; import { Dispatch, AppState } from "../types"; import * as Selectors from "../selectors"; @@ -38,7 +37,7 @@ const mapStateToProps = (state: AppState) => ({ }); const mapDispatchToProps = (dispatch: Dispatch) => ({ setBalance: (e: ChangeEvent) => - dispatch(setBalance(Number((e.target as HTMLInputElement).value))), + dispatch(Actions.setBalance(Number((e.target as HTMLInputElement).value))), showMarquee: () => dispatch(Actions.setFocus("balance")), hideMarquee: () => dispatch(Actions.unsetFocus()) }); diff --git a/js/components/PlaylistWindow/PlaylistShade.tsx b/js/components/PlaylistWindow/PlaylistShade.tsx index adc8b291..bda500b2 100644 --- a/js/components/PlaylistWindow/PlaylistShade.tsx +++ b/js/components/PlaylistWindow/PlaylistShade.tsx @@ -1,11 +1,6 @@ import React from "react"; import { connect } from "react-redux"; import classnames from "classnames"; -import { - getOrderedTracks, - getMinimalMediaText, - getWindowSize -} from "../../selectors"; import { getTimeStr } from "../../utils"; import { SET_FOCUSED_WINDOW } from "../../actionTypes"; import * as Selectors from "../../selectors"; @@ -116,10 +111,10 @@ const mapStateToProps = (state: AppState): StateProps => { } = state; return { focused, - playlistSize: getWindowSize(state)("playlist"), - trackOrder: getOrderedTracks(state), + playlistSize: Selectors.getWindowSize(state)("playlist"), + trackOrder: Selectors.getOrderedTracks(state), duration, - name: getMinimalMediaText(state) + name: Selectors.getMinimalMediaText(state) }; }; diff --git a/js/components/PlaylistWindow/index.tsx b/js/components/PlaylistWindow/index.tsx index f3f5457f..342510cc 100644 --- a/js/components/PlaylistWindow/index.tsx +++ b/js/components/PlaylistWindow/index.tsx @@ -2,7 +2,7 @@ import React from "react"; import { connect } from "react-redux"; import classnames from "classnames"; -import { WINDOWS, TRACK_HEIGHT } from "../../constants"; +import { WINDOWS, TRACK_HEIGHT, LOAD_STYLE } from "../../constants"; import { SET_FOCUSED_WINDOW } from "../../actionTypes"; import { scrollUpFourTracks, @@ -15,8 +15,6 @@ import { } from "../../actionCreators"; import * as Selectors from "../../selectors"; -import { LOAD_STYLE } from "../../constants"; - import { clamp } from "../../utils"; import DropTarget from "../DropTarget"; import Visualizer from "../Visualizer"; diff --git a/js/components/WindowManager.tsx b/js/components/WindowManager.tsx index 0c07dfdc..673ec27e 100644 --- a/js/components/WindowManager.tsx +++ b/js/components/WindowManager.tsx @@ -1,7 +1,6 @@ import React, { ReactNode } from "react"; import { connect } from "react-redux"; -import { Box, Diff } from "../snapUtils"; import * as SnapUtils from "../snapUtils"; import * as Selectors from "../selectors"; import { updateWindowPositions } from "../actionCreators"; @@ -12,7 +11,7 @@ import { AppState, WindowId } from "../types"; -const abuts = (a: Box, b: Box) => { +const abuts = (a: SnapUtils.Box, b: SnapUtils.Box) => { // TODO: This is kinda a hack. They should really be touching, not just within snapping distance. // Also, overlapping should not count. const wouldMoveTo = SnapUtils.snap(a, b); @@ -104,7 +103,7 @@ class WindowManager extends React.Component { ); const windowPositionDiff = moving.reduce( - (diff: { [windowId: string]: Diff }, window) => { + (diff: { [windowId: string]: SnapUtils.Diff }, window) => { diff[window.key] = SnapUtils.applyDiff(window, finalDiff); return diff; }, diff --git a/js/media/index.ts b/js/media/index.ts index 708a7375..420ad72d 100644 --- a/js/media/index.ts +++ b/js/media/index.ts @@ -187,13 +187,14 @@ export default class Media { setVolume(volume: number) { this._gainNode.gain.value = volume / 100; } + // from 0 to 100 // The input value here is 0-100 which is kinda wrong, since it represents -12db to 12db. // For now, 50 is 0db (no change). // Equation used is: 10^((dB)/20) = x, where x (preamp.gain.value) is passed on to gainnode for boosting or attenuation. setPreamp(value: number) { const db = (value / 100) * 24 - 12; - this._preamp.gain.value = Math.pow(10,(db/20)); + this._preamp.gain.value = Math.pow(10, db / 20); } // From -100 to 100 diff --git a/js/reducers/milkdrop.ts b/js/reducers/milkdrop.ts index 282c63bf..726ecc15 100644 --- a/js/reducers/milkdrop.ts +++ b/js/reducers/milkdrop.ts @@ -1,4 +1,4 @@ -import { Action, StatePreset } from "../types"; +import { Action, StatePreset, TransitionType } from "../types"; import { SET_MILKDROP_DESKTOP, SET_MILKDROP_FULLSCREEN, @@ -13,7 +13,6 @@ import { SCHEDULE_MILKDROP_MESSAGE } from "../actionTypes"; import * as Utils from "../utils"; -import { TransitionType } from "../types"; interface Message { text: string;