From 19c62d051f8f007212a3846e8db20f41683d3c7c Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Sat, 30 Oct 2021 03:36:33 +0000 Subject: Add new profile visibility section Signed-off-by: Christopher Ng Signed-off-by: nextcloud-command --- .../ProfileVisibilitySection.vue | 66 +++++++++++++++------- 1 file changed, 47 insertions(+), 19 deletions(-) (limited to 'apps/settings/src/components/PersonalInfo/ProfileVisibilitySection/ProfileVisibilitySection.vue') diff --git a/apps/settings/src/components/PersonalInfo/ProfileVisibilitySection/ProfileVisibilitySection.vue b/apps/settings/src/components/PersonalInfo/ProfileVisibilitySection/ProfileVisibilitySection.vue index c27bef347c6..e2989382bf5 100644 --- a/apps/settings/src/components/PersonalInfo/ProfileVisibilitySection/ProfileVisibilitySection.vue +++ b/apps/settings/src/components/PersonalInfo/ProfileVisibilitySection/ProfileVisibilitySection.vue @@ -21,18 +21,24 @@ --> @@ -41,8 +47,8 @@ import { loadState } from '@nextcloud/initial-state' import { subscribe, unsubscribe } from '@nextcloud/event-bus' import HeaderBar from '../shared/HeaderBar' -import VisibilityDropdown from '../shared/VisibilityDropdown' -import { ACCOUNT_PROPERTY_ENUM, PROFILE_READABLE_ENUM } from '../../../constants/AccountPropertyConstants' +import VisibilityDropdown from './VisibilityDropdown' +import { PROFILE_READABLE_ENUM } from '../../../constants/AccountPropertyConstants' const { profileConfig } = loadState('settings', 'profileParameters', {}) const { profileEnabled } = loadState('settings', 'personalInfoParameters', false) @@ -59,10 +65,11 @@ export default { return { heading: PROFILE_READABLE_ENUM.PROFILE_VISIBILITY, profileEnabled, - visibilityArray: Object.entries(profileConfig) - // Filter for profile parameters registered by apps in this section as visibility controls for the rest (account properties) are handled in their respective property sections - .filter(([paramId, { displayId, visibility }]) => !Object.values(ACCOUNT_PROPERTY_ENUM).includes(paramId)) - .map(([paramId, { displayId, visibility }]) => ({ id: paramId, displayId, visibility })), + visibilityParams: Object.entries(profileConfig) + .map(([paramId, { appId, displayId, visibility }]) => ({ id: paramId, appId, displayId, visibility })) + .sort((a, b) => a.appId === b.appId ? a.displayId.localeCompare(b.displayId) : (a.appId !== 'core' ? -1 : 1)), + // TODO remove this when not used once the settings layout is updated + marginLeft: window.getComputedStyle(document.getElementById('personal-settings-avatar-container')).getPropertyValue('width').trim(), } }, @@ -74,6 +81,12 @@ export default { mounted() { subscribe('settings:profile-enabled:updated', this.handleProfileEnabledUpdate) + // TODO remove this when not used once the settings layout is updated + window.onresize = () => { + this.marginLeft = window.matchMedia('(min-width: 1200px)').matches + ? window.getComputedStyle(document.getElementById('personal-settings-avatar-container')).getPropertyValue('width').trim() + : '0px' + } }, beforeDestroy() { @@ -90,11 +103,11 @@ export default { -- cgit v1.2.3