2018-07-08 12:50:11 +02:00
|
|
|
<template>
|
|
|
|
<span
|
2019-11-05 11:36:44 +01:00
|
|
|
:class="['user', nickColor, {active: active}]"
|
2018-07-08 12:50:11 +02:00
|
|
|
:data-name="user.nick"
|
2018-07-11 09:33:11 +02:00
|
|
|
role="button"
|
2019-07-17 11:33:59 +02:00
|
|
|
v-on="onHover ? {mouseover: hover} : {}"
|
2019-11-23 15:26:20 +01:00
|
|
|
@click.prevent="openContextMenu"
|
|
|
|
@contextmenu.prevent="openContextMenu"
|
2019-11-23 18:16:29 +01:00
|
|
|
><slot>{{ user.mode }}{{ user.nick }}</slot></span
|
2019-07-17 11:33:59 +02:00
|
|
|
>
|
2018-07-08 12:50:11 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-11-16 18:24:03 +01:00
|
|
|
import colorClass from "../js/helpers/colorClass";
|
2019-11-05 11:36:44 +01:00
|
|
|
|
2018-07-08 12:50:11 +02:00
|
|
|
export default {
|
|
|
|
name: "Username",
|
|
|
|
props: {
|
|
|
|
user: Object,
|
2018-07-10 22:29:53 +02:00
|
|
|
active: Boolean,
|
2018-07-11 01:25:21 +02:00
|
|
|
onHover: Function,
|
|
|
|
},
|
2019-11-05 11:36:44 +01:00
|
|
|
computed: {
|
|
|
|
nickColor() {
|
|
|
|
return colorClass(this.user.nick);
|
|
|
|
},
|
|
|
|
},
|
2018-07-11 01:25:21 +02:00
|
|
|
methods: {
|
|
|
|
hover() {
|
2018-07-11 09:33:11 +02:00
|
|
|
return this.onHover(this.user);
|
2018-07-11 01:25:21 +02:00
|
|
|
},
|
2019-11-23 15:26:20 +01:00
|
|
|
openContextMenu(event) {
|
|
|
|
this.$root.$emit("contextmenu:user", {
|
|
|
|
event: event,
|
|
|
|
user: this.user,
|
|
|
|
});
|
2019-11-09 23:21:34 +01:00
|
|
|
},
|
2018-07-08 12:50:11 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|