From 22046315d776d9a6efe144a80b2f41b79956a1f8 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Mon, 31 Oct 2022 04:58:34 +0000 Subject: [PATCH] added pricing info display --- index.html | 10 ++++++++-- main.css | 42 +++++++++++++++++++++++++++++++++++++++++- main.js | 31 +++++++++++++++++++++++++++++-- 3 files changed, 78 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index a292aeb..51a8974 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,13 @@
Monero Address: {{ moneroAddress }}
-
Credit Balance: {{ credits }}
+
Credit Balance: {{ credits }}
+
+Pricing information +
+{{ pricingInfo }}
+
+
Phone Number: {{ formatPhone(ownedNumber) }}
@@ -61,7 +67,7 @@
- +

diff --git a/main.css b/main.css index bfaba7c..8174d19 100644 --- a/main.css +++ b/main.css @@ -8,6 +8,7 @@ body{ /*color: #e36414;*/ color: #FFFFFF; background-color: #020000; + font-family: Verdana, Geneva, Tahoma, sans-serif; } @@ -26,7 +27,6 @@ body{ padding: 10px; width: 25%; font-size: 1.5em; - font-family: Verdana, Geneva, Tahoma, sans-serif; word-break: break-all; } @@ -82,6 +82,46 @@ h1, h2, h3, h4, h5, h6{ } } +@media (max-width: 510px) { + .draft{ + margin-right: 1%; + } + .from-us{ + margin-left: 42%; + } + .from-us, .from-them{ + width: 50%; + } + button, input[type="submit"] { + font-size: 1em; + } +} + .showUserID{ margin-left: 75%; +} + +.danger{ + background-color: #e36414 +} + +button, input[type="submit"] { + + border-radius: 8px; + color: white; + font-weight: 0; + padding: 5px; + background-color: #0F4C5C; + box-shadow: 1px 1px 20px 0 #000000; + + border: solid #000000 1px; + display: inline-block; + cursor: pointer; + text-align: center; +} + +button, input[type="submit"]:hover { + border: solid #337FED 1px; + background: #1E62D0; + border-radius: 5px; } \ No newline at end of file diff --git a/main.js b/main.js index 81749b5..6384041 100644 --- a/main.js +++ b/main.js @@ -3,7 +3,8 @@ const { createApp } = Vue let app = createApp({ computed: { - crypto: () => window.crypto + crypto: () => window.crypto, + onLine: () => window.navigator.onLine }, data() { return { @@ -26,7 +27,8 @@ let app = createApp({ threadOffset: 0, threadMessages: [], lastThreadLineHeader: 0, - threadLineHeader: 0 + threadLineHeader: 0, + pricingInfo: "" } }, methods: { @@ -89,6 +91,10 @@ let app = createApp({ }) }, sendSMS(){ + if (! this.onLine){ + this.sendMsgErr = "You are offline, cannot send message" + return + } this.sendMsgErr = "" this.disableSMSSend = true fetch(this.backend + this.userID + '/send/' + this.sendToNumber, { @@ -150,6 +156,11 @@ let app = createApp({ if (doInterval){setInterval(updateThreads, 10000)} }, deleteThread(num){ + let choice = confirm("Are you sure you want to delete this thread?") + if (! choice){ + return + } + fetch(this.backend + this.userID + '/delete/' + num, {'method': 'POST'}).catch((err) => { alert("Failed to delete thread. Please report if this keeps occurring.") }).then((res) =>{ @@ -186,6 +197,7 @@ let app = createApp({ this.getXMRAddress() this.getThreads(false) this.getCredits() + this.getPricingInfo() await this.getOwnedNumber() }, @@ -241,6 +253,21 @@ let app = createApp({ this.availableNumbers = numbers.replaceAll('\n\n', '').split('\n').map((number) => { return number }) + }, + async getPricingInfo(){ + fetch (this.backend + 'pricing').then((response) => { + if (! response.ok){ + this.pricingInfo = "Error getting pricing info" + } + else{ + response.text().then((data) => { + this.pricingInfo = data + }) + } + }).catch((error) => { + this.pricingInfo = "Error getting pricing info" + console.debug(error) + }) } }, mounted() {