Added uploads section to single event page

This commit is contained in:
2022-07-25 03:14:40 +00:00
parent b323e3b70a
commit d342799127
2 changed files with 31 additions and 1 deletions

View File

@@ -58,8 +58,33 @@ async function main() {
if (event.location)
$event.querySelector('.event-location').appendChild(getDirectionLink(event.location));
else
$event.querySelector('.event-location').innerText = 'There is no location specified for this event';
$event.querySelector('.event-notes').innerText = event.notes ?? '';
$event.querySelector('.event-notes').innerText = event.notes ?? 'There are no notes for this event';
const uploads = $event.querySelector('.event-uploads');
if (event.uploads && event.uploads.length > 0) {
for (const { upload } of event.uploads) {
if (typeof upload === 'string') {
uploads.classList.add('text-red-600');
uploads.innerText = 'Please log in to view uploads';
break;
}
const $elem = document.createElement('a');
$elem.setAttribute('href', upload.url);
$elem.innerText = upload.filename;
$elem.classList.add('underline');
uploads.appendChild($elem);
}
} else {
uploads.innerText = 'There are no uploads for this event';
}
}
main();