-
Notifications
You must be signed in to change notification settings - Fork 32
/
PeopleTable.vue
101 lines (96 loc) · 2.34 KB
/
PeopleTable.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<template>
<section>
<article class="media" v-for="row in displayPeople">
<figure class="media-left">
<p class="image">
<img style="max-width: 100px;" v-if="row.imgSrc" :src="row.imgSrc">
</p>
</figure>
<div class="media-content">
<div class="content">
<p>
<span class="name person" @click="open(row.url)">{{row.name}} </span>
<br>
<small v-if="row.job">{{row.job}} </small>
<br>
<span class="details">
They have been suggested to you
<b-tooltip
:multilined="true"
:label="`${row.sessions.map((t) => {
return new Date(t).toLocaleDateString()
})}`"
type="is-dark"
position="is-top">
<em class='data-hover'>
{{row.sessions.length}} {{row.sessions.length === 1 ? 'time' : 'times'}}
</em>
</b-tooltip>
and were first seen on <em> {{row.created | moment("MMM Do YYYY") }}
</em> and you have <em> {{row.mutualFriends}} mutual friends </em>.
</span>
</p>
</div>
</div>
</article>
</section>
</template>
<script>
import {mapGetters} from 'vuex'
const {shell} = require('electron')
export default {
name: 'PeopleTable',
data () {
const columns = ['mutualFriends', 'created', 'name']
const sortOrders = {}
columns.forEach(function (key) {
sortOrders[key] = -1
})
return {
sortKey: 'mutualFriends',
filterKey: '',
sortOrders: sortOrders,
reverse: false
}
},
mounted () {
},
methods: {
open (url) {
shell.openExternal(url)
},
sendTip () {
shell.openExternal('https://specialprojectsdesk.kinja.com/about-the-gizmodo-media-group-special-projects-desk-1792136692')
},
filterByIds (current) {
return this.allPeople.filter((p) => {
return current.indexOf(p.fbid) > -1
})
}
},
computed: {
displayPeople: function () {
if (this.filteredPeople.length > 0) {
return this.filteredPeople
} else {
return this.allPeople
}
},
...mapGetters([
'dbPath',
'filteredPeople',
'allPeople'
])
}
}
</script>
<style lang="scss">
$striped-rows: true;
.details {
font-size: 1rem;
}
.tips {
font-size: 0.7em;
float: right;
}
</style>