Skip to content

Commit

Permalink
working chat
Browse files Browse the repository at this point in the history
  • Loading branch information
itsMikeLowrey committed Jun 5, 2023
1 parent 56e50dc commit fb0c3b5
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 4 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.4.0",
"mongodb": "^5.6.0",
"vue": "^3.2.47"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.1.0",
"autoprefixer": "^10.4.14",
"daisyui": "^3.0.3",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"vite": "^4.3.9"
Expand Down
90 changes: 89 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
<script setup>
import axios from 'axios';
import { ref } from 'vue'
const customChatDiv = ref(null);
async function checkForMessages() {
const results = await axios.get('/.netlify/functions/getDemoTexts')
messageArray.value = results.data
const div = customChatDiv.value
div.scrollTo({top: 99999999999999999999999999999, behavior: "smooth"})
}
checkForMessages()
function localTime(epoch) {
var timestamp = epoch;
var date = new Date(timestamp);
var hours = date.getHours();
var minutes = date.getMinutes();
var ampm = hours >= 12 ? 'pm' : 'am';
var day = date.getDate();
var month = date.getMonth()
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm + ' ' + day + '/' + month
return strTime;
}
const messageArray = ref([])
// Burger menus
document.addEventListener('DOMContentLoaded', function() {
// open
Expand Down Expand Up @@ -39,7 +64,6 @@ document.addEventListener('DOMContentLoaded', function() {
}
}
});
</script>

