Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
KalamPinjar committed Apr 10, 2024
1 parent 964b9dc commit 63be9e6
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 70 deletions.
4 changes: 2 additions & 2 deletions LandingPage/landing-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ <h2 class="logo">

</ul>
<div id="signout" class="py-1">
<a class="block px-4 py-2 text-gray-700 text-sm">Sign
out</a>
<li class="block px-4 py-2 text-sm">Sign
out</li>
</div>
</div>
<ul class="links">
Expand Down
Binary file added Project Synopsis - Copy.pdf
Binary file not shown.
Binary file added Project_Proposal.pdf
Binary file not shown.
158 changes: 90 additions & 68 deletions history.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,71 +139,93 @@ function displayHistory(historyData) {
}

onAuthStateChanged(auth, (user) => {
const deleteData = document.querySelector("#deleteData")
deleteData.addEventListener('click', e => {
console.log("clicked")
if (user) {
deleteDoc(doc(dbstore, 'users', user.uid, 'history'));

const toastMsgSignOut = document.getElementById("toast-signout")

toastMsgSignOut.innerHTML = `<div
class="inline-flex flex-shrink-0 justify-center items-center bg-blue-100 dark:bg-blue-800 rounded-lg w-8 h-8 text-blue-500 dark:text-blue-200">
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 20">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M15.147 15.085a7.159 7.159 0 0 1-6.189 3.307A6.713 6.713 0 0 1 3.1 15.444c-2.679-4.513.287-8.737.888-9.548A4.373 4.373 0 0 0 5 1.608c1.287.953 6.445 3.218 5.537 10.5 1.5-1.122 2.706-3.01 2.853-6.14 1.433 1.049 3.993 5.395 1.757 9.117Z" />
</svg>
<span class="sr-only">Fire icon</span>
</div>
<div class="font-normal text-sm ms-3">Data Deleted!</div>
<button type="button"
class="inline-flex justify-center items-center bg-white hover:bg-gray-100 dark:hover:bg-gray-700 dark:bg-gray-800 -mx-1.5 -my-1.5 p-1.5 rounded-lg w-8 h-8 text-gray-400 hover:text-gray-900 dark:hover:text-white ms-auto focus:ring-2 focus:ring-gray-300 dark:text-gray-500"
data-dismiss-target="#toast-default" aria-label="Close">
<span class="sr-only">Close</span>
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" />
</svg>
</button>`
toastMsgSignOut.classList.add("toastanime")

setTimeout(() => {
toastMsgSignOut.classList.remove("toastanime")
}, 3000)

// setTimeout(() => {

// window.location.reload()
// }, 1500)
}
else {

const toastMsgSignOut = document.getElementById("toast-signout")

toastMsgSignOut.innerHTML = `<div
class="inline-flex flex-shrink-0 justify-center items-center bg-blue-100 dark:bg-blue-800 rounded-lg w-8 h-8 text-blue-500 dark:text-blue-200">
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 20">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M15.147 15.085a7.159 7.159 0 0 1-6.189 3.307A6.713 6.713 0 0 1 3.1 15.444c-2.679-4.513.287-8.737.888-9.548A4.373 4.373 0 0 0 5 1.608c1.287.953 6.445 3.218 5.537 10.5 1.5-1.122 2.706-3.01 2.853-6.14 1.433 1.049 3.993 5.395 1.757 9.117Z" />
</svg>
<span class="sr-only">Fire icon</span>
</div>
<div class="font-normal text-sm ms-3">Error Deleting Data!</div>
<button type="button"
class="inline-flex justify-center items-center bg-white hover:bg-gray-100 dark:hover:bg-gray-700 dark:bg-gray-800 -mx-1.5 -my-1.5 p-1.5 rounded-lg w-8 h-8 text-gray-400 hover:text-gray-900 dark:hover:text-white ms-auto focus:ring-2 focus:ring-gray-300 dark:text-gray-500"
data-dismiss-target="#toast-default" aria-label="Close">
<span class="sr-only">Close</span>
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" />
</svg>
</button>`
toastMsgSignOut.classList.add("toastanime")

setTimeout(() => {
toastMsgSignOut.classList.remove("toastanime")
}, 3000)

}
})
})
if (user) {
const deleteData = document.querySelector("#deleteData");
// Add event listener to the delete icon
deleteData.addEventListener("click", () => {
// Get a reference to the user's history collection
const userHistoryRef = collection(dbstore, 'users', user.uid, 'history');

// Delete all documents in the history collection
getDocs(userHistoryRef).then((querySnapshot) => {
querySnapshot.forEach((doc) => {
deleteDoc(doc.ref).then(() => {
const toastMsgSignOut = document.getElementById("toast-signout")

toastMsgSignOut.innerHTML = `<div
class="inline-flex flex-shrink-0 justify-center items-center bg-blue-100 dark:bg-blue-800 rounded-lg w-8 h-8 text-blue-500 dark:text-blue-200">
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 20">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M15.147 15.085a7.159 7.159 0 0 1-6.189 3.307A6.713 6.713 0 0 1 3.1 15.444c-2.679-4.513.287-8.737.888-9.548A4.373 4.373 0 0 0 5 1.608c1.287.953 6.445 3.218 5.537 10.5 1.5-1.122 2.706-3.01 2.853-6.14 1.433 1.049 3.993 5.395 1.757 9.117Z" />
</svg>
<span class="sr-only">Fire icon</span>
</div>
<div class="font-normal text-sm ms-3">Data Deleted Successfully!</div>
<button type="button"
class="inline-flex justify-center items-center bg-white hover:bg-gray-100 dark:hover:bg-gray-700 dark:bg-gray-800 -mx-1.5 -my-1.5 p-1.5 rounded-lg w-8 h-8 text-gray-400 hover:text-gray-900 dark:hover:text-white ms-auto focus:ring-2 focus:ring-gray-300 dark:text-gray-500"
data-dismiss-target="#toast-default" aria-label="Close">
<span class="sr-only">Close</span>
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" />
</svg>
</button>`
toastMsgSignOut.classList.add("toastanime")

setTimeout(() => {
toastMsgSignOut.classList.remove("toastanime")
}, 3000)

// Optionally, refresh the history display
displayHistory([]); // Clear the history display
}).catch((error) => {
console.error("Error deleting history document: ", error);
});
});
}).catch((error) => {
console.error("Error getting documents: ", error);
});
});
}
})


