Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dashboard/js/dashboard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/dashboard/js/dashboard.js.map

Large diffs are not rendered by default.

43 changes: 34 additions & 9 deletions apps/dashboard/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a logical OR instead of AND.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, see #25110 .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up @graue70!

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
Expand Down