2021-12-29 11:01:34 -05:00
|
|
|
"use strict";
|
2021-01-13 21:56:14 -05:00
|
|
|
Vue.component('tf-user', {
|
|
|
|
props: ['id'],
|
|
|
|
computed: {
|
|
|
|
following: {
|
|
|
|
get: function() {
|
2021-12-29 16:00:03 -05:00
|
|
|
return g_data.users &&
|
|
|
|
g_data.users[g_data.whoami] &&
|
2022-01-06 20:52:47 -05:00
|
|
|
g_data.users[g_data.whoami].following &&
|
2021-12-29 16:00:03 -05:00
|
|
|
g_data.users[g_data.whoami].following[this.id];
|
2021-01-13 21:56:14 -05:00
|
|
|
},
|
|
|
|
},
|
2021-12-28 15:21:23 -05:00
|
|
|
whoami: { get: function() { return g_data.whoami; } },
|
2021-12-28 16:54:43 -05:00
|
|
|
users: { get: function() { return g_data.users; } },
|
2021-12-28 15:21:23 -05:00
|
|
|
},
|
|
|
|
methods: {
|
2021-12-28 16:54:43 -05:00
|
|
|
show_user: function() {
|
2022-01-06 20:52:47 -05:00
|
|
|
window.parent.postMessage({action: 'setHash', hash: this.id}, '*');
|
2021-12-28 16:54:43 -05:00
|
|
|
},
|
2021-01-13 21:56:14 -05:00
|
|
|
},
|
2022-01-08 15:54:02 -05:00
|
|
|
template: `<md-chip md-clickable :class="following ? 'md-accent' : ''" @click="show_user()">
|
2021-12-29 16:00:03 -05:00
|
|
|
{{users[id] && users[id].name ? users[id].name : id}}
|
2022-01-08 15:54:02 -05:00
|
|
|
<md-tooltip v-if="users[id] && users[id].name">{{id}}</md-tooltip>
|
|
|
|
</md-chip>`,
|
2021-01-13 21:56:14 -05:00
|
|
|
});
|