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:
2026-03-15 19:45:04 -04:00
parent dde27f9b31
commit 834d5e763e
9 changed files with 160 additions and 98 deletions

View File

@@ -1,4 +1,5 @@
import util from "../../util"
import server from "../../_/code/bridge/serverFunctions.js"
class EventCard extends Shadow {
constructor(event) {
@@ -8,11 +9,23 @@ class EventCard extends Shadow {
render() {
VStack(() => {
h3(this.event.title)
.color("var(--brown)")
.fontSize(1.2, em)
.fontWeight("bold")
.marginVertical(0, em)
HStack(() => {
h3(this.event.title)
.color("var(--brown)")
.fontSize(1.2, em)
.fontWeight("bold")
.marginVertical(0, em)
if (this.event.creator_id === global.profile.id) {
img(util.cssVariable("trash-src"), "1.5em")
.marginRight(0.5, em)
.onTap(() => {
this.deleteEvent(this.event)
})
}
})
.justifyContent("space-between")
.verticalAlign("center")
HStack(() => {
img(util.cssVariable("pin-src"), "1.3em")
@@ -38,6 +51,13 @@ class EventCard extends Shadow {
.gap(0.5, em)
}
async deleteEvent(event) {
const result = await server.deleteEvent(event.id, event.network_id, global.profile.id)
if (result.data === null) {
console.log("Failed to delete event")
}
}
convertDate(rawDate) {
const parsed = new Date(rawDate);