Skip to content

Commit

Permalink
Removed unused elemts from props, fixed linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Suvid-Singhal committed Jan 15, 2025
1 parent 7fd2c7d commit 1faccbe
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion frontend/js/src/common/brainzplayer/BrainzPlayerUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ function BrainzPlayerUI(props: React.PropsWithChildren<BrainzPlayerUIProps>) {
disabled={disabled}
/>
</div>
<VolumeControlButton volume={volume} />
<VolumeControlButton />
<div className="actions">
{isPlayingATrack && currentDataSourceName && (
<a
Expand Down
5 changes: 4 additions & 1 deletion frontend/js/src/common/brainzplayer/SoundcloudPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ export default class SoundcloudPlayer

componentDidUpdate(prevProps: DataSourceProps) {
const { show, volume } = this.props;
this.soundcloudPlayer?.setVolume((volume ?? 100) / 100);
if (this.soundcloudPlayer?.setVolume) {
this.soundcloudPlayer?.setVolume((volume ?? 100) / 100);
}

if (prevProps.show && !show && this.soundcloudPlayer) {
this.soundcloudPlayer.pause();
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/js/src/common/brainzplayer/SpotifyPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ export default class SpotifyPlayer

componentDidUpdate(prevProps: DataSourceProps) {
const { show, volume } = this.props;
this.spotifyPlayer?.setVolume((volume ?? 100) / 100);
if (this.spotifyPlayer?.setVolume) {
this.spotifyPlayer?.setVolume((volume ?? 100) / 100);
}

if (prevProps.show === true && show === false) {
this.stopAndClear();
Expand Down
6 changes: 1 addition & 5 deletions frontend/js/src/common/brainzplayer/VolumeControlButton.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import * as React from "react";
import { useBrainzPlayerDispatch } from "./BrainzPlayerContext";

type VolumeControlButtonProps = {
volume: number;
};

function VolumeControlButton(props: VolumeControlButtonProps) {
function VolumeControlButton() {
const dispatch = useBrainzPlayerDispatch();
const volumeRef = React.useRef<HTMLInputElement>(null);
const handleVolumeChange = () => {
Expand Down
4 changes: 3 additions & 1 deletion frontend/js/src/common/brainzplayer/YoutubePlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export default class YoutubePlayer extends React.Component<YoutubePlayerProps>

componentDidUpdate(prevProps: DataSourceProps) {
const { show, volume } = this.props;
this.youtubePlayer?.setVolume(volume ?? 100);
if (this.youtubePlayer?.setVolume) {
this.youtubePlayer?.setVolume(volume ?? 100);
}
if (prevProps.show && !show && this.youtubePlayer) {
this.youtubePlayer.stopVideo();
// Clear playlist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const defaultContext = {

const props = {
show: true,
volume: 100,
playerPaused: false,
refreshSoundcloudToken: new APIService("base-uri").refreshSoundcloudToken,
onPlayerPausedChange: (paused: boolean) => {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import APIService from "../../../src/utils/APIService";

const props = {
show: true,
volume: 100,
playerPaused: false,
youtubeUser: {
api_key: "fake-api-key",
Expand Down

0 comments on commit 1faccbe

Please sign in to comment.