diff --git a/add.html b/add.html new file mode 100644 index 0000000..6fc7530 --- /dev/null +++ b/add.html @@ -0,0 +1,27 @@ + + + + + Cal Course - Add + + + + + + +
+

Cal Course

+
 
+

- Add Course Info

+ + +

Select QR Code

+ + +
+ +
+ +
+ + diff --git a/add.js b/add.js new file mode 100644 index 0000000..960ff6f --- /dev/null +++ b/add.js @@ -0,0 +1,58 @@ +let token = ''; + +$(() => { + $.ajax({ + type: 'POST', + url: "http://118.25.79.158:3000/api/v1/auth/", + contentType: 'application/json', + dataType: 'json', + data: { + email: "oski@berkeley.edu", + }, + success: (response) => { + token = concat(response.token); + console.log(response); + }, + error: (response) => { + console.log(response); + }, + }) +}); + +function submitInfo() { + $.ajax({ + type: 'POST', + url: 'http://118.25.79.158:3000/api/v1/courses/', + headers: { + 'Authorization': 'Bearer: ' + token, + }, + contentType: 'application/json', + dataType: 'json', + data: { + code: $("#course-code").val(), + name: $("#course-name").val(), + qr_code: (getURL()), + }, + success: (response) => { + console.log(response); + }, + error: (response) => { + console.log(response); + }, + }) +} + +function loadPreview() { + let qrCodeFile = document.getElementById('qr').files[0]; + let previewer = new FileReader(); + previewer.onload = function (e) { + let qrCodeImg = document.getElementById("qr-preview"); + qrCodeImg.src = e.target.result; + qrCodeImg.style = "max-width: 150px; max-height: 150px"; + }; + previewer.readAsDataURL(qrCodeFile); +} + +function getURL() { + +} \ No newline at end of file diff --git a/index.html b/index.html index 6d95f72..6d686a9 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,8 @@

Cal Course

diff --git a/index.js b/index.js index 39c2ac6..aa59709 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -let api = "http://118.25.79.158:3000/api/v1/courses/"; +let api = "http://118.25.79.158:3000/api/vvv/courses/"; $(() => { $.ajax({url: api, headers: { diff --git a/src/qr-place-holder.png b/src/qr-place-holder.png new file mode 100644 index 0000000..bfd58fb Binary files /dev/null and b/src/qr-place-holder.png differ diff --git a/style.css b/style.css index 7ce0e7b..1d89450 100644 --- a/style.css +++ b/style.css @@ -40,6 +40,32 @@ h1 { color: var(--p-fg); } +#course-code { + background-color: transparent; + border: none; + outline: none; + border-bottom: solid 1px var(--accent); + font-size: 18px; + color: var(--p-fg); +} + +#course-name { + background-color: transparent; + border: none; + outline: none; + border-bottom: solid 1px var(--accent); + font-size: 18px; + color: var(--p-fg); +} + +#qr { + display: block; + background-color: transparent; + outline: none; + font-size: 18px; + color: var(--accent); +} + #card-container { display: grid; grid-gap: 32px; @@ -127,7 +153,7 @@ h1 { #about-container { position: fixed; top: 10vh; - height: 200px; + height: 220px; width: 300px; left: calc(50vw - 150px); background-color: var(--p-bg); @@ -167,3 +193,29 @@ h1 { cursor: pointer; font-size: 14px; } + +.submit-button { + display: block; + border: solid 2px var(--accent); + padding: 3px; + background-color: var(--accent); + color: white; + cursor: pointer; + font-size: 20px; + margin: 0px; +} + +.preview-button { + display: block; + border: solid 2px var(--accent); + padding: 3px; + background-color: white; + color: var(--accent); + cursor: pointer; + font-size: 15px; + margin-bottom: 35px; +} + +.img-container { + margin: 0px; +} \ No newline at end of file