mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 05:30:13 +01:00
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:
@@ -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);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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 += `
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user