Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

fix: fixed eslint warnings

Acho Arnold Ewin89d6ee497bd7
diff --git a/web/app/components/BackButton.vue b/web/app/components/BackButton.vue
index c9adfe81..9dc1b888 100644
--- a/web/app/components/BackButton.vue
+++ b/web/app/components/BackButton.vue
@@ -9,6 +9,7 @@ const props = withDefaults(
block?: boolean
}>(),
{
+ route: undefined,
block: false,
},
)
diff --git a/web/app/components/BillingDateOrdinal.vue b/web/app/components/BillingDateOrdinal.vue
new file mode 100644
index 00000000..05efadec
--- /dev/null
+++ b/web/app/components/BillingDateOrdinal.vue
@@ -0,0 +1,15 @@
+<script setup lang="ts">
+import { computed } from 'vue'
+import { formatBillingPeriodDateOrdinalParts } from '~/utils/filters'
+
+const props = defineProps<{ value: string }>()
+
+const parts = computed(() => formatBillingPeriodDateOrdinalParts(props.value))
+</script>
+
+<template>
+ <span
+ >{{ parts.leading }}<sup>{{ parts.suffix }}</sup
+ >{{ parts.trailing }}</span
+ >
+</template>
diff --git a/web/app/components/MessageThread.vue b/web/app/components/MessageThread.vue
index 5f6caa1e..f0efdbae 100644
--- a/web/app/components/MessageThread.vue
+++ b/web/app/components/MessageThread.vue
@@ -97,8 +97,8 @@ function onInstallApp() {
</v-btn>
</div>
<v-list
- class="py-0"
v-if="!threadsStore.loadingThreads && threadsStore.threads.length > 0"
+ class="py-0"
lines="two"
>
<v-list-item
diff --git a/web/app/pages/billing/index.vue b/web/app/pages/billing/index.vue
index 8d5d68e8..9235a0a5 100644
--- a/web/app/pages/billing/index.vue
+++ b/web/app/pages/billing/index.vue
@@ -12,7 +12,7 @@ import type {
RequestsUserPaymentInvoice,
ResponsesUserSubscriptionPaymentsResponse,
} from '~~/shared/types/api'
-import { formatBillingPeriodDateOrdinal } from '~/utils/filters'
+
import { countries, getStateOptions } from '~/utils/countries'
type SubscriptionPayment =
@@ -445,22 +445,14 @@ onMounted(async () => {
This is the summary of the sent messages and received messages
from
<v-code v-if="billingStore.billingUsage" class="font-weight-bold">
- <span
- v-html="
- formatBillingPeriodDateOrdinal(
- billingStore.billingUsage.start_timestamp,
- )
- "
+ <BillingDateOrdinal
+ :value="billingStore.billingUsage.start_timestamp"
/>
</v-code>
to
<v-code v-if="billingStore.billingUsage" class="font-weight-bold">
- <span
- v-html="
- formatBillingPeriodDateOrdinal(
- billingStore.billingUsage.end_timestamp,
- )
- "
+ <BillingDateOrdinal
+ :value="billingStore.billingUsage.end_timestamp"
/> </v-code
>.
</p>
@@ -598,18 +590,12 @@ onMounted(async () => {
v-for="billingUsage in billingStore.billingUsageHistory"
:key="billingUsage.id"
>
- <td
- v-html="
- formatBillingPeriodDateOrdinal(
- billingUsage.start_timestamp,
- )
- "
- />
- <td
- v-html="
- formatBillingPeriodDateOrdinal(billingUsage.end_timestamp)
- "
- />
+ <td>
+ <BillingDateOrdinal :value="billingUsage.start_timestamp" />
+ </td>
+ <td>
+ <BillingDateOrdinal :value="billingUsage.end_timestamp" />
+ </td>
<td>{{ formatDecimal(billingUsage.sent_messages) }}</td>
<td>{{ billingUsage.received_messages }}</td>
</tr>
diff --git a/web/app/pages/threads/[id]/index.vue b/web/app/pages/threads/[id]/index.vue
index e40bd90b..ad814717 100644
--- a/web/app/pages/threads/[id]/index.vue
+++ b/web/app/pages/threads/[id]/index.vue
@@ -306,7 +306,7 @@ onBeforeUnmount(() => {
color="primary"
indeterminate
/>
- <VContainer class="pa-0" v-if="threadsStore.currentThread">
+ <VContainer v-if="threadsStore.currentThread" class="pa-0">
<div
ref="messageBody"
class="messages-body no-scrollbar w-100 pl-2"
@@ -328,11 +328,11 @@ onBeforeUnmount(() => {
>
<VSpacer v-if="isMT(message)" />
<v-avatar
+ v-if="isMo(message)"
:class="{
'ml-2': !mdAndUp,
'ml-4': mdAndUp,
}"
- v-if="isMo(message)"
:color="threadsStore.currentThread!.color"
size="40"
>
diff --git a/web/app/utils/filters.ts b/web/app/utils/filters.ts
index f1e43c70..2d1cf5a5 100644
--- a/web/app/utils/filters.ts
+++ b/web/app/utils/filters.ts
@@ -66,6 +66,32 @@ export function formatBillingPeriodDateOrdinal(value: string): string {
return `${month} ${day}<sup>${suffix}</sup> ${year}`
}
+export interface BillingPeriodDateOrdinalParts {
+ leading: string
+ suffix: string
+ trailing: string
+}
+
+export function formatBillingPeriodDateOrdinalParts(
+ value: string,
+): BillingPeriodDateOrdinalParts {
+ const date = new Date(value)
+ const day = date.getDate()
+ const month = date.toLocaleDateString('en-US', { month: 'long' })
+ const year = date.getFullYear()
+
+ const suffix =
+ day % 10 === 1 && day !== 11
+ ? 'st'
+ : day % 10 === 2 && day !== 12
+ ? 'nd'
+ : day % 10 === 3 && day !== 13
+ ? 'rd'
+ : 'th'
+
+ return { leading: `${month} ${day}`, suffix, trailing: ` ${year}` }
+}
+
export function humanizeTime(value: string): string {
const durations = intervalToDuration({
start: new Date(value),