aboutsummaryrefslogtreecommitdiffstats
path: root/pages/agenda.vue
blob: 3e4c1df0b7a00bcb4e2c8d90c14f86a0cb81393d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<script setup lang="ts">
import Panel from '~/components/Panel.vue';


const favouritesStore = useFavouritesStore();
const scheduleStore = useScheduleStore();

const favouriteEvents = computed(() => {
  return scheduleStore.events.filter((event) => favouritesStore.isFavourite(event));
});

console.log(favouriteEvents.value);

</script>

<template>
  <Panel v-if="favouritesStore.status === 'pending'">
    <span>Updating favourites...</span>
  </Panel>
  <Panel v-else-if="favouriteEvents.length > 0">
    <h2 class="agenda-title">Agenda</h2>
    <ul class="agenda-list">
      <li 
        v-for="event in favouriteEvents" 
        :key="event.id" 
        class="agenda-item"
      >
        <EventListing :event="event" />
      </li>
    </ul>
  </Panel>
  <Panel v-else>
    <span>You have not added any favourites yet.</span>
  </Panel>
</template>

<style scoped>
.agenda-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.agenda-item {
  border-bottom: 1px solid var(--color-background-muted); 
}

.agenda-title {
  margin-bottom: 1rem;
}

.agenda-item:last-child {
  border-bottom: none; 
}

</style>