Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/HeaderBar/Volume.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default class Volume extends React.Component {
name="volume"
min={0}
max={100}
defaultValue={this.props.volume}
value={this.props.volume}
style={sliderStyle}
onChange={this.handleVolumeChange}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/utils/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ import './bans';
import './chat';
import './help';
import './mutes';
import './playback';
import './staff';
import './users';
import './waitlist';
41 changes: 41 additions & 0 deletions src/utils/commands/playback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { register } from '../ChatCommands';
import { log } from '../../actions/ChatActionCreators';
import {
setVolume,
mute,
unmute
} from '../../actions/PlaybackActionCreators';
import {
doUpvote,
doDownvote
} from '../../actions/VoteActionCreators';

register(
'volume',
'Set the current volume.',
{
action: (value) => {
const volume = parseInt(value, 10);
if (!isFinite(volume) || volume < 0 || volume > 100) {
return log('Volume must be a number between 0 and 100.');
}
return setVolume(volume);
}
}
);

register('mute', 'Mute the volume.', {
action: () => mute()
});

register('unmute', 'Unmute the media volume.', {
action: () => unmute()
});

register('upvote', 'Upvote the current track.', {
action: () => doUpvote()
});

register('downvote', 'Downvote the current track.', {
action: () => doDownvote()
});
21 changes: 21 additions & 0 deletions src/utils/commands/users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { register } from '../ChatCommands';
import {
log
} from '../../actions/ChatActionCreators';
import {
doChangeUsername
} from '../../actions/UserActionCreators';

register(
'nick',
'Change your username.',
{
action: (name) => {
if (name.length < 3 || name.length > 32) {
return log('Username must be between 3 and 32 characters long.');
}

return doChangeUsername(name);
}
}
);