diff --git a/src/dev-center/js/dev-center.js b/src/dev-center/js/dev-center.js index 8aa2f4454..6b20ff8ce 100644 --- a/src/dev-center/js/dev-center.js +++ b/src/dev-center/js/dev-center.js @@ -288,6 +288,8 @@ async function create_app(title, source_path = null, items = null) { }) .then(async (app) => { + $('.new-app-modal').get(0).close(); + window.location.reload(); let app_dir; // ---------------------------------------------------- // Create app directory in AppData @@ -313,6 +315,8 @@ async function create_app(title, source_path = null, items = null) { maximizeOnStart: false, background: false, }).then(async (app) => { + $('.new-app-modal').get(0).close(); + window.location.reload(); // refresh app list puter.apps.list().then(async (resp) => { apps = resp; @@ -509,7 +513,7 @@ function generate_edit_app_section(app) {
index.html
Ready to deploy 🚀
Cancel
`; + drop_area_content = `index.html
Ready to deploy 🚀
`; $('.drop-area').html(drop_area_content); // enable deploy button @@ -836,7 +840,7 @@ async function edit_app_section(cur_app_name) { dropped_items = items; $('.drop-area').removeClass('drop-area-hover'); $('.drop-area').addClass('drop-area-ready-to-deploy'); - drop_area_content = `${items.length} items
Ready to deploy 🚀
Cancel
`; + drop_area_content = `${items.length} items
Ready to deploy 🚀
`; $('.drop-area').html(drop_area_content); // enable deploy button @@ -877,7 +881,7 @@ async function edit_app_section(cur_app_name) { $('.drop-area').removeClass('drop-area-hover'); $('.drop-area').addClass('drop-area-ready-to-deploy'); - drop_area_content = `${rootItems}
Ready to deploy 🚀
Cancel
`; + drop_area_content = `${rootItems}
Ready to deploy 🚀
`; $('.drop-area').html(drop_area_content); // enable deploy button @@ -951,7 +955,7 @@ async function edit_app_section(cur_app_name) { rootItems = html_encode(rootItems); $('.drop-area').removeClass('drop-area-hover'); $('.drop-area').addClass('drop-area-ready-to-deploy'); - drop_area_content = `${rootItems}
Ready to deploy 🚀
Cancel
`; + drop_area_content = `${rootItems}
Ready to deploy 🚀
`; $('.drop-area').html(drop_area_content); // enable deploy button @@ -1645,7 +1649,7 @@ window.deploy = async function (app, items) { $('.deploy-btn').addClass('disabled'); // change drop area text - $('.drop-area').html(deploying_spinner + 'Ready to deploy 🚀
Cancel
`; + let drop_area_content = `Ready to deploy 🚀
`; $('.drop-area').html(drop_area_content); // deploy @@ -2458,9 +2468,32 @@ function enable_window_settings(){ $('#edit-app-hide-titlebar').prop('disabled', false); } -$(document).on('click', '.reset-deploy', function (e) { - reset_drop_area(); -}) +$(document).on('click', '.reset-deploy', async function (e) { + // Display a confirmation dialog to ask the user + const alert_resp = await puter.ui.alert( + 'Are you sure you want to cancel the deployment?', + [ + { + label: 'Yes, cancel deployment', + value: 'cancel', + type: 'danger', // This can style the button as red/danger + }, + { + label: 'No, keep it', + value: 'keep' + } + ] + ); + + if (alert_resp === 'cancel') { + // If the user clicks "Yes, cancel deployment", reset the drop area + reset_drop_area(); + } else { + // If the user clicks "No, keep it", do nothing or log it + console.log('Deployment is not canceled.'); + } +}); + $(document).on('click', '.sidebar-toggle', function (e) { $('.sidebar').toggleClass('open');