mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-20 16:49:52 +00:00
Address/remove a bunch of TODOs
This commit is contained in:
parent
2a11bd6b34
commit
257dadfecf
12 changed files with 23 additions and 20 deletions
|
|
@ -32,12 +32,15 @@ const App = ({
|
|||
switch (id) {
|
||||
case "main":
|
||||
return (
|
||||
<MainWindow analyser={media._analyser} filePickers={filePickers} />
|
||||
<MainWindow
|
||||
analyser={media.getAnalyser()}
|
||||
filePickers={filePickers}
|
||||
/>
|
||||
);
|
||||
case "equalizer":
|
||||
return <EqualizerWindow />;
|
||||
case "playlist":
|
||||
return <PlaylistWindow analyser={media._analyser} />;
|
||||
return <PlaylistWindow analyser={media.getAnalyser()} />;
|
||||
default:
|
||||
if (!w.generic) {
|
||||
throw new Error("Tried to render an unknown window:", id);
|
||||
|
|
@ -47,7 +50,7 @@ const App = ({
|
|||
<GenWindow title={w.title} windowId={id}>
|
||||
{({ height, width }) => (
|
||||
<Component
|
||||
analyser={media._analyser}
|
||||
analyser={media.getAnalyser()}
|
||||
width={width}
|
||||
height={height}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -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 }),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const media = {
|
|||
addEventListener: jest.fn(),
|
||||
setVolume: jest.fn(),
|
||||
setBalance: jest.fn(),
|
||||
_analyser: null,
|
||||
getAnalyser: () => null,
|
||||
on: jest.fn()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const media = {
|
|||
addEventListener: jest.fn(),
|
||||
setVolume: jest.fn(),
|
||||
setBalance: jest.fn(),
|
||||
_analyser: null,
|
||||
getAnalyser: () => null,
|
||||
on: jest.fn()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const media = {
|
|||
loadFromUrl: jest.fn(),
|
||||
setVolume: jest.fn(),
|
||||
setBalance: jest.fn(),
|
||||
_analyser: null,
|
||||
getAnalyser: () => null,
|
||||
on: jest.fn()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const media = {
|
|||
addEventListener: jest.fn(),
|
||||
setVolume: jest.fn(),
|
||||
setBalance: jest.fn(),
|
||||
_analyser: null,
|
||||
getAnalyser: () => null,
|
||||
on: jest.fn()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue