feat: show slightly more information in event list view

instead of event title and organizer, we now also show place and date
This commit is contained in:
2025-06-02 00:37:47 +02:00
parent 42fd94e5ac
commit 271bf84467
4 changed files with 21 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
import { getEvent, getMyAccount, unhideElementById } from './generalUseHelpers.js'; import { getEvent, getMyAccount, unhideElementById } from './generalUseHelpers.js';
var isAscending: boolean = false; var isAscending: boolean = false;
@@ -57,10 +57,17 @@ async function loadEvents(org_id: number, evs?: Promise<any>) {
//card.innerHTML = ` //card.innerHTML = `
// <span>${ev.title}</span>` // <span>${ev.title}</span>`
// Do odkomentowania kiedy widok podglądu wydarzeń będzie gotowy // Do odkomentowania kiedy widok podglądu wydarzeń będzie gotowy
let formattedDate: string = new Intl.DateTimeFormat('en-US', {
weekday: 'long', // "Monday"
year: 'numeric', // "2023"
month: 'long', // "December"
day: 'numeric' // "1"
}).format(ev.eventDate);
console.log(formattedDate);
card.innerHTML = ` card.innerHTML = `
<span> <span>
<a href="/view.html?event=${ev.eventId}" style="color: #2898BD">${ev.title}</a> <a href="/view.html?event=${ev.eventId}" style="color: #2898BD">${ev.title}</a>
<p style="margin: 0">${ev.organisation}</p> <p style="margin: 0">${ev.organisation} | ${ev.location} | ${formattedDate}</p>
</span>` </span>`
if (org_id == ev.organisationId) { if (org_id == ev.organisationId) {
card.innerHTML += ` card.innerHTML += `
@@ -118,4 +125,4 @@ document.addEventListener("DOMContentLoaded", async () => {
loadEvents(org_id, searchResults); loadEvents(org_id, searchResults);
} }
}) })
}); });

View File

@@ -36,7 +36,7 @@ export async function getEvent(id: string): Promise<EventData> {
export async function getMyAccount(): Promise<MyAccount> { export async function getMyAccount(): Promise<MyAccount> {
const res = await fetch("/api/auth/my_account"); const res = await fetch("/api/auth/my_account");
if (!res.ok) { if (!res.ok) {
throw Error("U<EFBFBD>ytkownik niezalogowany!"); throw Error("Użytkownik niezalogowany!");
} }
const data = await res.json(); const data = await res.json();
return data; return data;

View File

@@ -59,13 +59,18 @@ function loadEvents(org_id, evs) {
for (const ev of events) { for (const ev of events) {
const card = document.createElement("div"); const card = document.createElement("div");
card.className = "event-card filled"; card.className = "event-card filled";
//card.innerHTML = `
// <span>${ev.title}</span>` let formattedDate = new Intl.DateTimeFormat('en-US', {
// Do odkomentowania kiedy widok podglądu wydarzeń będzie gotowy weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric' // "1"
}).format(new Date(ev.eventDate));
card.innerHTML = ` card.innerHTML = `
<span> <span>
<a href="/view.html?event=${ev.eventId}" style="color: #2898BD">${ev.title}</a> <a href="/view.html?event=${ev.eventId}" style="color: #2898BD">${ev.title}</a>
<p style="margin: 0">${ev.organisation}</p> <p style="margin: 0">👥 ${ev.organisation} | 📍 ${ev.location} | 📅 ${formattedDate}</p>
</span>`; </span>`;
if (org_id == ev.organisationId) { if (org_id == ev.organisationId) {
card.innerHTML += ` card.innerHTML += `

View File

@@ -29,7 +29,7 @@ export function getMyAccount() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const res = yield fetch("/api/auth/my_account"); const res = yield fetch("/api/auth/my_account");
if (!res.ok) { if (!res.ok) {
throw Error("U<EFBFBD>ytkownik niezalogowany!"); throw Error("Użytkownik niezalogowany!");
} }
const data = yield res.json(); const data = yield res.json();
return data; return data;