Skip to content

Commit

Permalink
updating and adding json
Browse files Browse the repository at this point in the history
  • Loading branch information
ShafiMohammad09 committed Nov 13, 2023
1 parent a656f1f commit ab8e811
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 66 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h2 class="list-heading">Email</h2>
<div>Sashank</div>
<div>22A31A43G4</div>
<div>male</div>
<div>Sashank[email protected]</div></li>
<div>sashank[email protected]</div></li>

<!-- Add more students as needed -->
</ul>
Expand Down
112 changes: 47 additions & 65 deletions scripts.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,64 @@
// Define student profiles
const studentProfiles = {
shafi: {
profilePic: 'https://media.licdn.com/dms/image/D5603AQHlArcbb7sjJw/profile-displayphoto-shrink_400_400/0/1681261689525?e=1705536000&v=beta&t=hk74kpoBTe6mwY-XOavBuq0AZ8nJldcdfwSwL77Q3kw',
name: 'Mohammad Shafi',
rollId: '22A31A43G0',
department: 'Artificial intelligence',
cgpa: 9.1,
age: 20,
grade: 'A',
adhaarNo: '1234 5678 9012',
mobNo: '+917013345662',
collegeMail: '[email protected]',
personalMail: '[email protected]',
aicteCertificates: 3,
linkedin: 'https://www.linkedin.com/in/shafi-mohammad9/',
github: 'https://github.com/ShafiMohammad09',
instagram: 'https://www.instagram.com/iam_shafi_mohammad/',
drive:'https://drive.google.com/drive/my-drive'
},
Sashank: {
name: 'P Sashank rao',
age: 18,
grade: 'A',
profilePic: 'assets/profile-assets/sashank.jpg',
adhaarNo: '9876 5432 1098',
mobNo: '+917993341023',
rollId: '22A31A43G4',
department: 'Artificial intelligence',
cgpa: 9.2,
collegeMail: '[email protected]',
personalMail: '[email protected]',
aicteCertificates: 3,
linkedin: 'https://www.linkedin.com/in/janedoe/',
github: 'https://github.com/janedoe',
instagram:'https://www.instagram.com/psashankrao/',
drive:'https://drive.google.com/drive/my-drive'

// Function to fetch student profiles
async function getStudentData() {
try {
const response = await fetch('studentData.json');
const data = await response.json();
return data;
} catch (error) {
console.error('Error fetching student data:', error);
return null;
}
// Add more profiles as needed
};
}

// Function to display student profiles

// Function to display student profiles
function showProfile(studentName) {
async function showProfile(studentName) {
const profileContainer = document.querySelector('.profile');
const studentProfiles = await getStudentData();

console.log('Loaded Student Profiles:', studentProfiles);

if (studentProfiles && studentProfiles.hasOwnProperty(studentName)) {
console.log('Selected Student:', studentProfiles[studentName]);

if (studentProfiles.hasOwnProperty(studentName)) {
const selectedStudent = studentProfiles[studentName];

// Display the profile in the profile section
profileContainer.innerHTML = `
<div class="profileCard">
<img src="${selectedStudent.profilePic}" alt="${selectedStudent.name}'s Profile" class="profilePic">
<h2>${selectedStudent.name}</h2>
<div class='social'>
<p> <span class="ans"> <a href="${selectedStudent.linkedin}" target="_blank"><img width="35" height="35" src="https://img.icons8.com/ios-filled/50/linkedin.png" alt="linkedin"/></a></span></p>
<p><span class="ans"> <a href="${selectedStudent.github}" target="_blank"><img width="35" height="35" src="https://img.icons8.com/ios-glyphs/30/github.png" alt="github"/></a></span></p>
<p><span class="ans"> <a href="${selectedStudent.instagram}" target="_blank"><img width="35" height="35" src="https://img.icons8.com/material-outlined/48/instagram-new--v1.png" alt="instagram-new--v1"/></a></span></p>
<p><span class="ans"> <a href="${selectedStudent.drive}" target="_blank"><img width="35" height="35" src="https://img.icons8.com/windows/32/google-drive.png" alt="google-drive"/></a></span></p>
</div>
<div class="profileCard-Data>
<p class="age" >Age: <span class="ans">${selectedStudent.age}</span></p>
<p>Grade: <span class="ans"> ${selectedStudent.grade}</span> </p>
<p>Adhaar No: <span class="ans"> ${selectedStudent.adhaarNo}</span> </p>
<p>Mobile No: <span class="ans"> ${selectedStudent.mobNo}</span></p>
<p>Roll ID: <span class="ans"> ${selectedStudent.rollId}</span></p>
<p>Department: <span class="ans"> ${selectedStudent.department}</span></p>
<p>CGPA: <span class="ans"> ${selectedStudent.cgpa}</span></p>
<p>College Mail: <span class="ans"> ${selectedStudent.collegeMail}</span></p>
<p>Personal Mail: <span class="ans"> ${selectedStudent.personalMail}</span></p>
<p>No. of AICTE Certificates: <span class="ans"> ${selectedStudent.aicteCertificates}</span></p>
<!-- Add more profile details as needed -->
</div>
</div>
<div class="profileCard">
<img src="${selectedStudent.profilePic}" alt="${selectedStudent.name}'s Profile" class="profilePic">
<h2>${selectedStudent.name}</h2>
<div class='social'>
<p> <span class="ans"> <a href="${selectedStudent.linkedin}" target="_blank"><img width="35" height="35" src="https://img.icons8.com/ios-filled/50/linkedin.png" alt="linkedin"/></a></span></p>
<p><span class="ans"> <a href="${selectedStudent.github}" target="_blank"><img width="35" height="35" src="https://img.icons8.com/ios-glyphs/30/github.png" alt="github"/></a></span></p>
<p><span class="ans"> <a href="${selectedStudent.instagram}" target="_blank"><img width="35" height="35" src="https://img.icons8.com/material-outlined/48/instagram-new--v1.png" alt="instagram-new--v1"/></a></span></p>
<p><span class="ans"> <a href="${selectedStudent.drive}" target="_blank"><img width="35" height="35" src="https://img.icons8.com/windows/32/google-drive.png" alt="google-drive"/></a></span></p>
</div>
<div class="profileCard-Data>
<p class="age" >Age: <span class="ans">${selectedStudent.age}</span></p>
<p>Grade: <span class="ans"> ${selectedStudent.grade}</span> </p>
<p>Adhaar No: <span class="ans"> ${selectedStudent.adhaarNo}</span> </p>
<p>Mobile No: <span class="ans"> ${selectedStudent.mobNo}</span></p>
<p>Roll ID: <span class="ans"> ${selectedStudent.rollId}</span></p>
<p>Department: <span class="ans"> ${selectedStudent.department}</span></p>
<p>CGPA: <span class="ans"> ${selectedStudent.cgpa}</span></p>
<p>College Mail: <span class="ans"> ${selectedStudent.collegeMail}</span></p>
<p>Personal Mail: <span class="ans"> ${selectedStudent.personalMail}</span></p>
<p>No. of AICTE Certificates: <span class="ans"> ${selectedStudent.aicteCertificates}</span></p>
<!-- Add more profile details as needed -->
</div>
</div>
`;
} else {
console.log('Student Profile not found for:', studentName);
profileContainer.innerHTML = `<p>Student profile not found</p>`;
}
}





document.querySelectorAll('.m-item').forEach(function(item) {
Expand Down
41 changes: 41 additions & 0 deletions studentData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"shafi": {
"profilePic": "https://media.licdn.com/dms/image/D5603AQHlArcbb7sjJw/profile-displayphoto-shrink_400_400/0/1681261689525?e=1705536000&v=beta&t=hk74kpoBTe6mwY-XOavBuq0AZ8nJldcdfwSwL77Q3kw",
"name": "Mohammad Shafi",
"rollId": "22A31A43G0",
"department": "Artificial intelligence",
"cgpa": 9.1,
"age": 20,
"grade": "A",
"adhaarNo": "1234 5678 9012",
"mobNo": "+917013345662",
"collegeMail": "[email protected]",
"personalMail": "[email protected]",
"aicteCertificates": 3,
"linkedin": "https://www.linkedin.com/in/shafi-mohammad9/",
"github": "https://github.com/ShafiMohammad09",
"instagram": "https://www.instagram.com/iam_shafi_mohammad/",
"drive": "https://drive.google.com/drive/my-drive"
},
"Sashank": {
"name": "P Sashank rao",
"age": 18,
"grade": "A",
"profilePic": "assets/profile-assets/sashank.jpg",
"adhaarNo": "9876 5432 1098",
"mobNo": "+917993341023",
"rollId": "22A31A43G4",
"department": "Artificial intelligence",
"cgpa": 9.2,
"collegeMail": "[email protected]",
"personalMail": "[email protected]",
"aicteCertificates": 3,
"linkedin": "https://www.linkedin.com/in/janedoe/",
"github": "https://github.com/janedoe",
"instagram": "https://www.instagram.com/psashankrao/",
"drive": "https://drive.google.com/drive/my-drive"
}


}

0 comments on commit ab8e811

Please sign in to comment.