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