2022-06-19 18:08:15 -04:00
|
|
|
import * as tf from './tf.js';
|
|
|
|
|
2022-02-26 21:30:11 -05:00
|
|
|
Vue.component('tf-user', {
|
|
|
|
props: ['id'],
|
|
|
|
computed: {
|
|
|
|
following: {
|
|
|
|
get: function() {
|
2022-06-19 18:08:15 -04:00
|
|
|
return tf.g_data.users?.[tf.g_data.whoami]?.following?.[this.id];
|
2022-02-26 21:30:11 -05:00
|
|
|
},
|
|
|
|
},
|
2022-06-19 18:08:15 -04:00
|
|
|
whoami: { get: function() { return tf.g_data.whoami; } },
|
|
|
|
users: { get: function() { return tf.g_data.users; } },
|
2022-02-26 21:30:11 -05:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
show_user: function() {
|
2022-08-03 19:39:23 -04:00
|
|
|
window.parent.postMessage({
|
|
|
|
action: 'setHash',
|
2022-08-13 15:39:29 -04:00
|
|
|
hash: this.id,
|
2022-08-03 19:39:23 -04:00
|
|
|
}, '*');
|
2022-02-26 21:30:11 -05:00
|
|
|
},
|
|
|
|
},
|
2022-04-14 19:47:41 -04:00
|
|
|
template: `<md-chip :class="following ? 'md-accent' : ''">
|
2022-08-13 15:39:29 -04:00
|
|
|
<a :href="'#' + id" style="color: #fff">{{users[id] && users[id].name ? users[id].name : id}}</a>
|
2022-02-26 21:30:11 -05:00
|
|
|
<md-tooltip v-if="users[id] && users[id].name">{{id}}</md-tooltip>
|
|
|
|
</md-chip>`,
|
|
|
|
});
|