Skip to content

Commit

Permalink
change value -> field name in set functions
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey-wu committed Oct 10, 2024
1 parent d005308 commit e3982a6
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 53 deletions.
28 changes: 14 additions & 14 deletions client/multiplayer/room.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -562,21 +562,21 @@ function setDifficulties ({ difficulties, username = undefined }) {
});
}

function setPacketNumbers ({ username, value }) {
value = arrayToRange(value);
logEvent(username, value.length > 0 ? `changed packet numbers to ${value}` : 'cleared packet numbers');
document.getElementById('packet-number').value = value;
function setPacketNumbers ({ username, packetNumbers }) {
packetNumbers = arrayToRange(packetNumbers);
logEvent(username, packetNumbers.length > 0 ? `changed packet numbers to ${packetNumbers}` : 'cleared packet numbers');
document.getElementById('packet-number').value = packetNumbers;
}

function setReadingSpeed ({ username, value }) {
logEvent(username, `changed the reading speed to ${value}`);
document.getElementById('reading-speed').value = value;
document.getElementById('reading-speed-display').textContent = value;
function setReadingSpeed ({ username, readingSpeed }) {
logEvent(username, `changed the reading speed to ${readingSpeed}`);
document.getElementById('reading-speed').value = readingSpeed;
document.getElementById('reading-speed-display').textContent = readingSpeed;
}

function setSetName ({ username, value }) {
logEvent(username, value.length > 0 ? `changed set name to ${value}` : 'cleared set name');
document.getElementById('set-name').value = value;
function setSetName ({ username, setName }) {
logEvent(username, setName.length > 0 ? `changed set name to ${setName}` : 'cleared set name');
document.getElementById('set-name').value = setName;
}

function setUsername ({ oldUsername, newUsername, userId }) {
Expand Down Expand Up @@ -823,7 +823,7 @@ document.getElementById('pause').addEventListener('click', function () {
});

document.getElementById('reading-speed').addEventListener('change', function () {
socket.send(JSON.stringify({ type: 'set-reading-speed', value: this.value }));
socket.send(JSON.stringify({ type: 'set-reading-speed', readingSpeed: this.value }));
});

document.getElementById('reading-speed').addEventListener('input', function () {
Expand Down Expand Up @@ -853,7 +853,7 @@ document.getElementById('set-name').addEventListener('change', async function ()

socket.send(JSON.stringify({
type: 'set-set-name',
value: this.value,
setName: this.value,
packetNumbers: rangeToArray(document.getElementById('packet-number').value)
}));
});
Expand Down Expand Up @@ -1006,6 +1006,6 @@ ReactDOM.createRoot(document.getElementById('category-modal-root')).render(

ReactDOM.createRoot(document.getElementById('difficulty-dropdown-root')).render(
<DifficultyDropdown
onChange={() => socket.send(JSON.stringify({ type: 'set-difficulties', value: getDropdownValues('difficulties') }))}
onChange={() => socket.send(JSON.stringify({ type: 'set-difficulties', difficulties: getDropdownValues('difficulties') }))}
/>
);
Loading

0 comments on commit e3982a6

Please sign in to comment.