git ssb

3+

dangerousbeans / scuttle-vue



Tree: 5d3463a5a812931815b799819ca80c8f2119bda2

Files: 5d3463a5a812931815b799819ca80c8f2119bda2 / src / components / Message.vue

1532 bytesRaw
1
2<template>
3 <div class="media">
4 <img :src="profile_image">
5 </img>
6
7 <div class="media-body">
8 <h5 class="mt-0">{{ author }}</h5>
9
10 <span v-html="content_text()"></span>
11
12
13 <p>
14 {{ message.value.content.type() }}
15 </p>
16 </div>
17 </div>
18</template>
19
20<script>
21
22// var pull = require('pull-stream')
23import Rx from 'rxjs/RX'
24import { Observable } from 'rxjs/Observable'
25const nn = require('nevernull')
26const md = require('ssb-markdown')
27
28export default {
29 name: 'message',
30 props: ['message'],
31 data () {
32 return {
33 author: "...",
34 image_url: "http://via.placeholder.com/90x90",
35 api: this.$depject_api,
36
37 }
38 },
39 subscriptions: function () {
40 // var obj = {
41 // debugger
42
43 // profile_image: Rx.Observable.bindCallback( this.api.avatar_image[0].bind(this) )('@ywmhh72dezK+GrK+/QiYOJ0dKWVuGA/AkpOB/wrWTgk=.ed25519')
44 // }
45 // // debugger
46 //
47 // return obj
48 },
49 computed: {
50 profile_image: function(){
51 return vm.$depject_api.blob_url[0]("&aIbhv+YRJ85BAWzI1oCwa9716L5pdvMliMdh4KOT+SE=.sha256") }
52 },
53 methods: {
54 setAuthor(err, a){
55 if(a[0] == null)
56 return
57 this.author = nn( a[0] ).name()
58 },
59 // Get markdown formatted version of message content
60 content_text()
61 {
62 return md.block( this.message.value.content.text() )
63 }
64 },
65 updated() {
66 // author name
67 this.$depject_api.signifier[0](
68 this.message.value.author(), this.setAuthor
69 )
70
71
72 }
73}
74
75</script>
76
77<style scoped>
78</style>
79

Built with git-ssb-web