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
175 lines (171 loc) · 4.69 KB
/
MessageThread.vue
File metadata and controls
175 lines (171 loc) · 4.69 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<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 && $store.getters.getPhones.length !== 0"
class="primary"
:to="{ name: 'messages' }"
>
<v-icon>
{{ mdiPlus }}
</v-icon>
New Message
</v-btn>
</v-sheet>
<div
v-if="
$store.getters.getPhones.length === 0 &&
$store.getters.getLoadingThreads === false
"
class="px-4 text-center"
>
<p>
Install the mobile app on your android phone to start sending messages.
You can also
<a
href="https://discord.gg/kGk8HVqeEZ"
target="_blank"
class="text-decoration-none"
>message us on Discord</a
>
to help set things up.
</p>
<v-btn
class="primary"
:href="$store.getters.getAppData.appDownloadUrl"
@click="
$store.dispatch('addNotification', {
type: 'info',
message: 'Downloading the httpSMS Android App',
})
"
>
<v-icon>
{{ mdiDownload }}
</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>{{ mdiAccount }}</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-icon
v-if="thread.status === 'expired'"
color="warning"
small
>{{ mdiAlert }}</v-icon
>
<v-icon
v-else-if="thread.status === 'delivered'"
color="primary"
small
>
{{ mdiCheckAll }}
</v-icon>
<v-icon
v-else-if="thread.status === 'received'"
color="success"
small
>
{{ mdiCheckAll }}
</v-icon>
<v-icon v-else-if="thread.status === 'sent'">
{{ mdiCheck }}
</v-icon>
<v-icon
v-else-if="thread.status === 'failed'"
color="error"
small
>
{{ mdiAlert }}
</v-icon>
</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'
import {
mdiPlus,
mdiDownload,
mdiCheckAll,
mdiCheck,
mdiAlert,
mdiAccount,
} from '@mdi/js'
@Component
export default class MessageThread extends Vue {
mdiPlus = mdiPlus
mdiDownload = mdiDownload
mdiAccount = mdiAccount
mdiAlert = mdiAlert
mdiCheck = mdiCheck
mdiCheckAll = mdiCheckAll
get threads(): Array<MessageThread> {
return this.$store.getters.getThreads
}
threadDate(date: string): string {
return new Date(date).toLocaleString(undefined, {
month: 'short',
day: 'numeric',
})
}
}
</script>