Show the full status and icon all the time
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
0afccb5d9a
commit
97f9b18e9e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -24,6 +24,20 @@
|
||||||
id="user-status_panel"
|
id="user-status_panel"
|
||||||
:items="items"
|
:items="items"
|
||||||
:loading="loading">
|
:loading="loading">
|
||||||
|
<template v-slot:default="{ item }">
|
||||||
|
<DashboardWidgetItem
|
||||||
|
:main-text="item.mainText"
|
||||||
|
:sub-text="item.subText">
|
||||||
|
<template v-slot:avatar>
|
||||||
|
<Avatar
|
||||||
|
class="item-avatar"
|
||||||
|
:size="44"
|
||||||
|
:user="item.avatarUsername"
|
||||||
|
:display-name="item.mainText"
|
||||||
|
:show-user-status-compact="false" />
|
||||||
|
</template>
|
||||||
|
</DashboardWidgetItem>
|
||||||
|
</template>
|
||||||
<template v-slot:empty-content>
|
<template v-slot:empty-content>
|
||||||
<EmptyContent
|
<EmptyContent
|
||||||
id="user_status-widget-empty-content"
|
id="user_status-widget-empty-content"
|
||||||
|
@ -35,7 +49,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { DashboardWidget } from '@nextcloud/vue-dashboard'
|
import { DashboardWidget, DashboardWidgetItem } from '@nextcloud/vue-dashboard'
|
||||||
|
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
|
||||||
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
|
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
|
||||||
import { loadState } from '@nextcloud/initial-state'
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
import moment from '@nextcloud/moment'
|
import moment from '@nextcloud/moment'
|
||||||
|
@ -43,7 +58,9 @@ import moment from '@nextcloud/moment'
|
||||||
export default {
|
export default {
|
||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
components: {
|
components: {
|
||||||
|
Avatar,
|
||||||
DashboardWidget,
|
DashboardWidget,
|
||||||
|
DashboardWidgetItem,
|
||||||
EmptyContent,
|
EmptyContent,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -56,13 +73,21 @@ export default {
|
||||||
items() {
|
items() {
|
||||||
return this.statuses.map((item) => {
|
return this.statuses.map((item) => {
|
||||||
const icon = item.icon || ''
|
const icon = item.icon || ''
|
||||||
const message = item.message || ''
|
let message = item.message || ''
|
||||||
const status = item.status === 'dnd' ? `${icon} ${message}` : message
|
if (message === '') {
|
||||||
|
if (item.status === 'away') {
|
||||||
|
message = t('user_status', 'Away')
|
||||||
|
}
|
||||||
|
if (item.status === 'dnd') {
|
||||||
|
message = t('user_status', 'Do not disturb')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const status = item.icon !== '' ? `${icon} ${message}` : message
|
||||||
|
|
||||||
let subText
|
let subText
|
||||||
if (item.icon === null && item.message === null && item.timestamp === null) {
|
if (item.icon === null && message === '' && item.timestamp === null) {
|
||||||
subText = ''
|
subText = ''
|
||||||
} else if (item.icon === null && item.message === null && item.timestamp !== null) {
|
} else if (item.icon === null && message === '' && item.timestamp !== null) {
|
||||||
subText = moment(item.timestamp, 'X').fromNow()
|
subText = moment(item.timestamp, 'X').fromNow()
|
||||||
} else if (item.timestamp !== null) {
|
} else if (item.timestamp !== null) {
|
||||||
subText = this.t('user_status', '{status}, {timestamp}', {
|
subText = this.t('user_status', '{status}, {timestamp}', {
|
||||||
|
|
Loading…
Reference in New Issue