fix(core): do not assign all navigation entry properties as html attributes

Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
This commit is contained in:
Grigorii K. Shartsev 2023-10-18 11:40:41 +02:00
parent f4e3f09654
commit 776f5da831
2 changed files with 22 additions and 4 deletions

View file

@ -30,11 +30,11 @@
<NcLoadingIcon v-if="loading"
class="menu-entry__loading-icon"
:size="18" />
<img v-else :src="cachedIcon" alt="" />
<img v-else :src="cachedIcon" alt="">
{{ name }}
</a>
<button v-else>
<img :src="cachedIcon" alt="" />
<img :src="cachedIcon" alt="">
{{ name }}
</button>
</li>

View file

@ -36,8 +36,12 @@
</template>
<ul>
<UserMenuEntry v-for="entry in settingsNavEntries"
v-bind="entry"
:key="entry.id" />
:id="entry.id"
:key="entry.id"
:name="entry.name"
:href="entry.href"
:active="entry.active"
:icon="entry.icon" />
</ul>
</NcHeaderMenu>
</template>
@ -58,6 +62,20 @@ import UserMenuEntry from '../components/UserMenu/UserMenuEntry.vue'
import logger from '../logger.js'
/**
* @typedef SettingNavEntry
* @property {string} id - id of the entry, used as HTML ID, for example, "settings"
* @property {string} name - Label of the entry, for example, "Personal Settings"
* @property {string} icon - Icon of the entry, for example, "/apps/settings/img/personal.svg"
* @property {'settings'|'link'|'guest'} type - Type of the entry
* @property {string} href - Link of the entry, for example, "/settings/user"
* @property {boolean} active - Whether the entry is active
* @property {number} order - Order of the entry
* @property {number} unread - Number of unread pf this items
* @property {string} classes - Classes for custom styling
*/
/** @type {SettingNavEntry[]} */
const settingsNavEntries = loadState('core', 'settingsNavEntries', [])
const translateStatus = (status) => {