diff --git a/js/components/App.js b/js/components/App.js
index 73be8f14..aff4557c 100644
--- a/js/components/App.js
+++ b/js/components/App.js
@@ -32,12 +32,15 @@ const App = ({
switch (id) {
case "main":
return (
-
+
);
case "equalizer":
return ;
case "playlist":
- return ;
+ return ;
default:
if (!w.generic) {
throw new Error("Tried to render an unknown window:", id);
@@ -47,7 +50,7 @@ const App = ({
{({ height, width }) => (
diff --git a/js/components/EqualizerWindow/index.js b/js/components/EqualizerWindow/index.js
index 5016eb11..be6b9fca 100644
--- a/js/components/EqualizerWindow/index.js
+++ b/js/components/EqualizerWindow/index.js
@@ -88,7 +88,8 @@ EqualizerWindow.propTypes = {
shade: PropTypes.bool.isRequired
};
-// TODO: Convert to object shorthand
+// This does not use the shorthand object syntax becuase `setHertzValue` needs
+// to return a function.
const mapDispatchToProps = dispatch => ({
focusWindow: () =>
dispatch({ type: SET_FOCUSED_WINDOW, window: WINDOWS.EQUALIZER }),
diff --git a/js/components/EqualizerWindow/index.test.js b/js/components/EqualizerWindow/index.test.js
index ceca1d4a..54dc5f4d 100644
--- a/js/components/EqualizerWindow/index.test.js
+++ b/js/components/EqualizerWindow/index.test.js
@@ -8,7 +8,7 @@ const media = {
addEventListener: jest.fn(),
setVolume: jest.fn(),
setBalance: jest.fn(),
- _analyser: null,
+ getAnalyser: () => null,
on: jest.fn()
};
diff --git a/js/components/MainWindow/Marquee.js b/js/components/MainWindow/Marquee.js
index a8a4e0f3..29153fcb 100644
--- a/js/components/MainWindow/Marquee.js
+++ b/js/components/MainWindow/Marquee.js
@@ -154,8 +154,9 @@ const getMarqueeText = state => {
return "Winamp 2.91";
};
-// TODO: Define map state to props
-export default connect(state => ({
+const mapStateToProps = state => ({
marqueeStep: state.display.marqueeStep,
text: getMarqueeText(state)
-}))(Marquee);
+});
+
+export default connect(mapStateToProps)(Marquee);
diff --git a/js/components/MainWindow/index.test.js b/js/components/MainWindow/index.test.js
index 842beb3c..276acdcb 100644
--- a/js/components/MainWindow/index.test.js
+++ b/js/components/MainWindow/index.test.js
@@ -11,7 +11,7 @@ const media = {
addEventListener: jest.fn(),
setVolume: jest.fn(),
setBalance: jest.fn(),
- _analyser: null,
+ getAnalyser: () => null,
on: jest.fn()
};
diff --git a/js/components/PlaylistWindow/PlaylistShade.test.js b/js/components/PlaylistWindow/PlaylistShade.test.js
index cd8bbb80..d6cb710d 100644
--- a/js/components/PlaylistWindow/PlaylistShade.test.js
+++ b/js/components/PlaylistWindow/PlaylistShade.test.js
@@ -12,7 +12,7 @@ const media = {
loadFromUrl: jest.fn(),
setVolume: jest.fn(),
setBalance: jest.fn(),
- _analyser: null,
+ getAnalyser: () => null,
on: jest.fn()
};
diff --git a/js/components/PlaylistWindow/index.test.js b/js/components/PlaylistWindow/index.test.js
index f8964215..24d90b88 100644
--- a/js/components/PlaylistWindow/index.test.js
+++ b/js/components/PlaylistWindow/index.test.js
@@ -8,7 +8,7 @@ const media = {
addEventListener: jest.fn(),
setVolume: jest.fn(),
setBalance: jest.fn(),
- _analyser: null,
+ getAnalyser: () => null,
on: jest.fn()
};
diff --git a/js/loadQueue.js b/js/loadQueue.js
index 8f516de9..12100bca 100644
--- a/js/loadQueue.js
+++ b/js/loadQueue.js
@@ -26,7 +26,7 @@ export default class LoadQueue {
}, 0);
return () => {
// TODO: Could return a boolean representing if the task has already been
- // kicke off.
+ // kicked off.
this._queue = this._queue.filter(t1 => t1 !== t);
};
}
diff --git a/js/media/elementSource.js b/js/media/elementSource.js
index 9af10fbb..fe53d5b0 100644
--- a/js/media/elementSource.js
+++ b/js/media/elementSource.js
@@ -1,4 +1,5 @@
import Emitter from "../emitter";
+import { clamp } from "../utils";
const STATUS = {
PLAYING: "PLAYING",
STOPPED: "STOPPED",
@@ -111,11 +112,7 @@ export default class ElementSource {
}
seekToTime(time) {
- // Make sure we are within range
- // TODO: Use clamp
- time = Math.min(time, this.getDuration());
- time = Math.max(time, 0);
- this._audio.currentTime = time;
+ this._audio.currentTime = clamp(time, 0, this.getDuration());
this._emitter.trigger("positionChange");
}
diff --git a/js/media/index.js b/js/media/index.js
index e66ab5b9..7c3dedc1 100644
--- a/js/media/index.js
+++ b/js/media/index.js
@@ -53,7 +53,6 @@ export default class Media {
this._chanMerge = this._context.createChannelMerger(2);
// Create the analyser node for the visualizer
- // TODO: Expose this via a public method.
this._analyser = this._context.createAnalyser();
this._analyser.fftSize = 2048;
// TODO: Tune these to something that looks like Winamp
@@ -167,6 +166,10 @@ export default class Media {
this._emitter.trigger("channelupdate");
}
+ getAnalyser() {
+ return this._analyser;
+ }
+
/* Properties */
duration() {
return this._source.getDuration();
diff --git a/js/reducers/display.js b/js/reducers/display.js
index c7e33af6..a6da437e 100644
--- a/js/reducers/display.js
+++ b/js/reducers/display.js
@@ -64,7 +64,6 @@ const display = (state = defaultDisplayState, action) => {
case TOGGLE_LLAMA_MODE:
return { ...state, llama: !state.llama };
case STEP_MARQUEE:
- // TODO: Prevent this from becoming huge
return { ...state, marqueeStep: state.marqueeStep + 1 };
case STOP_WORKING:
return { ...state, working: false };
diff --git a/js/selectors.js b/js/selectors.js
index cb21e328..f4f65ef0 100644
--- a/js/selectors.js
+++ b/js/selectors.js
@@ -224,7 +224,6 @@ const getPlaylistDuration = createSelector(getTracks, tracks =>
Object.values(tracks).reduce((total, track) => total + track.duration, 0)
);
-// TODO: Move to action creator
export const getPlaylistURL = createSelector(
state => state,
getNumberOfTracks,