Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(user_status): Migrate to NcUserStatusIcon
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Jan 24, 2024
commit f06047518960c76c99b404b7c91836b27d1286b9
11 changes: 8 additions & 3 deletions apps/user_status/src/UserStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@
<button v-if="!inline"
class="user-status-menu-item"
@click.stop="openModal">
<span aria-hidden="true" :class="statusIcon" class="user-status-icon" />
<NcUserStatusIcon class="user-status-icon"
:status="statusType"
aria-hidden="true" />
{{ visibleMessage }}
</button>

<!-- Dashboard Status -->
<NcButton v-else
:icon="statusIcon"
@click.stop="openModal">
<template #icon>
<span aria-hidden="true" :class="statusIcon" class="user-status-icon" />
<NcUserStatusIcon class="user-status-icon"
:status="statusType"
aria-hidden="true" />
</template>
{{ visibleMessage }}
</NcButton>
Expand All @@ -47,6 +50,7 @@
<script>
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcUserStatusIcon from '@nextcloud/vue/dist/Components/NcUserStatusIcon.js'
import debounce from 'debounce'

import { sendHeartbeat } from './services/heartbeatService.js'
Expand All @@ -57,6 +61,7 @@ export default {

components: {
NcButton,
NcUserStatusIcon,
SetStatusModal: () => import(/* webpackChunkName: 'user-status-modal' */'./components/SetStatusModal.vue'),
},
mixins: [OnlineStatusMixin],
Expand Down
18 changes: 10 additions & 8 deletions apps/user_status/src/components/OnlineStatusSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,28 @@
@change="onChange">
<label :for="id" class="user-status-online-select__label">
{{ label }}
<span :class="icon" aria-hidden="true" role="img" />
<NcUserStatusIcon :status="type"
aria-hidden="true" />
<em class="user-status-online-select__subline">{{ subline }}</em>
</label>
</div>
</template>

<script>
import NcUserStatusIcon from '@nextcloud/vue/dist/Components/NcUserStatusIcon.js'

export default {
name: 'OnlineStatusSelect',

components: {
NcUserStatusIcon,
},

props: {
checked: {
type: Boolean,
default: false,
},
icon: {
type: String,
required: true,
},
type: {
type: String,
required: true,
Expand Down Expand Up @@ -101,8 +104,8 @@ $label-padding: 8px;

span {
position: absolute;
top: calc(50% - math.div($icon-size, 2));
left: $label-padding;
top: calc(50% - 10px);
left: 10px;
display: block;
width: $icon-size;
height: $icon-size;
Expand All @@ -123,5 +126,4 @@ $label-padding: 8px;
color: var(--color-text-lighter);
}
}

</style>
25 changes: 0 additions & 25 deletions apps/user_status/src/mixins/OnlineStatusMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,6 @@ export default {

return this.$t('user_status', 'Set status')
},

/**
* The status indicator icon
*
* @return {string | null}
*/
statusIcon() {
switch (this.statusType) {
case 'online':
return 'icon-user-status-online'

case 'away':
case 'busy':
return 'icon-user-status-away'

case 'dnd':
return 'icon-user-status-dnd'

case 'invisible':
case 'offline':
return 'icon-user-status-invisible'
}

return ''
},
},

methods: {
Expand Down
5 changes: 0 additions & 5 deletions apps/user_status/src/services/statusOptionsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,17 @@ const getAllStatusOptions = () => {
return [{
type: 'online',
label: t('user_status', 'Online'),
icon: 'icon-user-status-online',
}, {
type: 'away',
label: t('user_status', 'Away'),
icon: 'icon-user-status-away',
}, {
type: 'dnd',
label: t('user_status', 'Do not disturb'),
subline: t('user_status', 'Mute all notifications'),
icon: 'icon-user-status-dnd',

}, {
type: 'invisible',
label: t('user_status', 'Invisible'),
subline: t('user_status', 'Appear offline'),
icon: 'icon-user-status-invisible',
}]
}

Expand Down
6 changes: 2 additions & 4 deletions core/src/views/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ export default {
background-color: var(--color-primary-element);
color: var(--color-primary-element-text);

img,
svg {
img {
filter: var(--primary-invert-if-dark);
}
}
Expand All @@ -261,8 +260,7 @@ export default {
margin-right: 10px;
}

img,
svg {
img {
filter: var(--background-invert-if-dark);
}
}
Expand Down