Skip to content

Commit

Permalink
fix(scenes): proper select order
Browse files Browse the repository at this point in the history
  • Loading branch information
mwfarb committed Jun 22, 2022
1 parent b8eee4a commit 2e4f4b0
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions scenes/scenes.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ window.addEventListener('onauth', async function(e) {
const userNoteSpan = document.getElementById('userNoteSpan');
const tabMyScenes = document.getElementById('myscenes-tab');

window.publicButtons.push(enterPublicSceneBtn);
if (auth.authenticated) {
window.publicButtons.push(clonePublicSceneBtn); // add clone option for full user
tabMyScenes.parentElement.style.display = 'block';
} else {
tabMyScenes.parentElement.style.display = 'none'; // anon users may not edit scenes
userNoteSpan.textContent = 'To create or clone scenes, please login with an authenticated account.';
}

const toggleUserSceneButtons = (toggle) => {
[enterUserSceneBtn, cloneUserSceneBtn, deleteUserSceneBtn, copyUserSceneUrlBtn].forEach((btn) => {
toggle ? btn.classList.remove('disabled') : btn.classList.add('disabled')
Expand Down Expand Up @@ -133,7 +142,7 @@ window.addEventListener('onauth', async function(e) {
deleteUserSceneBtn.addEventListener('click', () => {
if (confirm(`Are you sure you want to delete ${deleteUserSceneBtn.value}?`)) {
const deletes = [
axios.delete(`scenes/${deleteUserSceneBtn.value}`, {
axios.delete(`/user/scenes/${deleteUserSceneBtn.value}`, {
withCredentials: true
}),
axios.delete(`/persist/${deleteUserSceneBtn.value}`)
Expand Down Expand Up @@ -170,15 +179,6 @@ window.addEventListener('onauth', async function(e) {
window.publicSceneId = '';
window.cloneSceneId = '';

if (auth.authenticated) {
window.publicButtons.push(clonePublicSceneBtn); // add clone option for full user
//tabMyScenes.parentElement.style.display = 'inline-block';
} else {
tabMyScenes.parentElement.style.display = 'none'; // anon users may not edit scenes
window.publicButtons.push(enterPublicSceneBtn); // just one, for anon case
userNoteSpan.textContent = 'To create or clone scenes, please login with an authenticated account.';
}

/* *********************** */

const newSceneNameInput = document.getElementById('newSceneNameInput');
Expand Down Expand Up @@ -256,7 +256,5 @@ window.addEventListener('onauth', async function(e) {
console.log(err);
});

if (!auth.authenticated) {
window.dispatchEvent(new Event('hashchange')); // Manually trigger initial hash routing
}
window.dispatchEvent(new Event('hashchange')); // Manually trigger initial hash routing
});

0 comments on commit 2e4f4b0

Please sign in to comment.