From 6d1c807879be9c0995bcb59e1db61e272d677815 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 15 Apr 2024 16:50:29 +0100 Subject: [PATCH] Settings: Move 'Personalization' tab into its own file --- src/UI/Settings/UITabPersonalization.js | 47 +++++++++++++++++++++++++ src/UI/Settings/UIWindowSettings.js | 26 ++------------ 2 files changed, 49 insertions(+), 24 deletions(-) create mode 100644 src/UI/Settings/UITabPersonalization.js diff --git a/src/UI/Settings/UITabPersonalization.js b/src/UI/Settings/UITabPersonalization.js new file mode 100644 index 00000000..79977d3a --- /dev/null +++ b/src/UI/Settings/UITabPersonalization.js @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2024 Puter Technologies Inc. + * + * This file is part of Puter. + * + * Puter is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +import UIWindowThemeDialog from '../UIWindowThemeDialog.js'; + +// About +export default { + id: 'personalization', + title_i18n_key: 'personalization', + icon: 'palette-outline.svg', + html: () => { + return ` +

${i18n('personalization')}

+
+ ${i18n('ui_colors')} +
+ +
+
`; + }, + init: ($el_window) => { + $el_window.find('.change-ui-colors').on('click', function (e) { + UIWindowThemeDialog({ + window_options:{ + parent_uuid: $el_window.attr('data-element_uuid'), + disable_parent_window: true, + parent_center: true, + } + }); + }); + }, +}; diff --git a/src/UI/Settings/UIWindowSettings.js b/src/UI/Settings/UIWindowSettings.js index 59300f4a..6d59664f 100644 --- a/src/UI/Settings/UIWindowSettings.js +++ b/src/UI/Settings/UIWindowSettings.js @@ -26,6 +26,7 @@ import UIWindowConfirmUserDeletion from './UIWindowConfirmUserDeletion.js'; import AboutTab from './UITabAbout.js'; import UsageTab from './UITabUsage.js'; import AccountTab from './UITabAccount.js'; +import PersonalizationTab from './UITabPersonalization.js'; import UIWindowThemeDialog from '../UIWindowThemeDialog.js'; import UIWindowManageSessions from '../UIWindowManageSessions.js'; @@ -37,7 +38,7 @@ async function UIWindowSettings(options){ AboutTab, UsageTab, AccountTab, - // PersonalizationTab, + PersonalizationTab, // LanguageTab, // ClockTab, ]; @@ -51,7 +52,6 @@ async function UIWindowSettings(options){ tabs.forEach((tab, i) => { h += `
${i18n(tab.title_i18n_key)}
`; }); - h += `
${i18n('personalization')}
`; h += `
${i18n('language')}
`; h += `
${i18n('clock')}
`; h += ``; @@ -65,18 +65,6 @@ async function UIWindowSettings(options){ `; }); - // Personalization - h += `
`; - h += `

${i18n('personalization')}

`; - // change password button - h += `
`; - h += `${i18n('ui_colors')}`; - h += `
`; - h += ``; - h += `
`; - h += `
`; - h += `
`; - // Language h += `
`; h += `

${i18n('language')}

`; @@ -147,16 +135,6 @@ async function UIWindowSettings(options){ const $el_window = $(el_window); tabs.forEach(tab => tab.init($el_window)); - $(el_window).find('.change-ui-colors').on('click', function (e) { - UIWindowThemeDialog({ - window_options:{ - parent_uuid: $(el_window).attr('data-element_uuid'), - disable_parent_window: true, - parent_center: true, - } - }); - }) - $(el_window).on('click', '.settings-sidebar-item', function(){ const $this = $(this); const settings = $this.attr('data-settings');