aboutsummaryrefslogtreecommitdiffstats
path: root/components/Sidebar.vue
blob: 5fc42d376d6c232115d003b0c28f0dd727ad05b5 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<script setup lang="ts">
import { formatDistanceToNow } from "date-fns";
import { LucideClock, LucideRadio } from "lucide-vue-next";

const scheduleStore = useScheduleStore();
const errorStore = useErrorStore();

const timer = ref();
const startsIn = ref();
const ongoing = ref(false);
const finished = ref(false);

onMounted(() => {
  startsIn.value = formatDistanceToNow(scheduleStore.getStartDate());
  ongoing.value = scheduleStore.isConferenceOngoing();
  finished.value = scheduleStore.isConferenceFinished();

  timer.value = setInterval(() => {
    startsIn.value = formatDistanceToNow(scheduleStore.getStartDate());
    ongoing.value = scheduleStore.isConferenceOngoing();
    finished.value = scheduleStore.isConferenceFinished();
  }, 1000);
});

onBeforeUnmount(() => {
  clearInterval(timer.value);
});

</script>

<template>
  <div class="sidebar">
    <Panel class="conference">
      <span class="conference-title">{{ scheduleStore.schedule?.conference.title }}</span>
      <span class="conference-venue">{{ scheduleStore.schedule?.conference.venue }}</span>
      <span class="conference-city">{{ scheduleStore.schedule?.conference.city }}</span>
      
      <Button kind="secondary" @click="errorStore.setError('This doesn\'t do anything yet :-)')">Change conference</Button>
    </Panel>
    
    <Panel kind="success" class="ongoing" v-if="ongoing">
      <span>This conference is ongoing</span>
      <Button kind="primary" :icon="LucideRadio" @click="navigateTo('/live')">View live</Button>
    </Panel> 

    <Panel kind="error" class="finished" v-else-if="finished">
      <span>This conference has finished</span>
    </Panel> 
    
    <Panel class="upcoming" v-else>
      <span class="text-icon"><LucideClock /> <span>Starts in {{ startsIn }}</span></span>
    </Panel>
    
    <Nav />

    <div class="info">
      <span>Times listed are in local time ({{ scheduleStore.schedule?.conference.timeZoneName }})</span>
      
      <Version />
    </div>
  </div>
</template>

<style scoped>
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.finished, .ongoing, .upcoming {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  font-size: var(--text-small);
  font-style: oblique;
  text-align: center;
}

.ongoing button {
  width: 100%;
}

.finished svg, .ongoing svg, .upcoming svg{
  height: var(--text-small)  ;
  width: var(--text-small);
}

.conference {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conference-title {
  font-weight: 600;
  font-size: var(--text-normal);
}

.conference-venue, .conference-city {
  font-size: var(--text-small);
  color: var(--color-text-muted);
}

.info {
  font-size: var(--text-smaller);
  color: var(--color-text-muted);
  margin: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
  
</style>