diff --git a/packages/app/src/components/Player/Controls/index.jsx b/packages/app/src/components/Player/Controls/index.jsx index acbb47d3..5242d796 100644 --- a/packages/app/src/components/Player/Controls/index.jsx +++ b/packages/app/src/components/Player/Controls/index.jsx @@ -5,6 +5,7 @@ import UseAnimations from "react-useanimations" import LoadingAnimation from "react-useanimations/lib/loading" import { Icons } from "components/Icons" +import LikeButton from "components/LikeButton" import AudioVolume from "components/Player/AudioVolume" import AudioPlayerChangeModeButton from "components/Player/ChangeModeButton" @@ -23,6 +24,7 @@ export default ({ audioVolume = 0.3, audioMuted = false, loading = false, + liked = false, } = {}) => { const onClickActionsButton = (event) => { if (typeof controls !== "object") { @@ -79,6 +81,12 @@ export default ({ onClick={() => onClickActionsButton("next")} disabled={syncModeLocked} /> + { + app.isMobile && + } { !app.isMobile && { @@ -25,10 +23,6 @@ export default (props) => { export class AudioPlayer extends React.Component { static contextType = Context - state = { - liked: false, - } - onMouse = (event) => { const { type } = event @@ -64,7 +58,7 @@ export class AudioPlayer extends React.Component { } onClickPlayButton = () => { - if (this.state.streamMode) { + if (this.context.streamMode) { return app.cores.player.playback.stop() } @@ -79,59 +73,50 @@ export class AudioPlayer extends React.Component { app.cores.player.playback.next() } - onClickLikeButton = async () => { - const result = await PlaylistsModel.toggleTrackLike(this.context.currentManifest._id).catch((err) => { - return null - }) - - if (result) { - this.setState({ - liked: result.action === "liked" - }) - } - } - render() { return
-
- } - onClick={this.minimize} - shape="circle" - /> - - { - !this.context.syncModeLocked && !this.context.syncMode && } - onClick={this.inviteSync} + { + !app.isMobile &&
+ } + onClick={this.minimize} shape="circle" /> - } - } - onClick={this.openVisualizer} - shape="circle" - /> + { + !this.context.syncModeLocked && !this.context.syncMode && } + onClick={this.inviteSync} + shape="circle" + /> + } + + } + onClick={this.openVisualizer} + shape="circle" + /> + + } + onClick={this.close} + shape="square" + /> +
+ } - } - onClick={this.close} - shape="square" - /> -
} - + { + !app.isMobile && + }
@@ -179,7 +166,9 @@ export class AudioPlayer extends React.Component { previous: this.onClickPreviousButton, toggle: this.onClickPlayButton, next: this.onClickNextButton, + like: app.cores.player.toggleCurrentTrackLike, }} + liked={this.context.liked} />