-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
154 lines (134 loc) · 6.8 KB
/
Copy pathscript.js
File metadata and controls
154 lines (134 loc) · 6.8 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
const users = [
{ name: "Alice Johnson", title: "UI/UX Designer", avatar: "user1.png" },
{ name: "Michael Brown", title: "Software Engineer", avatar: "user2.png" },
{ name: "Sarah Lee", title: "Marketing Manager", avatar: "user3.png" }
];
// Sample jobs data
const jobs = [
{ title: "Frontend Developer", company: "Tech Corp", location: "New York, USA" },
{ title: "Data Scientist", company: "AI Solutions", location: "San Francisco, USA" },
{ title: "Marketing Executive", company: "Global Media", location: "London, UK" }
];
// Sample messages and notifications
const messages = [
{ sender: "Alice Johnson", content: "Hey! Are you available for a project?" },
{ sender: "Michael Brown", content: "Let's connect and collaborate!" }
];
const notifications = [
{ content: "Your job application has been viewed by Tech Corp." },
{ content: "Michael Brown sent you a connection request." }
];
function login() {
document.getElementById("login-page").style.display = "none";
document.getElementById("dashboard").style.display = "block";
loadUserProfile();
}
function logout() {
document.getElementById("login-page").style.display = "block";
document.getElementById("dashboard").style.display = "none";
}
function toggleSidebar() {
const sidebar = document.getElementById("sidebar");
sidebar.classList.toggle("collapsed");
}
function loadUserProfile() {
const userName = localStorage.getItem("userName") || "John Doe";
const userEmail = localStorage.getItem("userEmail") || "john.doe@example.com";
document.getElementById("user-name").textContent = userName;
// Check if user-title exists before setting it
const userTitleElement = document.getElementById("user-title");
if (userTitleElement) {
userTitleElement.textContent = localStorage.getItem("userTitle") || "Software Developer";
}
// Set user email if element exists
const userEmailElement = document.getElementById("user-email");
if (userEmailElement) {
userEmailElement.textContent = userEmail;
}
}
// Load user details on page load
window.onload = function() {
loadUserProfile();
// Check if user is already logged in (using sessionStorage)
const currentUser = sessionStorage.getItem('currentUser');
if (currentUser) {
document.getElementById("login-page").style.display = "none";
document.getElementById("dashboard").style.display = "block";
}
};
function loadPage(page) {
let content = "";
if (page === "network") {
content = `<h2>My Network</h2><div class='network-container'>`;
users.forEach(user => {
content += `
<div class='connection-card'>
<img src='${user.avatar}' alt='${user.name}'>
<h4>${user.name}</h4>
<p>${user.title}</p>
<button>Add Connection</button>
</div>
`;
});
content += `</div>`;
} else if (page === "jobs") {
content = "<h2>Available Jobs</h2><div class='jobs-container'>";
jobs.forEach(job => {
content += `
<div class='job-card'>
<h3>${job.title}</h3>
<p>${job.company} - ${job.location}</p>
<button class="apply-button">Apply</button>
</div>
`;
});
content += "</div>";
} else if (page === "messages") {
content = "<h2>Messages</h2><div class='messages-container'>";
messages.forEach(msg => {
content += `
<div class='message-card'>
<p><strong>${msg.sender}:</strong> ${msg.content}</p>
</div>
`;
});
content += "</div>";
} else if (page === "notifications") {
content = "<h2>Notifications</h2><div class='notifications-container'>";
notifications.forEach(notif => {
content += `
<div class='notification-card'>
<p>${notif.content}</p>
</div>
`;
});
content += "</div>";
} else if (page === "saved-jobs") {
content = "<h2>Saved Jobs</h2><p>No saved jobs yet.</p>";
} else if (page === "settings") {
content = "<h2>Settings</h2><p>Manage your account settings here.</p>";
}
document.getElementById("main-content").innerHTML = content;
toggleSidebar();
}
// Edit Profile Functions
function editProfile() {
document.getElementById("edit-name").value = localStorage.getItem("userName") || "";
document.getElementById("edit-title").value = localStorage.getItem("userTitle") || "";
document.getElementById("edit-email").value = localStorage.getItem("userEmail") || "";
document.getElementById("edit-phone").value = localStorage.getItem("userPhone") || "";
document.getElementById("edit-location").value = localStorage.getItem("userLocation") || "";
document.getElementById("edit-profile-modal").style.display = "block";
}
function saveProfile() {
localStorage.setItem("userName", document.getElementById("edit-name").value);
localStorage.setItem("userTitle", document.getElementById("edit-title").value);
localStorage.setItem("userEmail", document.getElementById("edit-email").value);
localStorage.setItem("userPhone", document.getElementById("edit-phone").value);
localStorage.setItem("userLocation", document.getElementById("edit-location").value);
loadUserProfile();
closeProfileModal();
}
function closeProfileModal() {
document.getElementById("edit-profile-modal").style.display = "none";
}