From e20a87bf7fd380c7cd7b301c1761a0a760c5e006 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 23 Dec 2023 20:48:10 +0100 Subject: [PATCH] enh(core): Refactor profile page to use vue components Signed-off-by: Ferdinand Thiessen --- core/src/{profile.js => profile.ts} | 22 +- core/src/views/Profile.vue | 482 +++++++++++----------------- core/templates/profile.php | 6 +- webpack.modules.js | 2 +- 4 files changed, 188 insertions(+), 324 deletions(-) rename core/src/{profile.js => profile.ts} (81%) diff --git a/core/src/profile.js b/core/src/profile.ts similarity index 81% rename from core/src/profile.js rename to core/src/profile.ts index 79465c6a28d..ee1593e8705 100644 --- a/core/src/profile.js +++ b/core/src/profile.ts @@ -20,17 +20,14 @@ * */ -import Vue from 'vue' import { getRequestToken } from '@nextcloud/auth' -import { translate as t } from '@nextcloud/l10n' -import VTooltip from 'v-tooltip' - -import logger from './logger.js' +import Vue from 'vue' import Profile from './views/Profile.vue' import ProfileSections from './profile/ProfileSections.js' -__webpack_nonce__ = btoa(getRequestToken()) +// @ts-expect-error Script nonce required for webpack loading additional scripts +__webpack_nonce__ = btoa(getRequestToken() ?? '') if (!window.OCA) { window.OCA = {} @@ -41,19 +38,8 @@ if (!window.OCA.Core) { } Object.assign(window.OCA.Core, { ProfileSections: new ProfileSections() }) -Vue.use(VTooltip) - -Vue.mixin({ - props: { - logger, - }, - methods: { - t, - }, -}) - const View = Vue.extend(Profile) window.addEventListener('DOMContentLoaded', () => { - new View().$mount('#vue-profile') + new View().$mount('#content') }) diff --git a/core/src/views/Profile.vue b/core/src/views/Profile.vue index 84859f4a971..b7f593df8d2 100644 --- a/core/src/views/Profile.vue +++ b/core/src/views/Profile.vue @@ -22,197 +22,185 @@ --> - - - diff --git a/core/templates/profile.php b/core/templates/profile.php index 84d6eb0e38f..33cfaeb52c6 100644 --- a/core/templates/profile.php +++ b/core/templates/profile.php @@ -1,5 +1 @@ -
-
+
diff --git a/webpack.modules.js b/webpack.modules.js index e0913a4483f..96f6387dc65 100644 --- a/webpack.modules.js +++ b/webpack.modules.js @@ -35,7 +35,7 @@ module.exports = { login: path.join(__dirname, 'core/src', 'login.js'), main: path.join(__dirname, 'core/src', 'main.js'), maintenance: path.join(__dirname, 'core/src', 'maintenance.js'), - profile: path.join(__dirname, 'core/src', 'profile.js'), + profile: path.join(__dirname, 'core/src', 'profile.ts'), recommendedapps: path.join(__dirname, 'core/src', 'recommendedapps.js'), systemtags: path.resolve(__dirname, 'core/src', 'systemtags/merged-systemtags.js'), 'unified-search': path.join(__dirname, 'core/src', 'unified-search.js'),