From bd3d791ee032acd61ad7e62bb10a88a6335dcc39 Mon Sep 17 00:00:00 2001 From: Julius Hรคrtl Date: Fri, 31 Jul 2020 13:18:47 +0200 Subject: Only show display name if set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Hรคrtl --- apps/dashboard/src/App.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'apps/dashboard') diff --git a/apps/dashboard/src/App.vue b/apps/dashboard/src/App.vue index 6680daea454..a87ce343706 100644 --- a/apps/dashboard/src/App.vue +++ b/apps/dashboard/src/App.vue @@ -74,7 +74,8 @@ export default { timer: new Date(), callbacks: {}, panels, - name: getCurrentUser()?.displayName, + displayName: getCurrentUser()?.displayName, + uid: getCurrentUser()?.uid, layout: loadState('dashboard', 'layout').filter((panelId) => panels[panelId]), modal: false, appStoreUrl: generateUrl('/settings/apps'), @@ -83,20 +84,21 @@ export default { computed: { greeting() { const time = this.timer.getHours() + const shouldShowName = this.displayName && this.uid !== this.displayName if (time > 18) { - return { icon: '๐ŸŒ™', text: t('dashboard', 'Good evening, {name}', { name: this.name }) } + return { icon: '๐ŸŒ™', text: shouldShowName ? t('dashboard', 'Good evening, {name}', { name: this.name }) : t('dashboard', 'Good evening') } } if (time > 12) { - return { icon: 'โ˜€', text: t('dashboard', 'Good afternoon, {name}', { name: this.name }) } + return { icon: 'โ˜€', text: shouldShowName ? t('dashboard', 'Good afternoon, {name}', { name: this.name }) : t('dashboard', 'Good afternoon') } } if (time === 12) { - return { icon: '๐Ÿฝ', text: t('dashboard', 'Time for lunch, {name}', { name: this.name }) } + return { icon: '๐Ÿฝ', text: shouldShowName ? t('dashboard', 'Time for lunch, {name}', { name: this.name }) : t('dashboard', 'Time for lunch') } } if (time > 5) { - return { icon: '๐ŸŒ„', text: t('dashboard', 'Good morning, {name}', { name: this.name }) } + return { icon: '๐ŸŒ„', text: shouldShowName ? t('dashboard', 'Good morning, {name}', { name: this.name }) : t('dashboard', 'Good morning') } } - return { icon: '๐Ÿฆ‰', text: t('dashboard', 'Have a night owl, {name}', { name: this.name }) } + return { icon: '๐Ÿฆ‰', text: shouldShowName ? t('dashboard', 'Have a night owl, {name}', { name: this.name }) : t('dashboard', 'Have a night owl') } }, isActive() { return (panel) => this.layout.indexOf(panel.id) > -1 -- cgit v1.2.3