Work on threads and formatting

This commit is contained in:
Kevin F 2022-10-28 23:43:31 +00:00
parent 7d360f2a36
commit 4c2323b502
3 changed files with 36 additions and 4 deletions

View File

@ -53,7 +53,7 @@
</span> </span>
<div v-if="showingThreadNum"> <div v-if="showingThreadNum">
<div v-for="message in threadMessages"> <div v-for="message in threadMessages">
{{ message }} <div :class="message[1]">{{ message[0] }}</div>
</div> </div>
</div> </div>
</div> </div>
@ -85,7 +85,7 @@ __ __ _____ __ __ _____
</pre> </pre>
<h1 class="mobileHeader">MoneroSMS</h1> <h1 class="mobileHeader">MoneroSMS</h1>
<form class="login"> <form class="login">
<input type="text" v-model="userIDInput" placeholder="Enter your account ID" required> <input type="password" v-model="userIDInput" placeholder="Enter your account ID" required>
<button @submit.prevent="onSubmit" @click="userID = userIDInput; userLogin()">Login</button> <button @submit.prevent="onSubmit" @click="userID = userIDInput; userLogin()">Login</button>
<button @submit.prevent="onSubmit" @click="userID = crypto.randomUUID(); userLogin()">Generate Account</button> <button @submit.prevent="onSubmit" @click="userID = crypto.randomUUID(); userLogin()">Generate Account</button>

View File

@ -10,6 +10,18 @@ body{
background-color: #020000; background-color: #020000;
} }
.from-us{
margin-left: 2em;
margin-right: 75%;
background-color: #e36414;
padding: 10px;
}
.msgBreak{
margin-top: 1em;
}
.main{ .main{
margin-left: 10%; margin-left: 10%;
} }

24
main.js
View File

@ -52,11 +52,32 @@ let app = createApp({
} }
this.lastThreadLineHeader = this.threadLineHeader this.lastThreadLineHeader = this.threadLineHeader
let fromUs = "from-us"
let applyBreak = true
messages = messages.split('\n') messages = messages.split('\n')
if (messages.length > 0){ if (messages.length > 0){
for (let i = 0; i < messages.length; i++){ for (let i = 0; i < messages.length; i++){
applyBreak = true
if (messages[i] !== ''){ if (messages[i] !== ''){
this.threadMessages.push(messages[i])
if (messages[i].startsWith(this.ownedNumber)){
fromUs = "from-us"
messages[i] = messages[i].replace(this.ownedNumber, this.formatPhone(this.ownedNumber))
}
else if(messages[i].startsWith(this.showingThreadNum)){
fromUs = "from-them"
messages[i] = messages[i].replace(this.showingThreadNum, this.formatPhone(this.showingThreadNum))
}
else{
applyBreak = false
}
if (applyBreak){
fromUs += " msgBreak"
}
this.threadMessages.push([messages[i], fromUs])
} }
} }
this.threadOffset = this.threadLineHeader this.threadOffset = this.threadLineHeader
@ -97,7 +118,6 @@ let app = createApp({
newThreads[i] = newThreads[i].trim() newThreads[i] = newThreads[i].trim()
if (! this.threads.includes(newThreads[i])){ if (! this.threads.includes(newThreads[i])){
if (newThreads[i]){ if (newThreads[i]){
console.debug('added thread')
this.threads.push(newThreads[i]) this.threads.push(newThreads[i])
} }
} }