forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessageThread.vue
More file actions
103 lines (100 loc) · 2.97 KB
/
MessageThread.vue
File metadata and controls
103 lines (100 loc) · 2.97 KB
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
102
103
<template>
<div>
<v-progress-linear
v-if="$store.getters.getLoadingThreads"
color="primary"
indeterminate
></v-progress-linear>
<div
v-if="!$store.getters.getLoadingThreads && $store.getters.getIsArchived"
class="warning py-1 text-center text-uppercase text-subtitle-1"
>
Archived Messages
</div>
<v-sheet
v-if="
!$store.getters.getLoadingThreads &&
threads.length === 0 &&
!$store.getters.getIsArchived
"
class="text-center mt-8 mx-3"
:color="$vuetify.breakpoint.mdAndDown ? '#121212' : '#363636'"
>
<div v-if="$vuetify.breakpoint.mdAndDown">
<v-img
class="mx-auto mb-4"
max-width="80%"
contain
:src="require('assets/img/person-texting.svg')"
></v-img>
<p v-if="$store.getters.getOwner" class="text--secondary">
Start sending messages
</p>
</div>
<v-btn
v-if="$store.getters.getOwner"
class="primary"
:to="{ name: 'messages' }"
>
<v-icon>mdi-plus</v-icon>
New Message
</v-btn>
</v-sheet>
<div v-if="$store.getters.getPhones.length === 0" class="px-4 text-center">
<p>
Install the mobile app on your android phone to start sending messages
</p>
<v-btn class="primary" :href="$store.getters.getAppData.appDownloadUrl">
<v-icon>mdi-download</v-icon>
Install App
</v-btn>
</div>
<v-list two-line class="px-0 py-0" subheader>
<v-list-item-group>
<template v-for="thread in threads">
<v-list-item
:key="thread.id"
:to="'/threads/' + thread.id"
class="py-1"
:class="{
'px-6': $vuetify.breakpoint.mdAndDown,
'px-3': $vuetify.breakpoint.lgAndUp,
}"
>
<v-list-item-avatar :color="thread.color">
<v-icon dark> mdi-account </v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>
{{ thread.contact | phoneNumber }}
</v-list-item-title>
<v-list-item-subtitle>
{{ thread.last_message_content }}
</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-list-item-action-text>
{{ threadDate(thread.order_timestamp) }}
</v-list-item-action-text>
</v-list-item-action>
</v-list-item>
</template>
</v-list-item-group>
</v-list>
</div>
</template>
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
@Component
export default class MessageThread extends Vue {
get threads(): Array<MessageThread> {
return this.$store.getters.getThreads
}
threadDate(date: string): string {
return new Date(date).toLocaleString(undefined, {
month: 'short',
day: 'numeric',
})
}
}
</script>