Skip to content

Commit

Permalink
big update. added refresh ability to SPA
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian committed Nov 8, 2023
1 parent 92ee292 commit 193e176
Show file tree
Hide file tree
Showing 19 changed files with 792 additions and 674 deletions.
120 changes: 120 additions & 0 deletions frontend/components/ConvoPlaceholder.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<script lang="js">
export default{
name:'ConvoPlaceholder',
}
</script>
<template>
<div id="CONVERSATION_PLACEHOLDER" >

</div>
</template>

<style>
#CONVERSATION_PLACEHOLDER{
grid-column-start: 2;
grid-column-end: 2;
height: 83vh;
}
#conversation{
grid-column-start: 2;
grid-column-end: 2;
}
/* these are for conversation which we are sidestepping for now */
.thread {
height:80vh;
margin: 0 auto;
border-left: solid #3178b1 2px;
border-right: solid #3178b1 2px;
border-bottom: solid #3178b1 2px;
border-bottom-left-radius: 0.5em;
border-bottom-right-radius: 0.5em;
padding-left: 0.5em;
padding-right: 0.5em;
/* stupid hack to get the text entry box to display inside the bounds of the thread */
display: flex;
flex-direction: column;
}
.thread-header {
margin: 0 auto;
padding: 1em;
background-color: #3178b1;
color: #fff;
border-top-left-radius: 0.5em;
border-top-right-radius: 0.5em;
font-weight: bold;
}
.message-container {
height: 100%;
overflow-y: auto;
display: flex;
flex-flow: column;
justify-content: flex-start;
margin-bottom: 0.5em;
}
.backfill {
max-width: 50em;
margin: 0 auto;
padding: 1em;
}
.white {
color: white;
}
td:active{
background-color:#3178B1;
color:white;
}
td:hover{
background-color: aliceblue;
}
table {
width: 100%;
table-layout: fixed;
}
.timestamp {
color: #999;
font-size: 8pt;
padding-left: 0.5em;
}
.thread-name {
font-size: 12pt;
color: #000;
}
.thread-name:active{
color:white;
}
.thread-last-message {
color: #000;
}
.thread-last-message:active {
color: #fff;
}
td {
border: solid #3178b1;
border-radius: 1em;
padding: 0.25em;
margin-bottom: 0.5em;
min-height: calc(50px + 1em);
}
table {
width: 100%;
table-layout: fixed;
}
@media screen and (width <=700px){
#conversation{
display: none;
}
}
</style>
21 changes: 19 additions & 2 deletions frontend/components/SendBox/SendBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default {
state: state,
}
},
name:"SendBox",
props: {
remoteNumber: {
type: String,
Expand Down Expand Up @@ -70,6 +71,7 @@ export default {
}
},
async send() {
console.log(this.enteredText);
if (this.enteredText.length == 0 && this.pendingAttachments.length == 0) {
this.$refs.textbox.focus();
return;
Expand Down Expand Up @@ -120,7 +122,9 @@ export default {
}
},
onAttach(e: Event) {
console.log(e.target.files);
const target = e.target as HTMLInputElement;
console.log(target);
for(const file of target.files) {
const a: PendingAttachment = {
file: file,
Expand Down Expand Up @@ -174,6 +178,18 @@ export default {
a.upload = this.uploadAttachment(a);
this.pendingAttachments.push(a);
break;
case "image/jpeg":
const fileJpeg = item.getAsFile();
const aJpeg: PendingAttachment = {
file: file,
previewURL: URL.createObjectURL(file),
progress: 0,
upload: null,
uploadedURL: null,
};
a.upload = this.uploadAttachment(a);
this.pendingAttachments.push(a);
break;
case "text/plain":
continue;
default:
Expand Down Expand Up @@ -207,7 +223,7 @@ export default {

</template>

<style scoped>
<style>
/*SENDBOX STYLES */
.sendbox {
Expand Down Expand Up @@ -301,4 +317,5 @@ export default {
position: absolute;
bottom: 1em;
right: 1em;
}</style>
}
</style>
75 changes: 44 additions & 31 deletions frontend/components/ThreadList/ThreadList.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" >
import { MessageData, emitter, state, } from '../../lib/global';
import ThreadPreview from '../ThreadPreview/ThreadPreview.vue';
import ThreadPreview, { ThreadPreviewInterface } from '../ThreadPreview/ThreadPreview.vue';
import { RouterLink } from 'vue-router';
// type ThreadListInterface = {
Expand All @@ -10,8 +10,33 @@ import { RouterLink } from 'vue-router';
export default{
name:'ThreadList',
// data(){
// const threads:Array<ThreadPreviewInterface> = [
// {
// displayName: "dan ryan",
// bodyPreview: "Hmm",
// link: "thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310",
// timestamp: new Date("2023-09-06 21:57:12.733721"),
// remoteNumber: "12068589310",
// ownNumber: "12065797799"
// }
// }
// ]
// },
props:{
username: String,
displayName: String,
ownNumber: String,
threads: Array<Object>,
threadPreviews: Array<ThreadPreviewInterface>
},
components:{ThreadPreview}
}
Expand All @@ -38,11 +63,11 @@ export default{
<input type='hidden' name='key_uuid' id='key_uuid'/>
</form>
*/
</script>

<style>
.td_preview:active{
background-color:#3178B1;
color:white;
Expand All @@ -51,16 +76,23 @@ export default{
background-color: aliceblue;
}
.td_preview{
border: solid black;
border: solid #3178b1;
border-radius: 1em;
padding: 0.5em;
margin-bottom: 0.5em;
min-height: calc(50px + 1em);
}
.preview_list_container{
direction:ltr;
padding-left:0.25rem;
}
.threadlist_container{
height: 80vh;
grid-column-start: 1;
grid-column-end: 1;
padding-right: 0.25rem;
}
.timestamp {
color: #999;
Expand All @@ -77,8 +109,9 @@ export default{
.table {
/*border-spacing: 1em; */
direction:rtl;
overflow-y: scroll;
height: 100%;
height: 80vh;
width: 100%;
table-layout: fixed;
}
Expand All @@ -87,6 +120,9 @@ export default{
div.action_bar{
top: 0px;
}
.table{
height:80vh;
}
}
</style>
Expand All @@ -96,39 +132,16 @@ export default{
<template>

<div class="threadlist_container">
<!-- <link rel="stylesheet" href="./frontend/components/ThreadListStyle.css">
<link rel="stylesheet" href="./frontend/components/conversation/ConversationStyle.css">
<link rel="stylesheet" href="./frontend/components/message/MessageStyle.css">
<link rel="stylesheet" href="./frontend/SendBoxStyle.css"> -->


<div class='action_bar' id='action_bar'>
<div class='heading'><b>WebTexting</b> {{username}} </div>
<div class='heading'><b>WebTexting</b> {{displayName}} </div>
<div class='actions'>
</div>
<div style='clear: both;'></div>
</div>
<div class='table'>
<!-- <ThreadPreview v-for="preview in this.threads" /> -->
<div class="preview_list_container">
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">dan ryan</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Franklin</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Oogway</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Pope</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Poe</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Tai Lung</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Roshi</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Goku</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12063801161"> <span class="thread-name">12063801161</span><br><span class="thread-last-message">Test </span><span class="timestamp" data-timestamp="2023-09-13 21:39:05.45867">9 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">dan ryan</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Franklin</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Oogway</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Pope</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Poe</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Tai Lung</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Roshi</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
<div class='tr_replace'><div class=td_preview><router-link to="thread.php?extension_uuid=fe91be7c-ecb2-4661-9d3a-bcf27099221b&amp;number=12068589310"> <span class="thread-name">Goku</span><br><span class="thread-last-message">Hmm</span><span class="timestamp" data-timestamp="2023-09-06 21:57:12.733721">16 days ago</span></router-link></div ></div >
</div>
<ThreadPreview v-for="preview in threadPreviews" :key="preview.toString()" v-bind="preview"/>
</div>
</div>
</div>

Expand Down
13 changes: 6 additions & 7 deletions frontend/components/ThreadPreview/ThreadPreview.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import Conversation from '../conversation/Conversation.vue';
import { MessageData } from '../../lib/global';
import { MessageData } from '../../lib/global'
import { RouterLink } from 'vue-router';
export type ThreadPreviewInterface = {
displayName: {
Expand Down Expand Up @@ -34,9 +35,7 @@ export type ThreadPreviewInterface = {
}
export default {
data() {
},
name:'ThreadPreview',
props: {
displayName: {
type: String,
Expand Down Expand Up @@ -75,11 +74,11 @@ export default {
<template>
<div class='tr_replace'>
<div class='td_preview'>
<a :href="this.link">
<router-link :to="this.link">
<span class='thread-name'>{{ this.displayName }}</span><br />
<span class='thread-last-message'>{{ this.bodyPreview }}</span>
<span class='thread-last-message'>{{ this.bodyPreview }}</span><br/>
<span class='timestamp' :data-timestamp="this.timestamp"></span>
</a>
</router-link>
</div>
</div>
</template>
Expand Down
Loading

0 comments on commit 193e176

Please sign in to comment.