git ssb

3+

dangerousbeans / scuttle-vue



Tree: b65df85068d01bbc7fd6b0ba8686cccbae6928ee

Files: b65df85068d01bbc7fd6b0ba8686cccbae6928ee / src / components / Message.vue

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

Built with git-ssb-web