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