Connected DB to events/jobs + more
- Modified handlers.js to be the same as on frm.so - Added --trash-src to shared.css - Modified Event and Job cards to include a trash icon for deleting - Deleting works, it just does not smoothly re-render yet - Adjusted visual bug on Events/Jobs where the contents of the AppWindow would overflow vertically. They now scroll and the title/search bar remain fixed. - Refactored part of People.js into PeopleCard.js
This commit is contained in:
58
src/apps/People/PeopleCard.js
Normal file
58
src/apps/People/PeopleCard.js
Normal file
@@ -0,0 +1,58 @@
|
||||
class PeopleCard extends Shadow {
|
||||
constructor(person) {
|
||||
super()
|
||||
this.person = person
|
||||
}
|
||||
|
||||
render() {
|
||||
HStack(() => {
|
||||
HStack(() => { })
|
||||
.boxSizing("border-box")
|
||||
.height(3.5, em)
|
||||
.width(3.5, em)
|
||||
.padding(0.5, em)
|
||||
.border("1px solid var(--accent)")
|
||||
.borderRadius(100, pct)
|
||||
.background("black")
|
||||
|
||||
VStack(() => {
|
||||
h3(this.person.first_name + " " + this.person.last_name)
|
||||
.color("var(--brown)")
|
||||
.fontSize(1.2, em)
|
||||
.fontWeight("bold")
|
||||
.marginVertical(0, em)
|
||||
p("<b>Member since: </b>" + " " + this.convertDate(this.person.created))
|
||||
})
|
||||
.verticalAlign("center")
|
||||
.gap(0.5, em)
|
||||
})
|
||||
.height(3.5, em)
|
||||
.padding(0.75, em)
|
||||
.gap(1, em)
|
||||
}
|
||||
|
||||
convertDate(rawDate) {
|
||||
const parsed = new Date(rawDate);
|
||||
|
||||
if (isNaN(parsed.getTime())) return rawDate;
|
||||
|
||||
const month = parsed.toLocaleString("en-US", { month: "long", timeZone: "UTC" });
|
||||
const day = parsed.getUTCDate();
|
||||
const year = parsed.getUTCFullYear();
|
||||
|
||||
const ordinal = (n) => {
|
||||
const mod100 = n % 100;
|
||||
if (mod100 >= 11 && mod100 <= 13) return `${n}th`;
|
||||
switch (n % 10) {
|
||||
case 1: return `${n}st`;
|
||||
case 2: return `${n}nd`;
|
||||
case 3: return `${n}rd`;
|
||||
default: return `${n}th`;
|
||||
}
|
||||
};
|
||||
|
||||
return `${month} ${ordinal(day)}, ${year}`;
|
||||
}
|
||||
}
|
||||
|
||||
register(PeopleCard)
|
||||
Reference in New Issue
Block a user