-
Notifications
You must be signed in to change notification settings - Fork 7
/
renderer.js
79 lines (74 loc) · 1.81 KB
/
renderer.js
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
const Vue = require('vue/dist/vue.common')
const store = require('./store')
const assign = require('object-assign')
const {mapState, mapActions} = require('vuex')
const types = require('./store/types')
const components = require('./renderer/index.js')
const {Emoji} = require('emoji-mart-vue')
const CustomEmoji = require('./renderer/CustomEmoji')
Vue.component('CustomEmoji', CustomEmoji)
Vue.mixin({
methods: {
emojiSheet(set, size) {
return `${__dirname}/img/${set}64.png`
}
}
})
new Vue({
el: '#app',
template: `
<div class="App" :class="{'-Uninitialized': !initialized}">
<template v-if="initialized && apiToken !== null">
<div class="App-Status">
<CurrentStatus/>
</div>
<div class="App-Contents">
<StatusList/>
</div>
<Watcher/>
</template>
<template v-else>
<div class="NoToken">
<Emoji emoji=":link:" :set="emojiSet" :backgroundImageFn="emojiSheet" :size="24"/>
<span>
<a @click.prevent="openPreference('account')" href="#">Please Sign in<br> your Slack account</a>
</span>
</div>
</template>
<div class="App-Footer">
<ToolBar/>
</div>
</div>
`,
store,
data() {
return {
}
},
async created() {
await this.initializeStore()
if (!this.apiToken) {
this.openPreference('account')
}
this.initializeStatus()
},
computed: assign({
// local computed
}, mapState({
initialized: 'initialized',
apiToken: 'apiToken',
emojiSet: 'emojiSet'
})),
methods: assign({
// local methods
}, mapActions({
initializeStore: types.INITIALIZE_STORE,
initializeStatus: types.INITIALIZE_STATUS,
openPreference: types.OPEN_PREFERENCE,
})),
components: assign({
// local components
Emoji,
CustomEmoji
}, components)
})