Skip to content

Commit

Permalink
fix event frontmatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Oct 15, 2024
1 parent 3d3ad7c commit 44f7e14
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/event.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ body:
attributes:
label: Mode
options:
- On-site
- Online
- Hybrid
- OnlineEventAttendanceMode
- OfflineEventAttendanceMode
- MixedEventAttendanceMode
- type: dropdown
id: category
attributes:
Expand Down
4 changes: 2 additions & 2 deletions src/components/events/EventInfoList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InlineIcon } from '@iconify/react';
import { type ReducedEvent, formatterDate, formatterTime } from '~/util/EventUtil';
import { type ReducedEvent, formatterDate, formatterTime, getHumanReadableAttendanceMode } from '~/util/EventUtil';

interface AdditionalListElements {
__html: string;
Expand Down Expand Up @@ -47,7 +47,7 @@ export default function EventInfoList({event, additional}: Props) {
<li className="flex items-center gap-2">
<InlineIcon icon="tabler:info-square-rounded" className="text-xl" aria-label="Info" />
<span>
{event.data.category} | {event.data.mode}
{event.data.category} | {getHumanReadableAttendanceMode(event.data.mode)}
</span>
</li>
{/* audience */}
Expand Down
4 changes: 2 additions & 2 deletions src/content/events/2024-10-21_HandsOn-FAIR-RDM.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
date: 2024-10-09
title: Hands-on Workshop on FAIR Data Management Using ARCs
category: Training
excerpt: "The workshop covers the fundamentals of research data management and the principles of FAIR data."
description: "The workshop covers the fundamentals of research data management and the principles of FAIR data."
when:
start: 2024-10-21T09:30:00
end: 2024-10-23T15:00:00
mode: Online
mode: OnlineEventAttendanceMode
tutors:
- Bianca Laker
organizer:
Expand Down
13 changes: 13 additions & 0 deletions src/util/EventUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ import type { CollectionEntry } from 'astro:content';

type ExtractDateFn<T> = (item: T) => Date;

export function getHumanReadableAttendanceMode(mode: 'OfflineEventAttendanceMode' | 'OnlineEventAttendanceMode' | 'MixedEventAttendanceMode'): string {
switch (mode) {
case 'OfflineEventAttendanceMode':
return 'In-person';
case 'OnlineEventAttendanceMode':
return 'Online';
case 'MixedEventAttendanceMode':
return 'Hybrid Event';
default:
return 'Unknown Event Attendance Mode';
}
}

export const formatterDate = new Intl.DateTimeFormat('de-DE', { timeZone: 'Europe/Berlin', day: "2-digit", month: "2-digit", year: "numeric"});
export function formatDateToHref(date: Date): string {
return formatterDate
Expand Down

0 comments on commit 44f7e14

Please sign in to comment.