diff options
author | Nina Pypchenko <22447785+nina-py@users.noreply.github.com> | 2021-01-05 21:40:35 +1100 |
---|---|---|
committer | Nina Pypchenko <22447785+nina-py@users.noreply.github.com> | 2021-01-05 21:40:35 +1100 |
commit | 98299d9c290c0d966d9b286096aae6e581699ae1 (patch) | |
tree | e81330a017130a9794763c26672e934bfcc6adba /apps/dashboard/src/App.vue | |
parent | 39c67d9868d15fa42031b8bafebc6bc05eac867e (diff) | |
download | nextcloud-server-98299d9c290c0d966d9b286096aae6e581699ae1.tar.gz nextcloud-server-98299d9c290c0d966d9b286096aae6e581699ae1.zip |
Fix dashboard greetings that show 'good morning' after noon
Updated dashboard greetings to show "Good afternoon" after 12:00 instead of 13:00.
Updated time periods for greetings:
- Morning: 5:00 to 11.59
- Afternoon: 12:00 to 17.59
- Evening: 18:00 to 21:59
- Night: 22:00 to 4.59
Updated night-time greeting to "Hello" as "Good night" is a kind of goodbye.
Closes #24938.
Signed-off-by: Nina Pypchenko <22447785+nina-py@users.noreply.github.com>
Diffstat (limited to 'apps/dashboard/src/App.vue')
-rw-r--r-- | apps/dashboard/src/App.vue | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/apps/dashboard/src/App.vue b/apps/dashboard/src/App.vue index c5eed836faa..30e9a2835ca 100644 --- a/apps/dashboard/src/App.vue +++ b/apps/dashboard/src/App.vue @@ -163,18 +163,43 @@ export default { }, greeting() { const time = this.timer.getHours() - const shouldShowName = this.displayName && this.uid !== this.displayName - if (time > 18) { - return { text: shouldShowName ? t('dashboard', 'Good evening, {name}', { name: this.displayName }) : t('dashboard', 'Good evening') } - } - if (time > 12) { - return { text: shouldShowName ? t('dashboard', 'Good afternoon, {name}', { name: this.displayName }) : t('dashboard', 'Good afternoon') } + // Determine part of the day + let partOfDay + if (time >= 22 && time < 5) { + partOfDay = 'night' + } else if (time >= 18) { + partOfDay = 'evening' + } else if (time >= 12) { + partOfDay = 'afternoon' + } else { + partOfDay = 'morning' } - if (time > 5) { - return { text: shouldShowName ? t('dashboard', 'Good morning, {name}', { name: this.displayName }) : t('dashboard', 'Good morning') } + + // Define the greetings + const good = { + morning: { + generic: t('dashboard', 'Good morning'), + withName: t('dashboard', 'Good morning, {name}', { name: this.displayName }), + }, + afternoon: { + generic: t('dashboard', 'Good afternoon'), + withName: t('dashboard', 'Good afternoon, {name}', { name: this.displayName }), + }, + evening: { + generic: t('dashboard', 'Good evening'), + withName: t('dashboard', 'Good evening, {name}', { name: this.displayName }), + }, + night: { + // Don't use "Good night" as it's not a greeting + generic: t('dashboard', 'Hello'), + withName: t('dashboard', 'Hello, {name}', { name: this.displayName }), + }, } - return { text: shouldShowName ? t('dashboard', 'Good night, {name}', { name: this.displayName }) : t('dashboard', 'Good night') } + + // Figure out which greeting to show + const shouldShowName = this.displayName && this.uid !== this.displayName + return { text: shouldShowName ? good[partOfDay].withName : good[partOfDay].generic } }, isActive() { return (panel) => this.layout.indexOf(panel.id) > -1 |