UIWindowConfirmUserDeletion.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * Copyright (C) 2024 Puter Technologies Inc.
  3. *
  4. * This file is part of Puter.
  5. *
  6. * Puter is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as published
  8. * by the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. import UIWindow from '../UIWindow.js'
  20. import UIWindowFinalizeUserDeletion from './UIWindowFinalizeUserDeletion.js'
  21. async function UIWindowConfirmUserDeletion(options){
  22. return new Promise(async (resolve) => {
  23. options = options ?? {};
  24. let h = '';
  25. h += `<div style="padding: 20px;">`;
  26. h += `<div class="generic-close-window-button disable-user-select"> &times; </div>`;
  27. h += `<img src="${window.icons['danger.svg']}" style="width: 70px; margin: 20px auto 20px; display: block; margin-bottom: 20px;">`;
  28. h += `<p style="text-align: center; font-size: 16px; padding: 20px; font-weight: 400; margin: -10px 10px 20px 10px; -webkit-font-smoothing: antialiased; color: #5f626d;">${i18n('confirm_delete_user')}</p>`;
  29. h += `<button class="button button-block button-danger proceed-with-user-deletion" style="margin-bottom: 20px;">${i18n('proceed_with_account_deletion')}</button>`;
  30. h += `<button class="button button-block button-secondary cancel-user-deletion">${i18n('cancel')}</button>`;
  31. h += `</div>`;
  32. const el_window = await UIWindow({
  33. title: i18n('confirm_delete_user_title'),
  34. icon: null,
  35. uid: null,
  36. is_dir: false,
  37. body_content: h,
  38. has_head: false,
  39. selectable_body: false,
  40. draggable_body: false,
  41. allow_context_menu: false,
  42. is_draggable: true,
  43. is_resizable: false,
  44. is_droppable: false,
  45. init_center: true,
  46. allow_native_ctxmenu: true,
  47. allow_user_select: true,
  48. backdrop: true,
  49. onAppend: function(el_window){
  50. },
  51. width: 500,
  52. dominant: true,
  53. window_css: {
  54. height: 'initial',
  55. padding: '0',
  56. border: 'none',
  57. boxShadow: '0 0 10px rgba(0,0,0,.2)',
  58. borderRadius: '5px',
  59. backgroundColor: 'white',
  60. color: 'black',
  61. },
  62. });
  63. $(el_window).find('.generic-close-window-button').on('click', function(){
  64. $(el_window).close();
  65. });
  66. $(el_window).find('.cancel-user-deletion').on('click', function(){
  67. $(el_window).close();
  68. });
  69. $(el_window).find('.proceed-with-user-deletion').on('click', function(){
  70. UIWindowFinalizeUserDeletion();
  71. $(el_window).close();
  72. });
  73. })
  74. }
  75. export default UIWindowConfirmUserDeletion;