Add admin dashboard and Pocket ID auth notes
All checks were successful
/ deploy (push) Successful in 42s
All checks were successful
/ deploy (push) Successful in 42s
This commit is contained in:
parent
fc5762d267
commit
06093af633
10 changed files with 947 additions and 29 deletions
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
import SiteLayout from "../components/SiteLayout.astro";
|
||||
import mainHtml from "../content/pages/events.html?raw";
|
||||
import { calendarEvents, recurringCalendarEvents } from "../data/events";
|
||||
---
|
||||
|
||||
<SiteLayout
|
||||
|
|
@ -11,7 +12,7 @@ import mainHtml from "../content/pages/events.html?raw";
|
|||
canonical="/events.html"
|
||||
>
|
||||
<Fragment set:html={mainHtml} />
|
||||
<script is:inline slot="scripts">
|
||||
<script is:inline slot="scripts" define:vars={{ calendarEvents, recurringCalendarEvents }}>
|
||||
(() => {
|
||||
const calendar = document.querySelector("[data-calendar]");
|
||||
|
||||
|
|
@ -19,18 +20,8 @@ import mainHtml from "../content/pages/events.html?raw";
|
|||
return;
|
||||
}
|
||||
|
||||
const recurringEvents = [
|
||||
{
|
||||
id: "sunday-service",
|
||||
title: "Sunday Service",
|
||||
startTime: "11:00",
|
||||
endTime: "12:00",
|
||||
location: "19 North Great Georges St., Dublin 1, Ireland",
|
||||
details: "Weekly Sunday Service video upload and community worship.",
|
||||
url: "/services.html",
|
||||
weekday: 0,
|
||||
},
|
||||
];
|
||||
const datedEvents = calendarEvents;
|
||||
const recurringEvents = recurringCalendarEvents;
|
||||
|
||||
const monthTitle = calendar.querySelector("[data-calendar-panel-title]");
|
||||
const grid = calendar.querySelector("[data-calendar-grid]");
|
||||
|
|
@ -81,6 +72,14 @@ import mainHtml from "../content/pages/events.html?raw";
|
|||
function eventsBetween(start, end) {
|
||||
const events = [];
|
||||
|
||||
for (const datedEvent of datedEvents) {
|
||||
const eventDate = fromDateKey(datedEvent.date);
|
||||
|
||||
if (eventDate >= start && eventDate <= end) {
|
||||
events.push(datedEvent);
|
||||
}
|
||||
}
|
||||
|
||||
for (let date = new Date(start); date <= end; date = addDays(date, 1)) {
|
||||
for (const recurringEvent of recurringEvents) {
|
||||
if (date.getDay() !== recurringEvent.weekday) {
|
||||
|
|
@ -88,6 +87,15 @@ import mainHtml from "../content/pages/events.html?raw";
|
|||
}
|
||||
|
||||
const dateKey = toDateKey(date);
|
||||
|
||||
if (recurringEvent.startDate && dateKey < recurringEvent.startDate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (recurringEvent.endDate && dateKey > recurringEvent.endDate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
events.push({
|
||||
...recurringEvent,
|
||||
id: `${recurringEvent.id}-${dateKey}`,
|
||||
|
|
@ -96,7 +104,7 @@ import mainHtml from "../content/pages/events.html?raw";
|
|||
}
|
||||
}
|
||||
|
||||
return events;
|
||||
return events.sort((a, b) => `${a.date} ${a.startTime} ${a.title}`.localeCompare(`${b.date} ${b.startTime} ${b.title}`));
|
||||
}
|
||||
|
||||
function formatEventTime(event) {
|
||||
|
|
@ -216,8 +224,8 @@ import mainHtml from "../content/pages/events.html?raw";
|
|||
details.textContent = event.details;
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = event.url;
|
||||
link.textContent = "Sunday Services";
|
||||
link.href = event.url || "/events.html";
|
||||
link.textContent = event.url ? "More details" : "Events";
|
||||
|
||||
item.append(date, heading, time, location, details, link);
|
||||
list.append(item);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue