From 0867ae58e08bfbd3ce805a5a58f35997bc944686 Mon Sep 17 00:00:00 2001 From: EdwinKuttappi Date: Thu, 2 Nov 2023 14:05:47 -0700 Subject: [PATCH 01/14] change font and button on connect --- spotifyconnect.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spotifyconnect.md b/spotifyconnect.md index 93b3f0b..27bd26e 100644 --- a/spotifyconnect.md +++ b/spotifyconnect.md @@ -1,3 +1,19 @@ + +

Connecting to Spotify API! If you don't get redirected click the button below.

From f1d73890765b0c1c23cbe48e603669500f7c69e5 Mon Sep 17 00:00:00 2001 From: Toby-Leeder Date: Thu, 2 Nov 2023 15:08:26 -0700 Subject: [PATCH 02/14] made spotify connect automatic --- spotifyconnect.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spotifyconnect.md b/spotifyconnect.md index 68af47c..5f2da77 100644 --- a/spotifyconnect.md +++ b/spotifyconnect.md @@ -1,3 +1,4 @@ +

Connecting to Spotify API! If you don't get redirected click the button below.

\ No newline at end of file From 7b1ed69132d28aac12853c0c24c9e9d3682a4e0c Mon Sep 17 00:00:00 2001 From: Toby-Leeder Date: Thu, 2 Nov 2023 15:12:34 -0700 Subject: [PATCH 03/14] added search on enter --- assets/search/search.js | 65 ++++------------------------------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/assets/search/search.js b/assets/search/search.js index 433203d..a502c3c 100644 --- a/assets/search/search.js +++ b/assets/search/search.js @@ -128,63 +128,10 @@ function fetchData() { .catch(error => { console.error('Error:', error); }); - +} -// fetch(url, headers) -// .then(response => { -// if (response.status !== 200) { -// const errorMsg = 'Database response error: ' + response.status; -// console.log(errorMsg); -// const tr = document.createElement("tr"); -// const td = document.createElement("td"); -// td.innerHTML = errorMsg; -// tr.appendChild(td); -// resultContainer.appendChild(tr); -// return; -// } - -// response.json().then(data => { -// console.log(data); - -// for (const row of data.results) { -// console.log(row); - -// const tr = document.createElement("tr"); - -// const artist = document.createElement("td"); -// const track = document.createElement("td"); -// const image = document.createElement("td"); -// const preview = document.createElement("td"); - -// artist.innerHTML = row.artistName; -// track.innerHTML = row.trackName; -// const img = document.createElement("img"); -// img.src = row.artworkUrl100; -// image.appendChild(img); - -// const audio = document.createElement("audio"); -// audio.controls = true; -// const source = document.createElement("source"); -// source.src = row.previewUrl; -// source.type = "audio/mp4"; -// audio.appendChild(source); -// preview.appendChild(audio); - -// tr.appendChild(artist); -// tr.appendChild(track); -// tr.appendChild(image); -// tr.appendChild(preview); - -// resultContainer.appendChild(tr); -// } -// }) -// }) -// .catch(err => { -// console.error(err); -// const tr = document.createElement("tr"); -// const td = document.createElement("td"); -// td.innerHTML = err; -// tr.appendChild(td); -// resultContainer.appendChild(tr); -// }); -} \ No newline at end of file +document.addEventListener("keydown", function (key) { + if (key.code === "Enter") { + fetchData(); + } +}); From e7f2f35ee549dedc5f97df2ca10146ba70e725a1 Mon Sep 17 00:00:00 2001 From: Toby-Leeder Date: Thu, 2 Nov 2023 15:28:39 -0700 Subject: [PATCH 04/14] added dynamic url changing based on local or not --- assets/classroom/script.js | 11 +++++++++-- spotifyconnect.md | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/assets/classroom/script.js b/assets/classroom/script.js index 05da887..9ba7839 100644 --- a/assets/classroom/script.js +++ b/assets/classroom/script.js @@ -539,8 +539,15 @@ document.addEventListener('DOMContentLoaded', function() { let codeVerifier2 = localStorage.getItem('code_verifier'); const urlParams = new URLSearchParams(window.location.search); let code = urlParams.get('code'); -// const redirectUri = 'http://127.0.0.1:4100/classroom'; -const redirectUri = 'https://classroomjukebox.com/classroom'; +var redirectUri = ""; +var siteUrl = "{{ site.url }}" +if (siteUrl.includes("localhost")){ + redirectUri = 'http://127.0.0.1:4100/classroom'; +} +else { + redirectUri = 'https://classroomjukebox.com/classroom'; +} + const clientId = 'a76d4532c6e14dd7bd7393e3fccc1185'; let body = new URLSearchParams({ diff --git a/spotifyconnect.md b/spotifyconnect.md index 5f2da77..93b3f0b 100644 --- a/spotifyconnect.md +++ b/spotifyconnect.md @@ -1,6 +1,7 @@

