forked from cory/tildefriends
Cory McWilliams
fc9c3982c2
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3957 ed5197a5-7fde-0310-b194-c3ffbd925b24
26 lines
714 B
JavaScript
26 lines
714 B
JavaScript
import * as tf from './tf.js';
|
|
|
|
Vue.component('tf-user', {
|
|
props: ['id'],
|
|
computed: {
|
|
following: {
|
|
get: function() {
|
|
return tf.g_data.users?.[tf.g_data.whoami]?.following?.[this.id];
|
|
},
|
|
},
|
|
whoami: { get: function() { return tf.g_data.whoami; } },
|
|
users: { get: function() { return tf.g_data.users; } },
|
|
},
|
|
methods: {
|
|
show_user: function() {
|
|
window.parent.postMessage({
|
|
action: 'setHash',
|
|
hash: this.id,
|
|
}, '*');
|
|
},
|
|
},
|
|
template: `<md-chip :class="following ? 'md-accent' : ''">
|
|
<a :href="'#' + id" style="color: #fff">{{users[id] && users[id].name ? users[id].name : id}}</a>
|
|
<md-tooltip v-if="users[id] && users[id].name">{{id}}</md-tooltip>
|
|
</md-chip>`,
|
|
}); |