diff --git a/src/components/Event.js b/src/components/Event.js index 2104edc..e02b187 100644 --- a/src/components/Event.js +++ b/src/components/Event.js @@ -13,14 +13,42 @@ const cats = [ id: 43, title: 'Online meetup', color: '#FCF9BE' + }, + { + id: 49, + title: 'Meetup (komunita)', + color: '#CFFDE1' } ] +const langs = { + "česky": { emoji: "🇨🇿" }, + "anglicky": { emoji: "🇬🇧" } +} + +function renderLangs (e) { + let arr = [] + for (const lang of Object.keys(langs)) { + if (e.tags.includes(lang)) { + arr.push(langs[lang].emoji) + } + } + return arr +} + + export default function Event({ event }) { if (!event) { return null } const e = event + const placeMatch = e.title.match(/^([^@]+)@(.+)$/) + if (placeMatch) { + e.title = placeMatch[1] + e.place = placeMatch[2] + } + e.langs = renderLangs(e) + const start = new Date(e.start) const url = "https://forum.gwei.cz/t/" + e.slug + "/" + e.id let cat = cats.find(c => c.id === e.category_id) @@ -41,9 +69,17 @@ export default function Event({ event }) {