Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Edit Profile Feature in Profile Page done ! #687 #710

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -697,13 +697,32 @@ <h2 class="primary-btn" id="logoutButton" style="display: none;">
<div id="liveScore ">LIVE SCORE: <span id="score">0</span></div>
<div id="liveLife">LIVE LIFE: <span id="lives">3</span></div>

<a href="./profile.html" class="profile-link profile-icon"
style="display: flex; align-items: center; text-decoration: none;">
<img src="https://i.postimg.cc/NFFmtc9K/xnz-Mst5-V-400x400.jpg" alt="Profile Icon"
style="width: 50px; height: 50px; border-radius: 50%; margin-top: -17px;">
</a>
<!-- Profile Icon -->

<a href="./profile.html" class="profile-link" style="display: flex; align-items: center; text-decoration: none;">
<img id="homeProfileImage" src="https://i.postimg.cc/NFFmtc9K/xnz-Mst5-V-400x400.jpg"
alt="Profile Icon"
style="width: 50px; height: 50px; border-radius: 50%; margin-top: -57px; margin-left: 220px;">
</a>
</li>

<script>

document.addEventListener("DOMContentLoaded", function() {
// Retrieve the saved avatar from localStorage
const savedAvatar = localStorage.getItem("selectedAvatar");

// If an avatar is saved, update the profile image
if (savedAvatar) {
const homeProfileImage = document.getElementById("homeProfileImage");
if (homeProfileImage) {
homeProfileImage.src = savedAvatar;
}
}
});

</script>

