Skip to content

Commit

Permalink
Disabled record and save buttons while music is playing (sugarlabs#4245)
Browse files Browse the repository at this point in the history
* Disabled record and save buttons while music is playing

* removed extra lines
  • Loading branch information
falgun143 authored Jan 10, 2025
1 parent cf84e3f commit 7cb169b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/artwork.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions js/logo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1792,6 +1792,14 @@ class Logo {
}
}
document.getElementById("stop").style.color = "white";
const saveButton = docById('saveButton');
const saveButtonAdvanced = docById('saveButtonAdvanced');
const recordButton = docById("record");
saveButton.disabled = false;
saveButtonAdvanced.disabled = false;
saveButton.className = "";
saveButtonAdvanced.className = "";
recordButton.className = "";
}
}
}
Expand Down
13 changes: 12 additions & 1 deletion js/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class Toolbar {
renderPlayIcon(onclick) {
const playIcon = docById("play");
const stopIcon = docById("stop");

const recordButton = docById("record");
let isPlayIconRunning = false;

function handleClick() {
Expand All @@ -378,6 +378,11 @@ class Toolbar {
onclick(this.activity);
handleClick();
stopIcon.style.color = this.stopIconColorWhenPlaying;
saveButton.disabled = true;
saveButtonAdvanced.disabled = true;
saveButton.className = "grey-text inactiveLink";
saveButtonAdvanced.className = "grey-text inactiveLink";
recordButton.className = "grey-text inactiveLink";
isPlayIconRunning = true;
play_button_debounce_timeout = setTimeout(function() { handleClick(); }, 2000);

Expand All @@ -399,9 +404,15 @@ class Toolbar {
*/
renderStopIcon(onclick) {
const stopIcon = docById("stop");
const recordButton = docById("record");
stopIcon.onclick = () => {
onclick(this.activity);
stopIcon.style.color = "white";
saveButton.disabled = false;
saveButtonAdvanced.disabled = false;
saveButton.className = "";
saveButtonAdvanced.className = "";
recordButton.className = "";
};
}

Expand Down

0 comments on commit 7cb169b

Please sign in to comment.