From c6b0ed32bf5d2f2d384cb41517b31445d7b79db6 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 15 Apr 2024 17:07:37 +0100 Subject: [PATCH] Settings: Move 'Clock' tab into its own file --- src/UI/Settings/UITabClock.js | 45 +++++++++++++++++++++++++++++ src/UI/Settings/UIWindowSettings.js | 26 ++--------------- 2 files changed, 47 insertions(+), 24 deletions(-) create mode 100644 src/UI/Settings/UITabClock.js diff --git a/src/UI/Settings/UITabClock.js b/src/UI/Settings/UITabClock.js new file mode 100644 index 000000000..03eb7be9a --- /dev/null +++ b/src/UI/Settings/UITabClock.js @@ -0,0 +1,45 @@ +/** + * 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: 'clock', + title_i18n_key: 'clock', + icon: 'clock.svg', + html: () => { + return ` +

${i18n('clock')}

+
+ ${i18n('visibility')}: + +
`; + }, + init: ($el_window) => { + $el_window.on('change', 'select.change-clock-visible', function(e){ + window.change_clock_visible(this.value); + }); + + window.change_clock_visible(); + }, +}; diff --git a/src/UI/Settings/UIWindowSettings.js b/src/UI/Settings/UIWindowSettings.js index 20397f5d7..a1827401c 100644 --- a/src/UI/Settings/UIWindowSettings.js +++ b/src/UI/Settings/UIWindowSettings.js @@ -28,6 +28,7 @@ import UsageTab from './UITabUsage.js'; import AccountTab from './UITabAccount.js'; import PersonalizationTab from './UITabPersonalization.js'; import LanguageTab from './UITabLanguage.js'; +import ClockTab from './UITabClock.js'; import UIWindowThemeDialog from '../UIWindowThemeDialog.js'; import UIWindowManageSessions from '../UIWindowManageSessions.js'; @@ -41,7 +42,7 @@ async function UIWindowSettings(options){ AccountTab, PersonalizationTab, LanguageTab, - // ClockTab, + ClockTab, ]; let h = ''; @@ -53,7 +54,6 @@ async function UIWindowSettings(options){ tabs.forEach((tab, i) => { h += `
${i18n(tab.title_i18n_key)}
`; }); - h += `
${i18n('clock')}
`; h += ``; // content @@ -65,19 +65,6 @@ async function UIWindowSettings(options){ `; }); - // Clock - h += `
`; - h += `

${i18n('clock')}

`; - h += `
` - h += `${i18n('visibility')}:` - h += `` - h += `
` - h += `
`; - h += ``; h += ``; h += ``; @@ -138,15 +125,6 @@ async function UIWindowSettings(options){ } }) - $(el_window).on('change', 'select.change-clock-visible', function(e){ - const $this = $(this); - const value = $this.val(); - - window.change_clock_visible(value); - }) - - window.change_clock_visible(); - resolve(el_window); }); }