Connecting to Spotify API! If you don't get redirected click the button below.

+ \ No newline at end of file From 2debe79a61ba1ad95559467e7c1f3222710db103 Mon Sep 17 00:00:00 2001 From: Toby-Leeder Date: Thu, 2 Nov 2023 15:34:42 -0700 Subject: [PATCH 05/14] changed constants to variables --- assets/classroom/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/classroom/script.js b/assets/classroom/script.js index 9ba7839..6c2b763 100644 --- a/assets/classroom/script.js +++ b/assets/classroom/script.js @@ -317,10 +317,10 @@ function setSong(index) { } catch {} - const track = playlist[index] - const cover = track.cover - const artist = lengthCheck(track.artist, 10) - const title = lengthCheck(track.title, 18) + var track = playlist[index] + var cover = track.cover + var artist = lengthCheck(track.artist, 10) + var title = lengthCheck(track.title, 18) // Update background image document.querySelector('.songMetaData').style.setProperty(`--background-image`, `url("${cover}")`) From 3ae385e6d46fe97b61366702fc86e1b0df768e62 Mon Sep 17 00:00:00 2001 From: Toby-Leeder Date: Thu, 2 Nov 2023 15:38:02 -0700 Subject: [PATCH 06/14] commented weird line --- assets/classroom/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/classroom/script.js b/assets/classroom/script.js index 6c2b763..69d8c8a 100644 --- a/assets/classroom/script.js +++ b/assets/classroom/script.js @@ -268,7 +268,7 @@ function removePlaylistDiv(index) { items[index].remove() - items = document.getElementsByClassName('playlistItem') + // items = document.getElementsByClassName('playlistItem') for (let i = 0; i < items.length; i ++) { items[i].children[0].innerHTML = i + 1 From 69e79643e2967bb53fc7ab24f2267ce10208bc31 Mon Sep 17 00:00:00 2001 From: Toby-Leeder Date: Thu, 2 Nov 2023 18:44:02 -0700 Subject: [PATCH 07/14] re-added auto redirect --- spotifyconnect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spotifyconnect.md b/spotifyconnect.md index 93b3f0b..fdb32f6 100644 --- a/spotifyconnect.md +++ b/spotifyconnect.md @@ -73,5 +73,5 @@ document.getElementById('login-button').addEventListener('click', function() { redirectToSpotifyAuthorizeEndpoint();}, false); } - // redirectToSpotifyAuthorizeEndpoint(); + redirectToSpotifyAuthorizeEndpoint(); \ No newline at end of file From f712e7f86f120476ead3a74014d820fd4bfcd769 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 2 Nov 2023 19:18:21 -0700 Subject: [PATCH 08/14] last minute style changes --- assets/search/search.css | 27 ++++++++++++++++++--------- search.html | 4 ++-- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/assets/search/search.css b/assets/search/search.css index 7530259..111458a 100644 --- a/assets/search/search.css +++ b/assets/search/search.css @@ -9,7 +9,7 @@ table { table-layout: fixed; width: 100%; border-collapse: collapse; - border: 3px solid purple; + /*border: 3px solid purple;*/ } thead th:nth-child(1) { width: 20%; @@ -60,7 +60,7 @@ thead th, tfoot th, tfoot td { rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.5) ); - border: 3px solid rgb(101, 178, 216); + border: 2px solid white; } tr { font-weight: bold; @@ -72,7 +72,7 @@ tbody tr:nth-child(even) { background-color: #e597e2; } table { - background-color: #a023d5; + background-color: #924bee; } /* .metadata { height: 0px; @@ -82,7 +82,7 @@ table { .input-group{ margin: auto; margin-top: auto; - width: 80%; + width: 50%; } .input-group input { width: 100%; @@ -93,10 +93,6 @@ table { text-align: center; } -.button-elements { - - } - .button-elements button { margin: auto; display: block; @@ -111,4 +107,17 @@ table { } .button-elements button:hover { background-color: #df7bda; -} \ No newline at end of file +} + +.table button{ + margin: auto; + display: block; + background-color: #924bee; + color: #fff; + border: none; + border-radius: 25px; + padding: 10px 20px; + cursor: pointer; + font-size: 18px; + margin-bottom: 20px; +} \ No newline at end of file diff --git a/search.html b/search.html index a28808c..473a8c2 100644 --- a/search.html +++ b/search.html @@ -8,7 +8,7 @@ -
+
@@ -24,7 +24,7 @@ -
+
From e7e1fe66036356b0321c5e5ae799a287ce8f0522 Mon Sep 17 00:00:00 2001 From: Toby-Leeder Date: Thu, 2 Nov 2023 19:45:40 -0700 Subject: [PATCH 09/14] Fixed remove playlist --- assets/classroom/script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/classroom/script.js b/assets/classroom/script.js index 69d8c8a..92bcc8e 100644 --- a/assets/classroom/script.js +++ b/assets/classroom/script.js @@ -267,6 +267,7 @@ function removePlaylistDiv(index) { let items = document.getElementsByClassName('playlistItem') items[index].remove() + playlist[index].remove() // items = document.getElementsByClassName('playlistItem') From b0bff503d4b631b0e0a728d295a8686dbff93749 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Nov 2023 12:16:35 -0700 Subject: [PATCH 10/14] sign in script moved to the actual script file --- assets/sign-in/script.js | 55 ++++++++++++++++++++-------------------- sign_in.html | 33 +----------------------- 2 files changed, 28 insertions(+), 60 deletions(-) diff --git a/assets/sign-in/script.js b/assets/sign-in/script.js index cd41250..b5bc149 100644 --- a/assets/sign-in/script.js +++ b/assets/sign-in/script.js @@ -1,31 +1,30 @@ -function signIn(event) { - event.preventDefault(); +document.getElementById('signInForm').addEventListener('submit', function(event) { + event.preventDefault(); - // Get email and password from the form - const email = document.getElementById('email').value; - const password = document.getElementById('password').value; + var email = document.getElementById('email').value; + var password = document.getElementById('password').value; - // authentication logic (validate email and password) - /* - if (email == (get email data) && password == (get password data)) { - const isAuthenticated = true; - } - else { - const isAuthenticated = false; - } - */ + // Make a POST request to your authentication endpoint + fetch('https://cj-backend.stu.nighthawkcodingsociety.com/human/authenticate', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + email: email, + password: password + }) + }) + .then(response => response.json()) + .then(data => { + // Assuming the response contains a 'token' field + var token = data.token; + // Store the token in localStorage or a cookie for future use + // For simplicity, we're using localStorage here + console.log(token); + localStorage.setItem('token', token); - // For demo purposes, let's assume successful authentication - const isAuthenticated = true; - - if (isAuthenticated) { - // Set a cookie with the user's email - document.cookie = `userEmail=${email}; expires=Sun, 1 Jan 2023 00:00:00 UTC; path=/`; - - // Redirect to the home page - window.location.href = '/'; - } else { - // Display an error message (you can customize this based on your authentication logic) - alert('Authentication failed. Please check your email and password.'); - } -} + alert('Sign in successful!'); + }) + .catch(error => console.error('Error:', error)); +}); \ No newline at end of file diff --git a/sign_in.html b/sign_in.html index ad05e82..fc2d5e1 100644 --- a/sign_in.html +++ b/sign_in.html @@ -27,38 +27,7 @@

Sign In

- + \ No newline at end of file From 6c1da5592715c855df19bd9ffdd299c075464c30 Mon Sep 17 00:00:00 2001 From: Toby-Leeder Date: Fri, 3 Nov 2023 12:26:59 -0700 Subject: [PATCH 11/14] centered the images --- assets/search/search.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/search/search.js b/assets/search/search.js index a502c3c..28d621d 100644 --- a/assets/search/search.js +++ b/assets/search/search.js @@ -95,6 +95,8 @@ function fetchData() { const preview = document.createElement("td"); const playSong = document.createElement("td"); + image.style.display = "flex"; + const playButton = document.createElement("button") playButton.innerHTML = "Request Your Song!" playButton.onclick = function() {sendMessage(row.uri.slice(14))} From 2e24544ca8688e9c83ec17350e60a4a18ae49e53 Mon Sep 17 00:00:00 2001 From: EdwinKuttappi Date: Sat, 4 Nov 2023 01:02:02 -0700 Subject: [PATCH 12/14] Made Search more corporate --- assets/search/search.css | 31 +++++++++++++++++++++++++------ search.html | 12 +++--------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/assets/search/search.css b/assets/search/search.css index 111458a..d14d082 100644 --- a/assets/search/search.css +++ b/assets/search/search.css @@ -2,15 +2,22 @@ height: 5em; width: auto; } +@import url("https://fonts.googleapis.com/css?family=Rubik%20Mono%20One:900&display=swap"); body{ background-color: #191414; } table { table-layout: fixed; - width: 100%; + width: 95%; border-collapse: collapse; /*border: 3px solid purple;*/ } + border: 3px solid purple; +} +.center { + margin-left: auto; + margin-right: auto; +} thead th:nth-child(1) { width: 20%; } @@ -18,10 +25,10 @@ thead th:nth-child(2) { width: 20%; } thead th:nth-child(3) { - width: 15%; + width: 12.5%; } thead th:nth-child(4) { - width: 25%; + width: 27.5%; } thead th:nth-child(5) { width: 15%; @@ -33,12 +40,13 @@ html { font-family: "helvetica neue", helvetica, arial, sans-serif; } thead th, tfoot th { - font-family: "Rock Salt", cursive; + font-family: 'Rubik Mono One', sans-serif; /* Apply the imported font */ } th { - letter-spacing: 2px; + letter-spacing: 1.5px; text-align: center; max-height: 5%; + font-size: 20px; } td { letter-spacing: 1px; @@ -74,15 +82,22 @@ tbody tr:nth-child(even) { table { background-color: #924bee; } +.center { + margin-left: auto; + margin-right: auto; +} /* .metadata { height: 0px; } */ /* Code for the Search Input */ .input-group{ + display: flex; + justify-content: space-between; + flex: 2; margin: auto; margin-top: auto; - width: 50%; + width: 80%; } .input-group input { width: 100%; @@ -93,6 +108,10 @@ table { text-align: center; } +.button-elements { + margin-left: 10px; + } + .button-elements button { margin: auto; display: block; diff --git a/search.html b/search.html index 473a8c2..e80ef73 100644 --- a/search.html +++ b/search.html @@ -11,21 +11,15 @@
-
- -
+
- -
-
+ +