-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperfil-publico.html
43 lines (35 loc) · 1.67 KB
/
perfil-publico.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Perfil do Usuário</title>
<link rel="stylesheet" href="profile.css"> <!-- Link para o CSS -->
</head>
<body>
<h1>Perfil do Usuário</h1>
<div class="user-info" id="user-info">
<h2>Bem-vindo, <span id="username"></span>!</h2>
<img id="profile-pic" src="" alt="Foto de Perfil" style="border-radius: 50%; width: 120px; height: 120px;">
<p>Seguidores: <span id="follower-count">0</span></p>
<p>Seguindo: <span id="following-count">0</span></p>
</div>
<button id="back-button" onclick="goBack()">Voltar</button>
<script>
document.addEventListener("DOMContentLoaded", function () {
const loggedInUser = JSON.parse(localStorage.getItem('loggedInUser'));
if (loggedInUser) {
document.getElementById('username').textContent = loggedInUser.username;
document.getElementById('profile-pic').src = loggedInUser.profilePic || 'default-profile-pic.png'; // Usar uma imagem padrão
document.getElementById('follower-count').textContent = loggedInUser.followers ? loggedInUser.followers.length : 0;
document.getElementById('following-count').textContent = loggedInUser.following ? loggedInUser.following.length : 0;
} else {
document.getElementById('user-info').innerHTML = '<p>Usuário não encontrado.</p>';
}
});
function goBack() {
window.history.back();
}
</script>
</body>
</html>