diff --git a/components/CardEventSlot.vue b/components/CardEventSlot.vue
new file mode 100644
index 0000000..f773fa1
--- /dev/null
+++ b/components/CardEventSlot.vue
@@ -0,0 +1,68 @@
+
+
+
+
+ {{ event?.name }}
+
+ {{ formatTime(slot.start) }} - {{ formatTime(slot.end) }}
+
+
+ {{ event?.description ?? "No description provided" }}
+
+ At {{ locations.map(location => location?.name ?? "unknown").join(" + ") }}
+
+
+ {{ event?.interested }}
+
+ + {{ slot.interested }}
+
+ interested
+
+
+ Crew:
+ {{ [...slot.assigned].map(id => usersStore.users.get(id)?.name).join(", ") }}
+
+
+
+
+
+
+
diff --git a/components/Header.vue b/components/Header.vue
index fd79684..c0e5952 100644
--- a/components/Header.vue
+++ b/components/Header.vue
@@ -9,6 +9,9 @@
Home
+
+ Events
+
Schedule
diff --git a/pages/events.vue b/pages/events.vue
new file mode 100644
index 0000000..6598c45
--- /dev/null
+++ b/pages/events.vue
@@ -0,0 +1,89 @@
+
+
+
+ Events
+
+
+
+
+
+
diff --git a/pages/schedule.vue b/pages/schedule.vue
index 4e73964..393abaf 100644
--- a/pages/schedule.vue
+++ b/pages/schedule.vue
@@ -4,7 +4,7 @@
-->
- Schedule & Events
+ Schedule
Study carefully, we only hold these events once a year.
@@ -46,10 +46,15 @@
Events
-
+ Hide past events
+
+
+
Shifts
@@ -91,6 +96,17 @@ const filter = computed({
}),
});
+const hidePastEvents = computed({
+ get: () => !queryToBoolean(route.query.showPast),
+ set: (value: boolean) => navigateTo({
+ path: route.path,
+ query: {
+ ...route.query,
+ showPast: value ? undefined : null,
+ },
+ }),
+});
+
const eventSlotFilter = computed(() => {
if (filter.value === undefined || !accountStore.valid || schedule.value.deleted) {
return () => true;
@@ -130,4 +146,15 @@ const shiftSlotFilter = computed(() => {
}
return () => false;
});
+
+const eventSlots = computed(() => {
+ let slots = [...schedule.value.eventSlots.values()].filter(slot => !slot.deleted && eventSlotFilter.value(slot));
+ if (hidePastEvents.value) {
+ const nowMs = Date.now();
+ slots = slots.filter(slot => slot.end.toMillis() >= nowMs);
+ }
+ slots.sort((a, b) => a.start.toMillis() - b.start.toMillis() || a.end.toMillis() - b.end.toMillis());
+ return slots.map(slot => ({ slot, event: schedule.value.events.get(slot.eventId!) }));
+});
+
diff --git a/utils/functions.ts b/utils/functions.ts
index 53a47f7..df5fce4 100644
--- a/utils/functions.ts
+++ b/utils/functions.ts
@@ -21,6 +21,12 @@ export function queryToNumber(item?: null | LocationQueryValue | LocationQueryVa
return Number.parseInt(item, 10);
}
+export function queryToBoolean(item?: null | LocationQueryValue | LocationQueryValue[]) {
+ if (item === undefined)
+ return false;
+ return true;
+}
+
export function idMap(entities: T[]) {
return new Map(entities.map(entity => [entity.id, entity]));
}