Consolidate imports

This commit is contained in:
Jordan Eldredge 2019-03-19 06:55:23 -07:00
parent 1885028ae1
commit a9caca0964
6 changed files with 10 additions and 19 deletions

View file

@ -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<HTMLInputElement>) =>
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())
});

View file

@ -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)
};
};

View file

@ -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";

View file

@ -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<Props> {
);
const windowPositionDiff = moving.reduce(
(diff: { [windowId: string]: Diff }, window) => {
(diff: { [windowId: string]: SnapUtils.Diff }, window) => {
diff[window.key] = SnapUtils.applyDiff(window, finalDiff);
return diff;
},

View file

@ -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

View file

@ -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;