Jobs + Events Pages
- Added Jobs/Events pages, need to set up with backend once complete - Added missing icons and fixed incorrect icons - Made AppMenu icons highlight when selected - Removed Settings from AppMenu - Fixed undefined data in People
This commit is contained in:
72
src/apps/Events/EventCard.js
Normal file
72
src/apps/Events/EventCard.js
Normal file
@@ -0,0 +1,72 @@
|
||||
import util from "../../util"
|
||||
|
||||
class EventCard extends Shadow {
|
||||
constructor(event) {
|
||||
super()
|
||||
this.event = event
|
||||
}
|
||||
|
||||
render() {
|
||||
VStack(() => {
|
||||
h3(this.event.title)
|
||||
.color("var(--brown)")
|
||||
.fontSize(1.2, em)
|
||||
.fontWeight("bold")
|
||||
.marginVertical(0, em)
|
||||
|
||||
HStack(() => {
|
||||
img(util.cssVariable("pin-src"), "1.3em")
|
||||
p(this.event.location)
|
||||
})
|
||||
.gap(0.3, em)
|
||||
.verticalAlign("center")
|
||||
|
||||
HStack(() => {
|
||||
img(util.cssVariable("time-src"), "1.2em")
|
||||
p(this.convertDate(this.event.time))
|
||||
})
|
||||
.gap(0.4, em)
|
||||
.verticalAlign("center")
|
||||
|
||||
p("<b>Description: </b>" + " " + this.event.description)
|
||||
})
|
||||
.maxHeight(12.5, em)
|
||||
.padding(0.75, em)
|
||||
.gap(0, em)
|
||||
.borderBottom("1px solid var(--divider)")
|
||||
.verticalAlign("center")
|
||||
.gap(0.5, 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 hours24 = parsed.getUTCHours();
|
||||
const minutes = parsed.getUTCMinutes();
|
||||
|
||||
const hours12 = hours24 % 12 || 12;
|
||||
const ampm = hours24 >= 12 ? "PM" : "AM";
|
||||
const paddedMinutes = String(minutes).padStart(2, "0");
|
||||
|
||||
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} at ${hours12}:${paddedMinutes} ${ampm}`;
|
||||
}
|
||||
}
|
||||
|
||||
register(EventCard)
|
||||
Reference in New Issue
Block a user