mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
improve style & mobile layout
This commit is contained in:
parent
0223a6a60c
commit
3fa9b30437
@ -5,6 +5,7 @@ import UseAnimations from "react-useanimations"
|
|||||||
import LoadingAnimation from "react-useanimations/lib/loading"
|
import LoadingAnimation from "react-useanimations/lib/loading"
|
||||||
|
|
||||||
import { Icons } from "components/Icons"
|
import { Icons } from "components/Icons"
|
||||||
|
import LikeButton from "components/LikeButton"
|
||||||
|
|
||||||
import AudioVolume from "components/Player/AudioVolume"
|
import AudioVolume from "components/Player/AudioVolume"
|
||||||
import AudioPlayerChangeModeButton from "components/Player/ChangeModeButton"
|
import AudioPlayerChangeModeButton from "components/Player/ChangeModeButton"
|
||||||
@ -23,6 +24,7 @@ export default ({
|
|||||||
audioVolume = 0.3,
|
audioVolume = 0.3,
|
||||||
audioMuted = false,
|
audioMuted = false,
|
||||||
loading = false,
|
loading = false,
|
||||||
|
liked = false,
|
||||||
} = {}) => {
|
} = {}) => {
|
||||||
const onClickActionsButton = (event) => {
|
const onClickActionsButton = (event) => {
|
||||||
if (typeof controls !== "object") {
|
if (typeof controls !== "object") {
|
||||||
@ -79,6 +81,12 @@ export default ({
|
|||||||
onClick={() => onClickActionsButton("next")}
|
onClick={() => onClickActionsButton("next")}
|
||||||
disabled={syncModeLocked}
|
disabled={syncModeLocked}
|
||||||
/>
|
/>
|
||||||
|
{
|
||||||
|
app.isMobile && <LikeButton
|
||||||
|
onClick={controls.like}
|
||||||
|
liked={liked}
|
||||||
|
/>
|
||||||
|
}
|
||||||
{
|
{
|
||||||
!app.isMobile && <antd.Popover
|
!app.isMobile && <antd.Popover
|
||||||
content={React.createElement(
|
content={React.createElement(
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
#root {
|
||||||
|
&.mobile {
|
||||||
|
.player-controls {
|
||||||
|
svg {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.player-controls {
|
.player-controls {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -9,8 +9,6 @@ import SeekBar from "components/Player/SeekBar"
|
|||||||
import Controls from "components/Player/Controls"
|
import Controls from "components/Player/Controls"
|
||||||
import { WithPlayerContext, Context } from "contexts/WithPlayerContext"
|
import { WithPlayerContext, Context } from "contexts/WithPlayerContext"
|
||||||
|
|
||||||
import PlaylistsModel from "models/playlists"
|
|
||||||
|
|
||||||
import "./index.less"
|
import "./index.less"
|
||||||
|
|
||||||
export default (props) => {
|
export default (props) => {
|
||||||
@ -25,10 +23,6 @@ export default (props) => {
|
|||||||
export class AudioPlayer extends React.Component {
|
export class AudioPlayer extends React.Component {
|
||||||
static contextType = Context
|
static contextType = Context
|
||||||
|
|
||||||
state = {
|
|
||||||
liked: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
onMouse = (event) => {
|
onMouse = (event) => {
|
||||||
const { type } = event
|
const { type } = event
|
||||||
|
|
||||||
@ -64,7 +58,7 @@ export class AudioPlayer extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClickPlayButton = () => {
|
onClickPlayButton = () => {
|
||||||
if (this.state.streamMode) {
|
if (this.context.streamMode) {
|
||||||
return app.cores.player.playback.stop()
|
return app.cores.player.playback.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,59 +73,50 @@ export class AudioPlayer extends React.Component {
|
|||||||
app.cores.player.playback.next()
|
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() {
|
render() {
|
||||||
return <div
|
return <div
|
||||||
className={classnames(
|
className={classnames(
|
||||||
"embbededMediaPlayerWrapper",
|
"embbededMediaPlayerWrapper",
|
||||||
{
|
{
|
||||||
["hovering"]: this.props.frame !== false && this.state.showControls,
|
["hovering"]: this.props.frame !== false && this.state.showControls,
|
||||||
["minimized"]: this.context.minimized,
|
["minimized"]: !app.isMobile && this.context.minimized,
|
||||||
["no-frame"]: this.props.frame === false,
|
["no-frame"]: this.props.frame === false,
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
onMouseEnter={this.onMouse}
|
onMouseEnter={this.onMouse}
|
||||||
onMouseLeave={this.onMouse}
|
onMouseLeave={this.onMouse}
|
||||||
>
|
>
|
||||||
<div className="top_controls">
|
{
|
||||||
<antd.Button
|
!app.isMobile && <div className="top_controls">
|
||||||
icon={<Icons.MdFirstPage />}
|
<antd.Button
|
||||||
onClick={this.minimize}
|
icon={<Icons.MdFirstPage />}
|
||||||
shape="circle"
|
onClick={this.minimize}
|
||||||
/>
|
|
||||||
|
|
||||||
{
|
|
||||||
!this.context.syncModeLocked && !this.context.syncMode && <antd.Button
|
|
||||||
icon={<Icons.MdShare />}
|
|
||||||
onClick={this.inviteSync}
|
|
||||||
shape="circle"
|
shape="circle"
|
||||||
/>
|
/>
|
||||||
}
|
|
||||||
|
|
||||||
<antd.Button
|
{
|
||||||
icon={<Icons.MdOpenInFull />}
|
!this.context.syncModeLocked && !this.context.syncMode && <antd.Button
|
||||||
onClick={this.openVisualizer}
|
icon={<Icons.MdShare />}
|
||||||
shape="circle"
|
onClick={this.inviteSync}
|
||||||
/>
|
shape="circle"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
|
||||||
|
<antd.Button
|
||||||
|
icon={<Icons.MdOpenInFull />}
|
||||||
|
onClick={this.openVisualizer}
|
||||||
|
shape="circle"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<antd.Button
|
||||||
|
className="bottom_btn"
|
||||||
|
icon={<Icons.X />}
|
||||||
|
onClick={this.close}
|
||||||
|
shape="square"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<antd.Button
|
|
||||||
className="bottom_btn"
|
|
||||||
icon={<Icons.X />}
|
|
||||||
onClick={this.close}
|
|
||||||
shape="square"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="player">
|
<div className="player">
|
||||||
<div
|
<div
|
||||||
className="cover"
|
className="cover"
|
||||||
@ -159,10 +144,12 @@ export class AudioPlayer extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<LikeButton
|
{
|
||||||
onClick={this.onClickLikeButton}
|
!app.isMobile && <LikeButton
|
||||||
liked={this.state.liked}
|
onClick={app.cores.player.toggleCurrentTrackLike}
|
||||||
/>
|
liked={this.context.liked}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -179,7 +166,9 @@ export class AudioPlayer extends React.Component {
|
|||||||
previous: this.onClickPreviousButton,
|
previous: this.onClickPreviousButton,
|
||||||
toggle: this.onClickPlayButton,
|
toggle: this.onClickPlayButton,
|
||||||
next: this.onClickNextButton,
|
next: this.onClickNextButton,
|
||||||
|
like: app.cores.player.toggleCurrentTrackLike,
|
||||||
}}
|
}}
|
||||||
|
liked={this.context.liked}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
@top_controls_height: 55px;
|
@top_controls_height: 55px;
|
||||||
|
|
||||||
|
#root {
|
||||||
|
&.mobile {
|
||||||
|
.embbededMediaPlayerWrapper {
|
||||||
|
.player {
|
||||||
|
.cover {
|
||||||
|
min-height: 250px;
|
||||||
|
min-width: 250px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.embbededMediaPlayerWrapper {
|
.embbededMediaPlayerWrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
@ -48,6 +48,20 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.MuiSlider-rail {
|
||||||
|
height: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MuiSlider-track {
|
||||||
|
height: 5px;
|
||||||
|
background-color: var(--colorPrimary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.MuiSlider-thumb {
|
||||||
|
background-color: var(--colorPrimary);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
h1,
|
h1,
|
||||||
h2,
|
h2,
|
||||||
h3,
|
h3,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user