feat: user profile pictures
20
main.js
|
@ -67,13 +67,25 @@ class Post {
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeaderElement() {
|
getHeaderElement() {
|
||||||
const headerElem = document.createElement(this.getHeaderTag());
|
|
||||||
headerElem.innerHTML = this.username;
|
|
||||||
|
|
||||||
const elem = document.createElement("a");
|
const elem = document.createElement("a");
|
||||||
|
|
||||||
|
// TODO: fetch current user pfp from thispersondoesnotexist and place in local storage
|
||||||
|
// for now if this person is us, post octopus
|
||||||
|
const currentUser = getCurrentUser();
|
||||||
|
const isCurrentUser = this.username == currentUser.user;
|
||||||
|
const pfpPath = isCurrentUser ? "oct.jpg" : `user/${this.username}.png`;
|
||||||
|
|
||||||
|
const pfpElem = document.createElement("img");
|
||||||
|
pfpElem.setAttribute("src", pfpPath);
|
||||||
|
pfpElem.setAttribute("class", "pfp");
|
||||||
|
elem.appendChild(pfpElem);
|
||||||
|
|
||||||
|
const usernameElem = document.createElement(this.getHeaderTag());
|
||||||
|
usernameElem.innerHTML = this.username;
|
||||||
|
|
||||||
elem.setAttribute("href", "#");
|
elem.setAttribute("href", "#");
|
||||||
elem.addEventListener("click", () => updateUserProfile(this.username));
|
elem.addEventListener("click", () => updateUserProfile(this.username));
|
||||||
elem.appendChild(headerElem);
|
elem.appendChild(usernameElem);
|
||||||
|
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,13 @@ body {
|
||||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pfp {
|
||||||
|
max-width: 64px;
|
||||||
|
max-height: 64px;
|
||||||
|
float: left;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
.post-actions {
|
.post-actions {
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
padding: 16px 0;
|
padding: 16px 0;
|
||||||
|
|
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 9.0 KiB |