blink/frontend/vanilla/html/userprofile.html

229 lines
12 KiB
HTML

<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous">
</script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body style="background-color: #ecf2fa; display: none;">
<div class="container py-5">
<!-- Person's name + profile picture card -->
<div class="row">
<div class="col-lg-4">
<div class="card mb-4">
<div class="card-body text-center">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-chat/ava3.webp" alt="avatar"
class="rounded-circle img-fluid" style="width: 150px;">
<h5 class="my-3" id="display-name">John Doe</h5>
<p class="text-muted mb-2" id="qualification">Full Stack Developer</p>
<p class="text-muted mb-4" id="place-of-living">New York City, United States of America</p>
<p class="text-muted mb-4" id="about-me"> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
qui officia deserunt mollit anim id est laborum.</p>
<div class="d-flex justify-content-center mb-2">
<!-- <button type="button" class="btn btn-primary">Follow</button> -->
<button type="button" class="btn btn-outline-primary ms-1">Message</button>
</div>
</div>
</div>
<!-- Person's contact infos -->
<div class="card mb-4 mb-lg-0">
<div class="card-body p-0">
<ul class="list-group list-group-flush rounded-3">
<li class="list-group-item d-flex justify-content-between align-items-center p-3">
<i class="fa-regular fa-envelope"></i>
<p class="mb-0"><a href="#" id="email">johndoe@proton.com</a></p>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center p-3">
<i class="fas fa-globe fa-lg text-warning"></i>
<p class="mb-0"><a href="#">johndoe.com</a></p>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center p-3">
<i class="fab fa-github fa-lg" style="color: #333333;"></i>
<p class="mb-0"><a href="https://github.com/xfarrow">johndoe</a></p>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center p-3">
<i class="fab fa-twitter fa-lg" style="color: #55acee;"></i>
<p class="mb-0">@mdbootstrap</p>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center p-3">
<i class="fab fa-instagram fa-lg" style="color: #ac2bac;"></i>
<p class="mb-0">mdbootstrap</p>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center p-3">
<i class="fab fa-facebook-f fa-lg" style="color: #3b5998;"></i>
<p class="mb-0">mdbootstrap</p>
</li>
</ul>
</div>
</div>
</div>
<div class="col-lg-8">
<!-- Experience -->
<div class="card mb-4">
<div class="card-body">
<h4 class="card-title font-weight-bold mb-3 text-center">Experience</h4>
<h5 class="card-title font-weight-bold mb-0">Software Engineer</h5>
<p class="card-text mb-2 text-muted">Blink Inc.</p>
<p class="card-text mb-2 text-muted">Sint fuga et eligendi at sint sequi. Odio dolorum aperiam consectetur
minima voluptatem. Eligendi adipisci earum ut officia. Aperiam laboriosam consequatur aut repudiandae nam
et. Est hic perspiciatis minus molestias delectus.
Eos suscipit quia similique qui suscipit cum sequi similique. Assumenda rem quis quidem velit. In ut a sed
sit blanditiis. Eaque ipsum placeat aut ut aspernatur provident et aut.</p>
<p class="card-text mb-2 text-muted" style="text-align: center;">February 2020 - present</p>
<hr>
<h5 class="card-title font-weight-bold mb-0">Software Engineer</h5>
<p class="card-text mb-2 text-muted">Blink Inc.</p>
<p class="card-text mb-2 text-muted">Sint fuga et eligendi at sint sequi. Odio dolorum aperiam consectetur
minima voluptatem. Eligendi adipisci earum ut officia. Aperiam laboriosam consequatur aut repudiandae nam
et. Est hic perspiciatis minus molestias delectus.
Eos suscipit quia similique qui suscipit cum sequi similique. Assumenda rem quis quidem velit. In ut a sed
sit blanditiis. Eaque ipsum placeat aut ut aspernatur provident et aut.</p>
<p class="card-text mb-2 text-muted" style="text-align: center;">February 2020 - present</p>
</div>
</div>
<!-- Education -->
<div class="card mb-4">
<div class="card-body">
<h4 class="card-title font-weight-bold mb-3 text-center">Education</h4>
<h5 class="card-title font-weight-bold mb-0">Bachelor's Degree in Computer Science</h5>
<p class="card-text mb-2 text-muted">University of Berkley</p>
<p class="card-text mb-2 text-muted">Sint fuga et eligendi at sint sequi. Odio dolorum aperiam consectetur
minima voluptatem. Eligendi adipisci earum ut officia. Aperiam laboriosam consequatur aut repudiandae nam
et. Est hic perspiciatis minus molestias delectus.
Eos suscipit quia similique qui suscipit cum sequi similique. Assumenda rem quis quidem velit. In ut a sed
sit blanditiis. Eaque ipsum placeat aut ut aspernatur provident et aut.</p>
<p class="card-text mb-2 text-muted" style="text-align: center;">February 2020 - July 2024</p>
<hr>
<h5 class="card-title font-weight-bold mb-0">Bachelor's Degree in Computer Science</h5>
<p class="card-text mb-2 text-muted">University of Berkley</p>
<p class="card-text mb-2 text-muted">Sint fuga et eligendi at sint sequi. Odio dolorum aperiam consectetur
minima voluptatem. Eligendi adipisci earum ut officia. Aperiam laboriosam consequatur aut repudiandae nam
et. Est hic perspiciatis minus molestias delectus.
Eos suscipit quia similique qui suscipit cum sequi similique. Assumenda rem quis quidem velit. In ut a sed
sit blanditiis. Eaque ipsum placeat aut ut aspernatur provident et aut.</p>
<p class="card-text mb-2 text-muted" style="text-align: center;">February 2020 - July 2024</p>
<hr>
<h5 class="card-title font-weight-bold mb-0">Bachelor's Degree in Computer Science</h5>
<p class="card-text mb-2 text-muted">University of Berkley</p>
<p class="card-text mb-2 text-muted">Sint fuga et eligendi at sint sequi. Odio dolorum aperiam consectetur
minima voluptatem. Eligendi adipisci earum ut officia. Aperiam laboriosam consequatur aut repudiandae nam
et. Est hic perspiciatis minus molestias delectus.
Eos suscipit quia similique qui suscipit cum sequi similique. Assumenda rem quis quidem velit. In ut a sed
sit blanditiis. Eaque ipsum placeat aut ut aspernatur provident et aut.</p>
<p class="card-text mb-2 text-muted" style="text-align: center;">February 2020 - July 2024</p>
</div>
</div>
<!-- Skills -->
<div class="card mb-4">
<div class="card-body">
<h4 class="card-title font-weight-bold mb-3 text-center">Skills</h4>
<p class="mb-1" style="font-size: .77rem;">Web Design</p>
<div class="progress rounded" style="height: 5px;">
<div class="progress-bar" role="progressbar" style="width: 80%" aria-valuenow="80" aria-valuemin="0"
aria-valuemax="100"></div>
</div>
<p class="mt-4 mb-1" style="font-size: .77rem;">Website Markup</p>
<div class="progress rounded" style="height: 5px;">
<div class="progress-bar" role="progressbar" style="width: 72%" aria-valuenow="72" aria-valuemin="0"
aria-valuemax="100"></div>
</div>
<p class="mt-4 mb-1" style="font-size: .77rem;">One Page</p>
<div class="progress rounded" style="height: 5px;">
<div class="progress-bar" role="progressbar" style="width: 89%" aria-valuenow="89" aria-valuemin="0"
aria-valuemax="100"></div>
</div>
<p class="mt-4 mb-1" style="font-size: .77rem;">Mobile Template</p>
<div class="progress rounded" style="height: 5px;">
<div class="progress-bar" role="progressbar" style="width: 55%" aria-valuenow="55" aria-valuemin="0"
aria-valuemax="100"></div>
</div>
<p class="mt-4 mb-1" style="font-size: .77rem;">Backend API</p>
<div class="progress rounded mb-2" style="height: 5px;">
<div class="progress-bar" role="progressbar" style="width: 66%" aria-valuenow="66" aria-valuemin="0"
aria-valuemax="100"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="../../js/constants.js"></script>
<script src="../../js/utils.js"></script>
<script>
window.addEventListener("load", async function () {
loadProfile();
});
async function loadProfile() {
const idToDisplay = new URLSearchParams(window.location.search).get('id');
let response;
// If it is the logged-in person
if (!idToDisplay || idToDisplay === 'me') {
const token = getCookie('token');
// Check whether the token exists
if (!token) {
window.location.href = 'login.html';
}
response = await fetch(`${API_URL}/persons/me`, {
headers: createHeaders(token)
});
} else {
response = await fetch(`${API_URL}/persons/${idToDisplay}/details`, {
headers: createHeaders(null)
});
}
const data = await response.json();
if (response.ok) {
populateFields(data.display_name, data.email, data.about_me, data.qualification, data.place_of_living);
document.body.style.display = 'block'; // Show page
} else if (response.status == 401) {
window.location.href = 'login.html';
} else {
alert(`Unable to load profile. Error: ${data.error}`);
}
}
function populateFields(displayName, email, aboutMe, qualification, placeOfLiving) {
document.getElementById('display-name').textContent = displayName;
document.title = `${displayName} - Blink`
document.getElementById('email').textContent = email;
document.getElementById('about-me').textContent = aboutMe;
document.getElementById('qualification').textContent = qualification;
document.getElementById('place-of-living').textContent = placeOfLiving;
}
</script>
</body>
</html>