diff --git a/frontend/vanilla/html/register.html b/frontend/vanilla/html/register.html
index dec1111..a87e7ca 100644
--- a/frontend/vanilla/html/register.html
+++ b/frontend/vanilla/html/register.html
@@ -129,7 +129,7 @@
* Performs an API POST Request to register the user.
*/
async function register() {
- const display_name = document.getElementById('displayname').value;
+ const displayName = document.getElementById('displayname').value;
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
@@ -141,7 +141,7 @@
method: 'POST',
headers: createHeaders(null),
body: JSON.stringify({
- display_name,
+ displayName,
email,
password
}),
diff --git a/frontend/vanilla/html/userprofile.html b/frontend/vanilla/html/userprofile.html
index 0ccc167..1ce063f 100644
--- a/frontend/vanilla/html/userprofile.html
+++ b/frontend/vanilla/html/userprofile.html
@@ -10,27 +10,26 @@
integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
-
+
-
-
-
-
Home
-
Your Applications
-
Your organizations
-
-
-
-
+
+
@@ -62,31 +61,7 @@
@@ -231,7 +206,8 @@
const data = await response.json();
if (response.ok) {
- populateFields(data.display_name, data.about_me, data.qualification, data.place_of_living);
+ populateFields(data.display_name, data.about_me, data.qualification, data.place_of_living, data
+ .contact_infos);
document.body.style.display = 'block'; // Show page
} else if (response.status == 401) {
window.location.href = 'login.html';
@@ -240,12 +216,107 @@
}
}
- function populateFields(displayName, aboutMe, qualification, placeOfLiving) {
+ function populateFields(displayName, aboutMe, qualification, placeOfLiving, contactInfos) {
document.getElementById('display-name').textContent = displayName;
document.title = `${displayName} - Blink`
document.getElementById('about-me').textContent = aboutMe;
document.getElementById('qualification').textContent = qualification;
document.getElementById('place-of-living').textContent = placeOfLiving;
+
+ populateContactInfo(contactInfos);
+
+ }
+
+
+ function populateContactInfo(contactInfos) {
+ const contactInfoList = document.getElementById('contact-info');
+
+ contactInfos.forEach((contactInfo) => {
+ const listItem = document.createElement('li');
+ listItem.classList.add('list-group-item', 'd-flex', 'justify-content-between', 'align-items-center', 'p-3');
+
+ const icon = document.createElement('i');
+ var isLink;
+
+ switch (contactInfo.info_type) {
+ case 'EMAIL':
+ icon.classList.add('fa-envelope');
+ icon.classList.add("fa-regular");
+ icon.style.color = '#3498db';
+ isLink = false;
+ break;
+ case 'WEBSITE':
+ icon.classList.add('fa-globe');
+ icon.classList.add("fas");
+ icon.classList.add("text-warning");
+ isLink = true;
+ break;
+ case 'GIT':
+ icon.classList.add('fa-git');
+ icon.classList.add("fab");
+ icon.style.color = '#db3e00';
+ isLink = true;
+ break;
+ case 'FACEBOOK':
+ icon.classList.add('fa-facebook-f');
+ icon.classList.add("fab");
+ icon.style.color = '#3b5998';
+ isLink = true;
+ break;
+ case 'INSTAGRAM':
+ icon.classList.add('fa-instagram');
+ icon.classList.add("fab");
+ icon.style.color = '#e1306c';
+ isLink = true;
+ break;
+ case 'YOUTUBE':
+ icon.classList.add('fa-youtube');
+ icon.classList.add("fab");
+ icon.style.color = '#ff0000';
+ isLink = true;
+ break;
+ case 'PHONE':
+ icon.classList.add('fa-phone');
+ icon.classList.add("fas");
+ icon.style.color = '#8e44ad';
+ isLink = false;
+ break;
+ case 'MASTODON':
+ icon.classList.add('fa-mastodon');
+ icon.classList.add("faB");
+ icon.style.color = '#6364ff';
+ isLink = true;
+ break;
+ default:
+ icon.classList.add('fa-question');
+ icon.classList.add("far");
+ iconColor = '#95a5a6';
+ isLink = false;
+ }
+ icon.style.fontSize = '1.5em';
+
+ if (isLink) {
+ const link = document.createElement('a');
+ link.textContent = contactInfo.info;
+ if (contactInfo.info.startsWith('http://') || contactInfo.info.startsWith('https://') || contactInfo.info.startsWith('tel:')) {
+ link.href = contactInfo.info;
+ } else {
+ link.href = 'https://' + contactInfo.info;
+ }
+ link.target = '_blank';
+ link.rel = 'noopener noreferrer';
+ listItem.appendChild(link);
+ } else {
+ const paragraph = document.createElement('p');
+ paragraph.classList.add('mb-0');
+ paragraph.textContent = contactInfo.info;
+ listItem.appendChild(paragraph);
+ }
+
+ listItem.appendChild(icon);
+ contactInfoList.appendChild(listItem);
+ });
+
}