nextcloud/dist/theming-settings-admin.mjs.map

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1 line
37 KiB
Text
Raw Normal View History

{"version":3,"file":"theming-settings-admin.mjs","sources":["../build/frontend/apps/theming/src/components/AdminSectionAppMenu.vue","../build/frontend/apps/theming/src/composables/useAdminThemingValue.ts","../build/frontend/apps/theming/src/components/admin/TextField.vue","../build/frontend/apps/theming/src/components/AdminSectionTheming.vue","../build/frontend/apps/theming/src/components/admin/ColorPickerField.vue","../build/frontend/apps/theming/src/components/admin/FileInputField.vue","../build/frontend/apps/theming/src/components/AdminSectionThemingAdvanced.vue","../build/frontend/apps/theming/src/views/AdminTheming.vue","../build/frontend/apps/theming/src/settings-admin.ts"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n-->\n\n<script setup lang=\"ts\">\nimport type { INavigationEntry } from '../../../../core/src/types/navigation.ts'\nimport type { AdminThemingParameters } from '../types.d.ts'\n\nimport axios from '@nextcloud/axios'\nimport { showError } from '@nextcloud/dialogs'\nimport { loadState } from '@nextcloud/initial-state'\nimport { t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { ref, useId, watch } from 'vue'\nimport NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'\nimport NcSelect from '@nextcloud/vue/components/NcSelect'\nimport NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'\nimport AppOrderSelector from './AppOrderSelector.vue'\nimport { logger } from '../utils/logger.ts'\n\nconst idGlobalDefaultApp = useId()\nconst { defaultApps } = loadState<AdminThemingParameters>('theming', 'adminThemingParameters')\n\n/**\n * All enabled apps which can be navigated\n */\nconst allApps = loadState<INavigationEntry[]>('core', 'apps')\n\t.map(({ id, name, icon }) => ({ label: name, id, icon }))\n\n/**\n * Currently selected app, wrapps the setter\n */\nconst selectedApps = ref(defaultApps.map((id) => allApps.find((app) => app.id === id)!).filter(Boolean))\nwatch(selectedApps, async (value) => {\n\ttry {\n\t\tawait saveSetting('defaultApps', value.map((app) => app.id))\n\t} catch (error) {\n\t\tlogger.error('Could not set global default apps', { error })\n\t\tshowError(t('theming', 'Could not set global default apps'))\n\t}\n})\n\nconst hasCustomDefaultApp = ref(defaultApps.length > 0)\nwatch(hasCustomDefaultApp, (checked) => {\n\tselectedApps.value = checked\n\t\t? allApps.filter((app) => ['dashboard', 'files'].includes(app.id))\n\t\t: []\n})\n\n/**\n * @param key - The setting key\n * @param value - The setting value\n */\nasync function saveSetting(key: string, value: unknown) {\n\tconst url = generateUrl('/apps/theming/ajax/updateAppMenu')\n\treturn await axios.put(url, {\n\t\tsetting: key,\n\t\tvalue,\n\t})\n}\n</script>\n\n<template>\n\t<NcSettingsSection :name=\"t('theming', 'Navigation bar settings')\">\n\t\t<h3>{{ t('theming', 'Default app') }}</h3>\n\t\t<p class=\"info-note\">\n\t\t\t{{ t('theming', 'The default app is the app that is e.g. opened after login or when the logo in the menu is clicked.') }}\n\t\t</p>\n\n\t\t<NcCheckboxRadioSwitch v-model=\"hasCustomDefaultApp\" type=\"switch\">\n\t\t\t{{ t('theming', 'Use custom default app') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<section v-if=\"hasCustomDefaultApp\" :aria-labelledby=\"idGlobalDefaultApp\">\n\t\t\t<h4 :id=\"idGlobalDefaultApp\">\n\t\t\t\t{{ t('theming', 'Global default app') }}\n\t\t\t</h4>\n\t\t\t<NcSelect\n\t\t\t\tv-model=\"selectedApps\"\n\t\t\t\tkeepOpen\n\t\t\t\tmultiple\n\t\t\t\t:placeholder=\"t('theming', 'Global default apps')\"\n\t\t\t\t:options=\"allApps\" />\n\n\t\t\t<h5>{{ t('theming', 'Default app priority') }}</h5>\n\t\t\t<p class=\"info-note\">\n\t\t\t\t{{ t('theming', 'If an app is not enabled for a user, the next app with lower priority is used.') }}\n\t\t\t</p>\n\t\t\t<AppOrderSelector v-model=\"selectedApps\" />\n\t\t</section>\n\t</NcSettingsSection>\n</template>\n\n<style scoped lang=\"scss\">\nh3, h4 {\n\tfont-weight: bold;\n}\n\nh4,