<style>
.profile-icon {

Expand Down
128 changes: 52 additions & 76 deletions profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,146 +4,122 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link rel="stylesheet" href="testp.css"> <!-- Link to your CSS file -->

<script src="testp.js" defer></script>

<title>Profile Page</title>

</head>

<body>

<div class="profile-container">

<div class="content-section">
<h2>Your Profile</h2>
<h2>Your Profile</h2>
<a href="index.html">
<i class="fas fa-home"></i>
</a>
<div class="profile-card">
<div class="profile-header">
<img src="https://i.postimg.cc/NFFmtc9K/xnz-Mst5-V-400x400.jpg" alt="Profile Image" class="profile-image">
<!-- Profile image will be set dynamically -->
<img id="profileImage" src="https://i.postimg.cc/NFFmtc9K/xnz-Mst5-V-400x400.jpg" alt="Profile Image" class="profile-image">

<div class="profile-info">
<h3 class="profile-name">Skylar Reed</h3>
<p class="profile-email">Email: skylar.reed@example.com</p>
<p class="profile-phone">Phone: +987 654 3210</p>
<p class="profile-bio">Joined: October 31, 2024</p>
<p class="profile-bio">About Me: Hello!πŸ™‹πŸ»β€β™‚οΈ my current Goals is Unlock all Achievements. 😎</p>
<p id="last-active">Last active: 31/10/2024, 11:12 PM</p>
<button class="edit-profile-btn edit_profiled">Edit Profile</button>


<!-- Profile info will be set dynamically -->
<h3 id="profileName" class="profile-name">Skylar Reed</h3>
<p id="profileEmail" class="profile-email">Email: skylar.reed@example.com</p>
<p id="profilePhone" class="profile-phone">Phone: +987 654 3210</p>
<p id="profileBio" class="profile-bio">About Me: Hello!πŸ™‹πŸ»β€β™‚οΈ Feel free to reach out to me at skylar.reed@example.com 😎</p>
<p id="aboutMe" class="profile-bio">Joined: October 31, 2024</p>
<p id="last-active" class="profile-bio">Last active: </p>
</div>

</div>
<a href="profileedit.html">
<button class="edit-profile-btn edit_profiled">Edit Profile</button>
</a>
</div>
</div>

<!-- Account Details and other sections remain the same -->
<div class="content-section">

<h2>Account Details</h2>
<div class="profile-details">
<div class="profile-detail-card" id="profileCard">
<h3>Friends List</h3>
<p id="addressText" contenteditable="false">16 friends online</p>
<p id="addressText" contenteditable="false">27 friends online</p>
<a href="#"><button class="edit-profile-btn">View</button></a>
</div>

<div class="profile-detail-card">
<h3>Change Password</h3>
<p>*********63</p>
<button class="edit-profile-btn">Change</button></a>
<p>*****63</p>
<button class="edit-profile-btn">Change</button>
</div>

<div class="profile-detail-card">
<h3>Privacy Settings</h3>
<p>Visibility Status: Public</p>
<a href="#">
<button class="edit-profile-btn">Edit</button></a>
<button class="edit-profile-btn">Edit</button>
</a>
</div>

<div class="profile-detail-card">
<h3>Recent Activity</h3>
<p>Updated profile information</p>
<a href="#">
<button class="edit-profile-btn">View</button></a>
<button class="edit-profile-btn">View</button>
</a>
</div>

</div>
</div>

<section class="content-section">

<h2>Notifications</h2>
<div class="card">
<p>Your profile has been updated successfully!</p>

<button class="edit-profile-btn">View Notification</button>
</div>
<div class="card">
<p>Joshef Roy has sent you a friend request. Accept or decline?</p>

<button class="edit-profile-btn">View Notification</button>
</div>

</section>

<footer class="bg-body-tertiary text-center">
<!-- Grid container -->
<div class="container p-4">
<!-- Section: Social media -->
<section class="mb-4">
<!-- Facebook -->
<a data-mdb-ripple-init class="btn btn-outline btn-floating m-1" href="#!"style="margin:15px" role="button"
><i class="fab fa-facebook-f"></i
></a>

<!-- Twitter -->
<a data-mdb-ripple-init class="btn btn-outline btn-floating m-1" href="#!"style="margin:15px" role="button"
><i class="fab fa-twitter"></i
></a>

<!-- Google -->
<a data-mdb-ripple-init class="btn btn-outline btn-floating m-1" href="#!"style="margin:15px" role="button"
><i class="fab fa-google"></i
></a>

<!-- Instagram -->
<a data-mdb-ripple-init class="btn btn-outline btn-floating m-1" href="#!"style="margin:15px" role="button"
><i class="fab fa-instagram"></i
></a>

<!-- Linkedin -->
<a data-mdb-ripple-init class="btn btn-outline btn-floating m-1" href="#!"style="margin:15px" role="button"
><i class="fab fa-linkedin-in"></i
></a>

<!-- Github -->
<a data-mdb-ripple-init class="btn btn-outline btn-floating m-1" href="#!"style="margin:15px" role="button"
><i class="fab fa-github"></i
></a>
</section>
<section class="mx-4 mb-4">
<p>
Welcome to Alien Invasion Defense, a fast-paced space shooting game! Defend your base from waves of alien invaders and become the ultimate space defender. 🌌 With simple controls, sleek graphics, and exciting gameplay, get ready for an epic battle. Use your weapons to destroy alien ships, survive multiple waves, and protect your base with 3 lives. πŸ‘Ύ
</p>
</section>
</div>

<!-- Copyright -->
<div class="text-center p-3" style="background-color: rgba(0, 0, 0, 0.05);">
Β© <span id="currentYear"></span> Alien-Invasion-Defense. All rights reserved.


</div>
<!-- Copyright -->
</footer>
<script>
document.getElementById("currentYear").textContent = new Date().getFullYear();

<script>
document.addEventListener("DOMContentLoaded", function() {
// Load saved profile information from localStorage
const savedName = localStorage.getItem("profileName");
const savedEmail = localStorage.getItem("profileEmail");
const savedPhone = localStorage.getItem("profilePhone");
const savedBio = localStorage.getItem("profileBio");
const savedAvatar = localStorage.getItem("selectedAvatar");

// Update profile information if it exists in localStorage
if (savedName) {
document.getElementById("profileName").textContent = savedName;
}
if (savedEmail) {
document.getElementById("profileEmail").textContent = `Email: ${savedEmail}`;
}
if (savedPhone) {
document.getElementById("profilePhone").textContent = `Phone: ${savedPhone}`;
}
if (savedBio) {
document.getElementById("profileBio").textContent = `About Me: ${savedBio}`;
}

if (savedAvatar) {
document.getElementById("profileImage").src = savedAvatar;
}
});
</script>


</body>

</html>
Loading