Upload image

- Image upload works on profile
- added multer into package.json for handling image files
- files are saved under /db/images/users/user-id/profile.ext
This commit is contained in:
2026-03-19 20:25:23 -04:00
parent 58589c56dd
commit dd1ec2c374
5 changed files with 73 additions and 19 deletions

View File

@@ -1,19 +1,26 @@
import util from "../../util"
class PeopleCard extends Shadow {
constructor(person) {
super()
this.person = person
this.imgSrc = null
}
render() {
HStack(() => {
HStack(() => { })
.boxSizing("border-box")
.height(3, em)
.width(3, em)
.paddingHorizontal(0.5, em)
.border("1px solid var(--accent)")
.borderRadius(100, pct)
.background("var(--darkaccent)")
HStack(() => {
if (!this.imgSrc.includes("null")) {
img(this.imgSrc, "3em", "3em")
.borderRadius(100, pct)
}
})
.boxSizing("border-box")
.height(3, em)
.width(3, em)
.border("1px solid var(--accent)")
.borderRadius(100, pct)
.background("var(--darkaccent)")
VStack(() => {
p(this.person.first_name + " " + this.person.last_name)
@@ -29,6 +36,10 @@ class PeopleCard extends Shadow {
.gap(1, em)
}
connectedCallback() {
this.imgSrc = `${util.HOST}${this.person.image_path}`
}
convertDate(rawDate) {
const parsed = new Date(rawDate);