-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2992 from mashehu/automate-hackathon-table
Automate hackathon location table
- Loading branch information
Showing
44 changed files
with
822 additions
and
689 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
sites/main-site/src/components/event/EventLocationsTable.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
import type { CollectionEntry } from 'astro:content'; | ||
import { getCollection } from 'astro:content'; | ||
interface Props { | ||
eventPath: string; | ||
} | ||
// Map of country names to their flag emoji for easier lookup | ||
const COUNTRIES = { | ||
Australia: '🇦🇺', | ||
Belgium: '🇧🇪', | ||
Brazil: '🇧🇷', | ||
Canada: '🇨🇦', | ||
'Czech Republic': '🇨🇿', | ||
Colombia: '🇨🇴', | ||
Denmark: '🇩🇰', | ||
Ethiopia: '🇪🇹', | ||
France: '🇫🇷', | ||
Germany: '🇩🇪', | ||
Ghana: '🇬🇭', | ||
Greece: '🇬🇷', | ||
India: '🇮🇳', | ||
Italy: '🇮🇹', | ||
Netherlands: '🇳🇱', | ||
'New Zealand': '🇳🇿', | ||
Pakistan: '🇵🇰', | ||
Poland: '🇵🇱', | ||
'South Africa': '🇿🇦', | ||
Spain: '🇪🇸', | ||
Sweden: '🇸🇪', | ||
Switzerland: '🇨🇭', | ||
Turkey: '🇹🇷', | ||
'United Kingdom': '🇬🇧', | ||
USA: '🇺🇸', | ||
} as const; | ||
const { eventPath } = Astro.props; | ||
// Get location pages for the current event | ||
const locationPages = (await getCollection('events')) | ||
.filter((page) => { | ||
const pagePath = page.id.split('/'); | ||
return !pagePath[pagePath.length - 1].includes('index.mdx') && pagePath.slice(0, -1).join('/') === eventPath; | ||
}) | ||
.map((page) => { | ||
const country = page.data.locations?.[0]?.country; | ||
return { | ||
...page, | ||
countryInfo: country | ||
? { | ||
name: country, | ||
flag: COUNTRIES[country] || '', | ||
} | ||
: undefined, | ||
}; | ||
}) | ||
.sort((a, b) => (a.countryInfo?.name ?? '').localeCompare(b.countryInfo?.name ?? '')); | ||
--- | ||
|
||
<div class="table-responsive"> | ||
<table class="table table-hover table-sm small"> | ||
<thead> | ||
<tr> | ||
<th>Country</th> | ||
<th>City</th> | ||
<th>Location</th> | ||
<th>Event page</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{ | ||
locationPages.map((page) => ( | ||
<tr class="position-relative"> | ||
<td class="text-nowrap"> | ||
{page.countryInfo?.flag} {page.countryInfo?.name} | ||
</td> | ||
<td class="text-nowrap">{page.data.locations?.[0]?.city}</td> | ||
<td>{page.data.locations?.[0]?.name}</td> | ||
<td class="text-nowrap"> | ||
<a class="stretched-link" href={`/events/${page.id.replace('.mdx', '')}`}> | ||
Read more | ||
</a> | ||
</td> | ||
</tr> | ||
)) | ||
} | ||
</tbody> | ||
</table> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.