diff --git a/src/css/base/modal.css b/src/css/base/modal.css index 16ed1312070..6e11441a1e1 100644 --- a/src/css/base/modal.css +++ b/src/css/base/modal.css @@ -73,7 +73,7 @@ border: 1px solid var(--color-border-light); border-radius: var(--border-radius); padding: var(--modal-space); - max-width: 620px; + max-width: 720px; } & h2 { diff --git a/src/css/sections/meetups.css b/src/css/sections/meetups.css index f1b45eafcac..06d73051984 100644 --- a/src/css/sections/meetups.css +++ b/src/css/sections/meetups.css @@ -101,7 +101,7 @@ & .links { display: flex; flex-wrap: wrap; - gap: var(--space-xl); + gap: var(--space-l); } } diff --git a/src/includes/mixins.pug b/src/includes/mixins.pug index 0b2f62dd9de..53315d25cda 100644 --- a/src/includes/mixins.pug +++ b/src/includes/mixins.pug @@ -40,12 +40,12 @@ mixin member(m) !=markdown(m.text) mixin map(id, markers) + - const modalId = `modal-${id}` .vectorMap(id=id) - +modal(`modal-${id}`): #meeptupDetails + +modal(modalId): #meeptupDetails script. const markers = [!{markers}]; - const modalId = 'modal-meetupMap'; - const $modal = document.getElementById(modalId); + const modalId = "!{modalId}"; // https://jvectormap.com/documentation/javascript-api/jvm-map/ new jvm.MultiMap({ container: $(`#!{id}`), @@ -67,34 +67,7 @@ mixin map(id, markers) } }, onMarkerClick(event, index) { - const m = markers[index] - const city = m.city ? m.city.trim() : '' - const date = m.event ? new Date(`${m.event.start}Z`) : null - const webUrl = m.url != m.websiteUrl ? m.websiteUrl : null - const twitterUrl = m.twitter ? `https://twitter.com/${m.twitter}` : null - const title = m.name + (city && !m.name.includes(city) ? ` (${city})` : '') - const urlTitle = m.url.includes('t.me/') - ? 'Telegram' - : m.url.includes('meetup.com/') ? 'Meetup.com' : 'Website' - const link = (url, title) => url ? `${title}` : '' - document.getElementById('meeptupDetails').innerHTML = ` -

${title}

- ` + (m.event ? ` -

Nächstes Treffen

-

${formatDate(date)}${m.event.location ? ` @ ${m.event.location}` : ''}

- ${m.event.description ? `

${m.event.description.replace('\n', '
')}

` : ''} - ` : '') - - toggleModal(modalId) + onMeetupMapMarkerClick(markers[index], modalId) } }, mapUrlByCode(code, multiMap) { diff --git a/static/js/main.js b/static/js/main.js index 3621a9d8958..9ea4c3339d8 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1,8 +1,6 @@ const shuffle = arr => { for (let i = arr.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * i); const temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; }; return arr } -const formatDate = date => { - const [day, time] = date.toISOString().split('T') - return day.split('-').reverse().join('.') + (time ? ` um ${time.replace(':00.000Z', ' Uhr')}` : '') -} +const dateFormat = new Intl.DateTimeFormat('de-DE', { dateStyle: 'full', timeStyle: 'short', timeZone: 'Europe/Berlin' }) +const formatDate = date => dateFormat.format(date) + ' Uhr' // Theme Switch const COLOR_MODES = ["light", "dark"] @@ -44,7 +42,6 @@ const copyToClipboard = (e, text) => { const toggleModal = modalId => { const $modal = document.getElementById(modalId) - console.log($modal, modalId) const isVisible = $modal.classList.contains('modal--visible') if (isVisible) { $modal.addEventListener('transitionend', () => { $modal.classList.toggle('modal--visible') }, { once: true }) @@ -55,6 +52,39 @@ const toggleModal = modalId => { } } +const onMeetupMapMarkerClick = (m, modalId) => { + console.log(modalId, m) + const city = m.city ? m.city.trim() : '' + const date = m.event ? new Date(`${m.event.start}Z`) : null + const webUrl = m.url != m.websiteUrl ? m.websiteUrl : null + const twitterUrl = m.twitter ? `https://twitter.com/${m.twitter}` : null + const title = m.name + (city && !m.name.includes(city) ? ` (${city})` : '') + const urlTitle = m.url.includes('t.me/') + ? 'Telegram' + : m.url.includes('meetup.com/') ? 'Meetup.com' : 'Website' + const link = (url, title) => url ? `${title}` : '' + document.getElementById('meeptupDetails').innerHTML = ` +

${title}

+ ` + (m.event ? ` +

Nächstes Treffen

+

${formatDate(date)}${m.event.location ? ` @ ${m.event.location}` : ''}

+ ${m.event.description ? `

${m.event.description.replace('\n', '
')}

` : ''} + ` : '') + + toggleModal(modalId) +} + document.addEventListener("DOMContentLoaded", () => { // Topbar if (