// // setTimeout(() => {

// // window.location.reload()
// // }, 1500)
// }).catch((error) => {
// console.error("Error deleting history item: ", error);
// });

// }
// else {

// const toastMsgSignOut = document.getElementById("toast-signout")

// toastMsgSignOut.innerHTML = `<div
// class="inline-flex flex-shrink-0 justify-center items-center bg-blue-100 dark:bg-blue-800 rounded-lg w-8 h-8 text-blue-500 dark:text-blue-200">
// <svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 20">
// <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
// d="M15.147 15.085a7.159 7.159 0 0 1-6.189 3.307A6.713 6.713 0 0 1 3.1 15.444c-2.679-4.513.287-8.737.888-9.548A4.373 4.373 0 0 0 5 1.608c1.287.953 6.445 3.218 5.537 10.5 1.5-1.122 2.706-3.01 2.853-6.14 1.433 1.049 3.993 5.395 1.757 9.117Z" />
// </svg>
// <span class="sr-only">Fire icon</span>
// </div>
// <div class="font-normal text-sm ms-3">Error Deleting Data!</div>
// <button type="button"
// class="inline-flex justify-center items-center bg-white hover:bg-gray-100 dark:hover:bg-gray-700 dark:bg-gray-800 -mx-1.5 -my-1.5 p-1.5 rounded-lg w-8 h-8 text-gray-400 hover:text-gray-900 dark:hover:text-white ms-auto focus:ring-2 focus:ring-gray-300 dark:text-gray-500"
// data-dismiss-target="#toast-default" aria-label="Close">
// <span class="sr-only">Close</span>
// <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
// <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
// d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" />
// </svg>
// </button>`
// toastMsgSignOut.classList.add("toastanime")

// setTimeout(() => {
// toastMsgSignOut.classList.remove("toastanime")
// }, 3000)

// }
// })

0 comments on commit 63be9e6

Please sign in to comment.