Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NcAvatar): rendering user status emoji in the menu #5409

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/NcAvatar/NcAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ export default {
:key="key"
:href="item.href"
:icon="item.icon">
<template v-if="item.iconSvg" #icon>
<NcIconSvgWrapper :svg="item.iconSvg" />
</template>
{{ item.text }}
</NcActionLink>
<template v-if="contactsMenuLoading" #icon>
Expand Down Expand Up @@ -184,6 +187,7 @@ export default {
import NcActions from '../NcActions/index.js'
import NcActionLink from '../NcActionLink/index.js'
import NcButton from '../NcButton/index.js'
import NcIconSvgWrapper from '../NcIconSvgWrapper/index.js'
import NcLoadingIcon from '../NcLoadingIcon/index.js'
import NcUserStatusIcon from '../NcUserStatusIcon/index.js'
import usernameToColor from '../../functions/usernameToColor/index.js'
Expand Down Expand Up @@ -234,6 +238,7 @@ export default {
NcActions,
NcActionLink,
NcButton,
NcIconSvgWrapper,
NcLoadingIcon,
NcUserStatusIcon,
},
Expand Down Expand Up @@ -511,9 +516,13 @@ export default {
}

if (this.showUserStatus && (this.userStatus.icon || this.userStatus.message)) {
// NcAction's URL icons are inverted in dark mode, so we need to pass SVG image in the icon slot
const emojiIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<text x="50%" y="50%" text-anchor="middle" style="dominant-baseline: central; font-size: 85%">${escape(this.userStatus.icon)}</text>
</svg>`
return [{
href: '#',
icon: `data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><text x='0' y='14' font-size='14'>${escape(this.userStatus.icon)}</text></svg>`,
iconSvg: this.userStatus.icon ? emojiIcon : undefined,
text: `${this.userStatus.message}`,
}].concat(actions)
}
Expand Down