<template>
Expand Down Expand Up @@ -131,6 +155,70 @@ document.addEventListener('DOMContentLoaded', function() {
</div>
</div>
</section>
<section class="py-16 bg-gray-800 overflow-hidden">
<div class="container mx-auto px-4">
<div class="flex flex-wrap lg:items-center -m-8">
<div class="w-full md:w-1/2 p-8">
<div class="md:max-w-lg"><span class="inline-block mb-4 text-sm text-blue-500 font-bold uppercase tracking-widest">Free Phone</span>
<h2 class="font-heading mb-6 text-4xl md:text-5xl text-gray-100 font-black tracking-tight">Try Out Our Public Phone </h2>
<p class="mb-5 text-gray-500 font-bold">Use our phone here to test our text verification service. This is a public shared device though
, so don't use it for any private communications 😉
</p>
<div class="flex flex-wrap -m-2">
<div class="w-full md:w-auto p-2"><a class="block w-full px-4 py-2.5 text-sm text-center text-white font-bold bg-blue-500 hover:bg-blue-600 focus:ring-4 focus:ring-blue-200 rounded-full">Learn more</a></div>
</div>
</div>
</div>
<div class="w-full md:w-1/2 p-8">
<div class="relative py-16 px-8 bg-gray-900 overflow-hidden rounded-3xl ">
<div class="flex flex-wrap items-center justify-center">
<div class="w-full md:w-auto">
<h2 class="font-heading mb-9 text-3xl md:text-3xl text-gray-100 font-black tracking-tight text-center">Phone Number: (202) 596-6953 </h2>
</div>
</div>
<div class="absolute top-1/2 left-1/2 min-w-max transform -translate-x-1/2 -translate-y-1/2">
<div class="absolute bg-gradient-radial-dark w-full h-full"></div><!-- <img src="zanrly-assets/images/pattern-dark.png" alt=""> -->
</div>
<div class="grid grid-cols-1 max-h-96 overflow-y-auto" ref="customChatDiv">
<div class="py-2 rounded-md flex flex-wrap items-center justify-left" v-for="n in messageArray">
<div class="chat chat-start">
<div class="chat-image avatar"> <div class="w-10 rounded-full">
<img src="https://res.cloudinary.com/dylevfpbl/image/upload/v1685932292/landingpage/man_3.png" />
</div>
</div>
<div class="chat-header"> {{n.from}}
</div>
<div class="chat-bubble">{{n.text}}</div>
<div class="chat-footer opacity-50">
Sent at {{localTime(n.sentStamp)}}
</div>
</div></div>
</div>
<!-- <div class="flex items-center justify-center max-h-80 overflow-y-auto" ref="customChatDiv">
<div class="chat chat-start py-3" >
<div class="chat-image avatar"> <div class="w-10 rounded-full">
<img src="https://res.cloudinary.com/dylevfpbl/image/upload/v1685932292/landingpage/man_3.png" />
</div>
</div>
<div class="chat-header"> {{n.from}}
</div>
<div class="chat-bubble">{{n.text}}</div>
<div class="chat-footer opacity-50">
Sent at {{localTime(n.sentStamp)}}
</div>
</div>
</div> -->
<div class="flex flex-wrap -m-2 mt-7 items-center justify-center">
<div class="w-full md:w-auto p-2">
<div @click="checkForMessages" class="block w-full px-4 py-2.5 text-sm text-center text-white font-bold bg-blue-500 rounded-full">Check For New Messages</div>
</div>
</div>
</div>

</div>
</div>
</div>
</section>
<section class="py-12 bg-gray-800 overflow-hidden"><div class="container mx-auto px-4">
<div class="relative">
<div class="absolute top-1/2 left-1/2 min-w-max transform -translate-x-1/2 -translate-y-1/2">
Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export default {
theme: {
extend: {},
},
plugins: [],
plugins: [require("daisyui")]
}

89 changes: 87 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ arg@^5.0.2:
resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c"
integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==

asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==

autoprefixer@^10.4.14:
version "10.4.14"
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.14.tgz#e28d49902f8e759dd25b153264e862df2705f79d"
Expand All @@ -323,6 +328,15 @@ autoprefixer@^10.4.14:
picocolors "^1.0.0"
postcss-value-parser "^4.2.0"

axios@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"
integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
Expand Down Expand Up @@ -388,6 +402,18 @@ chokidar@^3.5.3:
optionalDependencies:
fsevents "~2.3.2"

colord@^2.9:
version "2.9.3"
resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.3.tgz#4f8ce919de456f1d5c1c368c307fe20f3e59fb43"
integrity sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==

combined-stream@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
dependencies:
delayed-stream "~1.0.0"

commander@^4.0.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
Expand All @@ -398,6 +424,14 @@ [email protected]:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==

css-selector-tokenizer@^0.8:
version "0.8.0"
resolved "https://registry.yarnpkg.com/css-selector-tokenizer/-/css-selector-tokenizer-0.8.0.tgz#88267ef6238e64f2215ea2764b3e2cf498b845dd"
integrity sha512-Jd6Ig3/pe62/qe5SBPTN8h8LeUg/pT4lLgtavPf7updwwHpvFzxvOQBHYj2LZDMjUnBzgvIUSjRcf6oT5HzHFg==
dependencies:
cssesc "^3.0.0"
fastparse "^1.1.2"

cssesc@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
Expand All @@ -408,6 +442,21 @@ csstype@^3.1.1:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b"
integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==

daisyui@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/daisyui/-/daisyui-3.0.3.tgz#9272b050c82399912efbf63b311b0ae41c7bb9ee"
integrity sha512-RSbXsEBj2LonvjOKEI0I64F5xFJrFrthPgxRNeAZKmACQ3NoIoP45lO6UXLW3bm8PVOUGpKf1Br2SWwc1NqnHQ==
dependencies:
colord "^2.9"
css-selector-tokenizer "^0.8"
postcss-js "^4"
tailwindcss "^3"

delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==

didyoumean@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037"
Expand Down Expand Up @@ -472,6 +521,11 @@ fast-glob@^3.2.12:
merge2 "^1.3.0"
micromatch "^4.0.4"

fastparse@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.2.tgz#91728c5a5942eced8531283c79441ee4122c35a9"
integrity sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==

fastq@^1.6.0:
version "1.15.0"
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a"
Expand All @@ -486,6 +540,20 @@ fill-range@^7.0.1:
dependencies:
to-regex-range "^5.0.1"

follow-redirects@^1.15.0:
version "1.15.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==

form-data@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"

fraction.js@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.2.0.tgz#448e5109a313a3527f5a3ab2119ec4cf0e0e2950"
Expand Down Expand Up @@ -628,6 +696,18 @@ micromatch@^4.0.4, micromatch@^4.0.5:
braces "^3.0.2"
picomatch "^2.3.1"

[email protected]:
version "1.52.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==

mime-types@^2.1.12:
version "2.1.35"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
dependencies:
mime-db "1.52.0"

minimatch@^3.0.4:
version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
Expand Down Expand Up @@ -739,7 +819,7 @@ postcss-import@^15.1.0:
read-cache "^1.0.0"
resolve "^1.1.7"

postcss-js@^4.0.1:
postcss-js@^4, postcss-js@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/postcss-js/-/postcss-js-4.0.1.tgz#61598186f3703bab052f1c4f7d805f3991bee9d2"
integrity sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==
Expand Down Expand Up @@ -783,6 +863,11 @@ postcss@^8.1.10, postcss@^8.4.23, postcss@^8.4.24:
picocolors "^1.0.0"
source-map-js "^1.0.2"

proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

punycode@^2.1.1:
version "2.3.0"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f"
Expand Down Expand Up @@ -885,7 +970,7 @@ supports-preserve-symlinks-flag@^1.0.0:
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==

tailwindcss@^3.3.2:
tailwindcss@^3, tailwindcss@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.3.2.tgz#2f9e35d715fdf0bbf674d90147a0684d7054a2d3"
integrity sha512-9jPkMiIBXvPc2KywkraqsUfbfj+dHDb+JPWtSJa9MLFdrPyazI7q6WX2sUrm7R9eVR7qqv3Pas7EvQFzxKnI6w==
Expand Down

0 comments on commit fb0c3b5

Please sign in to comment.