Exposing setting the index page in the admin app and added a crude emoji picker, finally.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3966 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-08-17 00:29:57 +00:00
parent 3729346961
commit 46d3e8f567
8 changed files with 15247 additions and 25 deletions

View File

@@ -1,5 +1,7 @@
import * as tfrpc from '/static/tfrpc.js';
import * as tfshared from './tf-shared.js';
import * as tf from './tf.js';
import * as emojis from './emojis.js';
Vue.component('tf-message', {
props: ['message', 'messages', 'votes'],
@@ -46,24 +48,26 @@ Vue.component('tf-message', {
tf.g_data.reply_root = this.content_json.root || this.message.id;
tf.g_data.reply_branch = this.message.id;
},
vote: function(event) {
var reaction = event.srcElement.innerText;
vote: function(emoji) {
let reaction = emoji.emoji;
var message = this.message.id;
if (confirm('Are you sure you want to react with ' + reaction + ' to ' + message + '?')) {
window.parent.postMessage(
{
appendMessage: {
type: 'vote',
vote: {
link: message,
value: 1,
expression: reaction,
},
},
tfrpc.rpc.appendMessage({
type: 'vote',
vote: {
link: message,
value: 1,
expression: reaction,
},
'*');
}).catch(function(error) {
alert(error?.message);
});
}
},
show_emoji_picker: function(event) {
let self = this;
emojis.picker(x => self.vote(x), event.srcElement);
},
show_message: function() {
window.parent.postMessage({
action: 'setHash',
@@ -167,10 +171,7 @@ Vue.component('tf-message', {
<md-icon>reply</md-icon>
</md-button>
<md-menu>
<md-menu-content>
<md-menu-item @click="vote">Like</md-menu-item>
</md-menu-content>
<md-button class="md-icon-button" md-menu-trigger>
<md-button class="md-icon-button" @click="show_emoji_picker">
<md-icon>thumb_up</md-icon>
</md-button>
</md-menu>