From 5d162cb8e0f5d594905a56a9b16f4f68df5f6631 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Tue, 21 Jan 2025 01:21:09 +0000 Subject: Improve frontend --- app.vue | 4 +-- assets/css/main.css | 11 +++++++- components/Button.vue | 71 +++++++++++++++++++++++++++++--------------------- components/Nav.vue | 4 +-- components/Panel.vue | 29 ++++++++++++++++++--- components/Sidebar.vue | 43 +++++++++++++++++++++++++++++- layouts/default.vue | 12 +++++++-- pages/agenda.vue | 2 +- pages/live.vue | 13 +++++++++ stores/error.ts | 6 ++--- stores/schedule.ts | 33 +++++++++++++++-------- 11 files changed, 173 insertions(+), 55 deletions(-) create mode 100644 pages/live.vue diff --git a/app.vue b/app.vue index e05aae2..236bbb8 100644 --- a/app.vue +++ b/app.vue @@ -3,9 +3,9 @@ diff --git a/assets/css/main.css b/assets/css/main.css index 88b8e3e..1ece5c0 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -5,7 +5,8 @@ --color-accent: #6366f1; --color-primary: #4f46e5; --color-primary-dark: #4338ca; - --color-error: #ff4136; + --color-error: #f8d7da; + --color-success: #d1e7dd; --color-text: #000; --color-text-muted: #4b5563; --color-background-muted: #f3f4f6; @@ -13,6 +14,8 @@ --color-background-error: #cf2f27; --color-background-error-dark: #c12820; --color-border: #d1d9e0; + --color-border-error: #f1aeb5; + --color-border-success: #a3cfbb; --color-favourite: #f6e05e; --text-smaller: 0.75rem; @@ -77,4 +80,10 @@ ul { list-style-position: inside; margin: 0.5rem 0 1rem 1rem; line-height: 1.3; +} + +span.text-icon { + display: flex; + align-items: centerg; + gap: 0.4em; } \ No newline at end of file diff --git a/components/Button.vue b/components/Button.vue index 00cc1e7..97ff928 100644 --- a/components/Button.vue +++ b/components/Button.vue @@ -1,9 +1,33 @@ - - - \ No newline at end of file diff --git a/components/Sidebar.vue b/components/Sidebar.vue index 755f200..9366696 100644 --- a/components/Sidebar.vue +++ b/components/Sidebar.vue @@ -1,5 +1,21 @@ - \ No newline at end of file diff --git a/stores/error.ts b/stores/error.ts index 19ff289..dfb5850 100644 --- a/stores/error.ts +++ b/stores/error.ts @@ -2,9 +2,9 @@ import { type Event } from "./schedule"; import { defineStore } from "pinia"; export const useErrorStore = defineStore('error', () => { - const error = ref(null as Event | null) - const setError = (event: Event) => { - error.value = event + const error = ref(null as string | null) + const setError = (newError: string) => { + error.value = newError } const clearError = () => { error.value = null diff --git a/stores/schedule.ts b/stores/schedule.ts index b1bf536..df2c1ec 100644 --- a/stores/schedule.ts +++ b/stores/schedule.ts @@ -81,20 +81,14 @@ export const useScheduleStore = defineStore('schedule', () => { const tracks = ref({} as { [key: string]: Track }) const setSchedule = (newSchedule: Schedule) => { - schedule.value = newSchedule - - console.log(newSchedule) - tracks.value = {} - schedule.value.tracks.forEach(track => { + newSchedule.tracks.forEach(track => { track.slug = convertToSlug(track.name) tracks.value[track.name] = track }); - console.log("hi") - events.value = [] - schedule.value.days.forEach(day => { + newSchedule.days.forEach(day => { day.start = new TZDate(day.start, newSchedule.conference.timeZoneName) day.end = new TZDate(day.end, newSchedule.conference.timeZoneName) day.rooms.forEach(room => { @@ -111,8 +105,7 @@ export const useScheduleStore = defineStore('schedule', () => { return a.start.getTime() - b.start.getTime() }) - console.log("hi2") - console.log(newSchedule) + schedule.value = newSchedule eventsPerDay.value = {} events.value.forEach(event => { @@ -132,7 +125,25 @@ export const useScheduleStore = defineStore('schedule', () => { }); } - return {schedule, events, eventsPerDay, eventsPerTrack, setSchedule} + const isConferenceOngoing = () => { + if (!schedule.value) { + return false + } + return new Date() >= schedule.value.conference.start && new Date() < schedule.value.conference.end + } + + const isConferenceFinished = () => { + if (!schedule.value) { + return false + } + return new Date() > schedule.value.conference.end + } + + const getStartDate = () => { + return schedule.value?.conference.start || 0 + } + + return {schedule, events, eventsPerDay, eventsPerTrack, setSchedule, isConferenceOngoing, isConferenceFinished, getStartDate} }) function normalizeDates(event: Event, timeZone: string) { -- cgit v1.2.3-70-g09d2