From 4862bac495cce67b4a58195800d67543cb12ad48 Mon Sep 17 00:00:00 2001 From: jelveh Date: Sat, 17 May 2025 14:10:34 -0700 Subject: [PATCH] Remove StringView.js --- src/gui/src/UI/Components/StringView.js | 65 ------------------------- src/gui/src/UI/UIWindow2FASetup.js | 11 ++--- 2 files changed, 5 insertions(+), 71 deletions(-) delete mode 100644 src/gui/src/UI/Components/StringView.js diff --git a/src/gui/src/UI/Components/StringView.js b/src/gui/src/UI/Components/StringView.js deleted file mode 100644 index db50af602..000000000 --- a/src/gui/src/UI/Components/StringView.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (C) 2024-present 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 . - */ - - -const Component = use('util.Component'); - -/** - * A simple component that displays a string in the - * specified style. - */ -export default def(class StringView extends Component { - static ID = 'ui.component.StringView'; - - static PROPERTIES = { - text: { value: '' }, - heading: { value: 0 }, - no_html_encode: { value: false }, - } - - static CSS = /*css*/` - h2 { - margin: 0; - color: hsl(220, 25%, 31%); - } - span { - color: #3b4863; - } - `; - - create_template ({ template }) { - $(template).html(``); - } - - on_ready ({ listen }) { - // TODO: listener composition, to avoid this - const either = ({ heading, text }) => { - const wrapper_nodeName = heading ? 'h' + heading : 'span'; - $(this.dom_).find('span').html(`<${wrapper_nodeName}>${ - this.get('no_html_encode') ? text : html_encode(text) - }`); - }; - listen('heading', heading => { - either({ heading, text: this.get('text') }); - }); - listen('text', text => { - either({ heading: this.get('heading'), text }); - }); - } -}); diff --git a/src/gui/src/UI/UIWindow2FASetup.js b/src/gui/src/UI/UIWindow2FASetup.js index bd066929b..19c4ab04d 100644 --- a/src/gui/src/UI/UIWindow2FASetup.js +++ b/src/gui/src/UI/UIWindow2FASetup.js @@ -47,7 +47,7 @@ import QRCodeView from "./Components/QRCode.js"; import RecoveryCodesView from "./Components/RecoveryCodesView.js"; import StepHeading from "./Components/StepHeading.js"; import StepView from "./Components/StepView.js"; -import StringView from "./Components/StringView.js"; +import JustHTML from "./Components/JustHTML.js"; import UIComponentWindow from "./UIComponentWindow.js"; const UIWindow2FASetup = async function UIWindow2FASetup () { @@ -113,9 +113,8 @@ const UIWindow2FASetup = async function UIWindow2FASetup () { symbol: '1', text: i18n('setup2fa_1_step_heading'), }), - new StringView({ - text: i18n('setup2fa_1_instructions', [], false), - no_html_encode: true, + new JustHTML({ + html: `
${i18n('setup2fa_1_instructions', [], false)}
` }), new StepHeading({ symbol: '2', @@ -152,8 +151,8 @@ const UIWindow2FASetup = async function UIWindow2FASetup () { symbol: '4', text: i18n('setup2fa_4_step_heading') }), - new StringView({ - text: i18n('setup2fa_4_instructions', [], false) + new JustHTML({ + html: `
${i18n('setup2fa_4_instructions', [], false)}
` }), new RecoveryCodesView({ values: data.codes,