From 271bf84467547557d7226d43d050456b31e18bbb Mon Sep 17 00:00:00 2001 From: eee4 <41441600+eee4@users.noreply.github.com> Date: Mon, 2 Jun 2025 00:37:47 +0200 Subject: [PATCH] feat: show slightly more information in event list view instead of event title and organizer, we now also show place and date --- WebApp/ts/eventList.ts | 13 ++++++++++--- WebApp/ts/generalUseHelpers.ts | 2 +- WebApp/wwwroot/js/eventList.js | 13 +++++++++---- WebApp/wwwroot/js/generalUseHelpers.js | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/WebApp/ts/eventList.ts b/WebApp/ts/eventList.ts index 4833a8d..52e1e4e 100644 --- a/WebApp/ts/eventList.ts +++ b/WebApp/ts/eventList.ts @@ -1,4 +1,4 @@ -import { getEvent, getMyAccount, unhideElementById } from './generalUseHelpers.js'; +import { getEvent, getMyAccount, unhideElementById } from './generalUseHelpers.js'; var isAscending: boolean = false; @@ -57,10 +57,17 @@ async function loadEvents(org_id: number, evs?: Promise) { //card.innerHTML = ` // ${ev.title}` // 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 = ` ${ev.title} -

${ev.organisation}

+

${ev.organisation} | ${ev.location} | ${formattedDate}

` if (org_id == ev.organisationId) { card.innerHTML += ` @@ -118,4 +125,4 @@ document.addEventListener("DOMContentLoaded", async () => { loadEvents(org_id, searchResults); } }) -}); \ No newline at end of file +}); diff --git a/WebApp/ts/generalUseHelpers.ts b/WebApp/ts/generalUseHelpers.ts index 8e24a74..f7854bb 100644 --- a/WebApp/ts/generalUseHelpers.ts +++ b/WebApp/ts/generalUseHelpers.ts @@ -36,7 +36,7 @@ export async function getEvent(id: string): Promise { export async function getMyAccount(): Promise { const res = await fetch("/api/auth/my_account"); if (!res.ok) { - throw Error("U�ytkownik niezalogowany!"); + throw Error("Użytkownik niezalogowany!"); } const data = await res.json(); return data; diff --git a/WebApp/wwwroot/js/eventList.js b/WebApp/wwwroot/js/eventList.js index 1fc02dd..7d85f66 100644 --- a/WebApp/wwwroot/js/eventList.js +++ b/WebApp/wwwroot/js/eventList.js @@ -59,13 +59,18 @@ function loadEvents(org_id, evs) { for (const ev of events) { const card = document.createElement("div"); card.className = "event-card filled"; - //card.innerHTML = ` - // ${ev.title}` - // Do odkomentowania kiedy widok podglądu wydarzeń będzie gotowy + + let formattedDate = new Intl.DateTimeFormat('en-US', { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric' // "1" + }).format(new Date(ev.eventDate)); + card.innerHTML = ` ${ev.title} -

${ev.organisation}

+

👥 ${ev.organisation} | 📍 ${ev.location} | 📅 ${formattedDate}

`; if (org_id == ev.organisationId) { card.innerHTML += ` diff --git a/WebApp/wwwroot/js/generalUseHelpers.js b/WebApp/wwwroot/js/generalUseHelpers.js index 264c476..86e45b7 100644 --- a/WebApp/wwwroot/js/generalUseHelpers.js +++ b/WebApp/wwwroot/js/generalUseHelpers.js @@ -29,7 +29,7 @@ export function getMyAccount() { return __awaiter(this, void 0, void 0, function* () { const res = yield fetch("/api/auth/my_account"); if (!res.ok) { - throw Error("U�ytkownik niezalogowany!"); + throw Error("Użytkownik niezalogowany!"); } const data = yield res.json(); return data;