Add event + add job form

- Modified handlers to catch errors
- Added placeholder "No location added", etc. messages to Job/Event cards
- Added EventForm.js and JobForm.js for adding
- EventForm and JobForm are animated to slide up from bottom
- Modified openProfile/closeProfile logic
- Fixed SidebarItem().onClick() firing twice bug (switched to .onTap)
- Profile is now animated to slide up from the bottom
This commit is contained in:
2026-03-19 15:32:51 -04:00
parent 8dd2312aa0
commit 58589c56dd
11 changed files with 532 additions and 151 deletions

View File

@@ -42,48 +42,57 @@ class Jobs extends Shadow {
}
render() {
VStack(() => {
ZStack(() => {
// JobForm()
SearchBar(this.searchText)
JobForm()
VStack(() => {
if (!this.jobs || this.jobs == []) {
LoadingCircle()
} else if (this.searchText) {
if (this.searchedJobs.length > 0) {
for (let i = 0; i < this.searchedJobs.length; i++) {
JobCard(this.searchedJobs[i])
SearchBar(this.searchText)
VStack(() => {
if (!this.jobs || this.jobs == []) {
LoadingCircle()
} else if (this.searchText) {
if (this.searchedJobs.length > 0) {
for (let i = 0; i < this.searchedJobs.length; i++) {
JobCard(this.searchedJobs[i])
}
} else {
h2("Could not find any jobs with your search criteria.")
.color("var(--divider)")
.fontWeight("bold")
.marginTop(7.5, em)
.marginBottom(0.5, em)
.textAlign("center")
}
} else if (this.jobs.length > 0) {
for (let i = 0; i < this.jobs.length; i++) {
JobCard(this.jobs[i])
}
} else {
h2("Could not find any jobs with your search criteria.")
.color("var(--divider)")
.fontWeight("bold")
.marginTop(7.5, em)
.marginBottom(0.5, em)
.textAlign("center")
h2("No Jobs")
.color("var(--divider)")
.fontWeight("bold")
.marginTop(7.5, em)
.marginBottom(0.5, em)
.textAlign("center")
}
} else if (this.jobs.length > 0) {
for (let i = 0; i < this.jobs.length; i++) {
JobCard(this.jobs[i])
}
} else {
h2("No Jobs")
.color("var(--divider)")
.fontWeight("bold")
.marginTop(7.5, em)
.marginBottom(0.5, em)
.textAlign("center")
}
})
.overflowY("scroll")
.gap(0.75, em)
})
.overflowY("scroll")
.gap(0.75, em)
.boxSizing("border-box")
.height(100, pct)
.width(100, pct)
.onEvent("jobsearch", this.onJobSearch)
.onEvent("new-job", this.onNewJob)
})
.boxSizing("border-box")
.height(100, pct)
.width(100, pct)
.onEvent("jobsearch", this.onJobSearch)
}
onNewJob = (e) => {
let newJob = e.detail.job;
this.jobs.push(newJob)
this.rerender()
}
onJobSearch = (e) => {
@@ -112,22 +121,22 @@ class Jobs extends Shadow {
this.rerender()
}
}
connectedCallback() {
this.getJobs(global.currentNetwork.id)
}
checkForUpdates(currentJobs, fetchedJobs) {
if (currentJobs.length !== fetchedJobs.length) return true;
const currentMap = new Map(currentJobs.map(job => [job.id, job]));
for (const fetchedJob of fetchedJobs) {
const currentJob = currentMap.get(fetchedJob.id);
// new job added
if (!currentJob) return true;
// existing job changed
if (currentJob.updated_at !== fetchedJob.updated_at) {
return true;