-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Added Volume Control Slider to BrainzPlayer #3097
Open
Suvid-Singhal
wants to merge
21
commits into
metabrainz:master
Choose a base branch
from
Suvid-Singhal:volume-slider
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+111
−20
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a1cd0c4
Added Volume Control Slider to BrainzPlayer
Suvid-Singhal f753ce3
Removed debug console.log() statements
Suvid-Singhal 86876e4
Merge branch 'master' into volume-slider
Suvid-Singhal 49e3cc3
Lint css files
Suvid-Singhal e21d449
Fixed some errors
Suvid-Singhal 602ecaa
Fix some TS errors
Suvid-Singhal 0cc8fe3
Merge branch 'master' into volume-slider
Suvid-Singhal c9b2d31
Better coding practices and implemented few suggested changes
Suvid-Singhal f3ce046
Merge branch 'master' into volume-slider
Suvid-Singhal db6dcfe
Fixed test files errors
Suvid-Singhal ab8fd77
Moved VolumeControlButton to a new file and set default volume
Suvid-Singhal 8f3ab8b
Merge branch 'master' into volume-slider
Suvid-Singhal b7b0423
Hide volume slider for small and extra small viewports
Suvid-Singhal 4b18996
Merge branch 'master' into volume-slider
Suvid-Singhal 89b67bd
Changed few css classes and code refactoring
Suvid-Singhal f156734
Merge branch 'master' into volume-slider
Suvid-Singhal c851b1e
Removed setVolume from render function in all the players and fixed s…
Suvid-Singhal 7fd2c7d
Merge branch 'master' into volume-slider
Suvid-Singhal 1faccbe
Removed unused elemts from props, fixed linting errors
Suvid-Singhal d551af7
Added button to reveal volume slider and refactored code
Suvid-Singhal 890daf7
Fix a small error
Suvid-Singhal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
frontend/js/src/common/brainzplayer/VolumeControlButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as React from "react"; | ||
import { useBrainzPlayerDispatch } from "./BrainzPlayerContext"; | ||
|
||
function VolumeControlButton() { | ||
const dispatch = useBrainzPlayerDispatch(); | ||
const handleVolumeChange = (e: React.MouseEvent<HTMLInputElement>) => { | ||
dispatch({ | ||
type: "VOLUME_CHANGE", | ||
data: e.currentTarget?.value ?? 100, | ||
}); | ||
}; | ||
return ( | ||
<input | ||
onMouseUp={handleVolumeChange} | ||
className="volume-input" | ||
type="range" | ||
defaultValue="100" | ||
max="100" | ||
min="0" | ||
step="5" | ||
/> | ||
); | ||
} | ||
|
||
export default VolumeControlButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of rendering the input directly in here, I suggest rendering a volume icon. When clicking on the icon, the volume input will appear above it.
For CSS styles for the hidden/shown input, you can take inspiration from the player queue (the three horizontal bars in the player UI)
https://github.com/metabrainz/listenbrainz-server/blob/f40c908885229d42c5cb7716ea57a54d39ed2ca4/frontend/css/brainzplayer.less#L354C2-L370C4