Browse Source

Added currentsong to top of queue songlist.

KrisVos130 7 years ago
parent
commit
36fb0b0ffe

+ 1 - 1
frontend/app/js/views/Station/Views/Queue/SongItem.jsx

@@ -45,7 +45,7 @@ export default class SongItem extends Component {
 	render() {
 		const { song } = this.props;
 		const showRequestedBy = (song.get("requestedByUsername") && song.get("requestedByUsername") !== "Unknown");
-		const showDelete = (this.isOwner());
+		const showDelete = (this.isOwner() && this.props.deleteable !== false);
 
 		return (
 			<li>

+ 19 - 0
frontend/app/js/views/Station/Views/Queue/SongList.jsx

@@ -1,5 +1,6 @@
 import React, { Component } from "react";
 import PropTypes from "prop-types";
+import { Map } from "immutable";
 
 import { connect } from "react-redux";
 
@@ -9,6 +10,14 @@ import SongItem from "./SongItem.jsx";
 	station: {
 		songList: state.station.info.get("songList"),
 	},
+	currentSong: {
+		exists: state.station.currentSong.get("songId") !== "",
+		songId: state.station.currentSong.get("songId"),
+		thumbnail: state.station.currentSong.get("thumbnail"),
+		duration: state.station.currentSong.getIn(["timings", "duration"]),
+		title: state.station.currentSong.get("title"),
+		artists: state.station.currentSong.get("artists"),
+	},
 }))
 export default class SongList extends Component {
 	constructor(props) {
@@ -18,8 +27,18 @@ export default class SongList extends Component {
 	render() {
 		const { songList } = this.props.station;
 
+		const currentSong = (this.props.currentSong.exists) ? Map({
+			thumbnail: this.props.currentSong.thumbnail,
+			duration: this.props.currentSong.duration,
+			title: this.props.currentSong.title,
+			artists: this.props.currentSong.artists,
+		}) : null;
+
 		return (
 			<ul>
+				{
+					(this.props.currentSong.exists) ? <SongItem key={ this.props.currentSong.songId } song={ currentSong } deleteable={ false }/> : null
+				}
 				{
 					songList.map((song) => {
 						return <SongItem key={ song.get("songId") } song={ song }/>;