Skip to content

Commit

Permalink
Add Google Maps links
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteHoodHacker committed Aug 28, 2024
1 parent f083ccd commit ef3898f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
20 changes: 17 additions & 3 deletions sigpwny.com/src/pages/meetings/[...slug]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
getYouTubeEmbedUrl,
weekNumber
} from '@/utils/meetings';
import locations from '@/locations.json';
import { createICalendarLocation } from '@/utils/icalendar';
import { getProfilesFromNames } from '@/utils/profiles';
// import { Tooltip } from '@/components/Tooltip';
Expand Down Expand Up @@ -53,6 +55,7 @@ const time_start = meeting.time_start ? dayjs(meeting.time_start).tz(meeting.tim
const time_end = meeting.time_start && meeting.duration
? dayjs(meeting.time_start).tz(meeting.timezone).add(dayjs.duration(meeting.duration))
: undefined;
const iCalendarLocation = createICalendarLocation(locations, meeting.location);
---
<Layout
title={meeting.title}
Expand Down Expand Up @@ -135,9 +138,20 @@ const time_end = meeting.time_start && meeting.duration
{meeting.location ? (
<div class="flex flex-row gap-2 items-center">
<LocationRegular className="flex-none text-primary" />
<span class="inline align-middle">
{meeting.location}
</span>
{iCalendarLocation?.title ? (
<a
class="inline align-middle !underline underline-offset-2"
href={`https://maps.google.com/?q=${iCalendarLocation.title}`}
target="_blank"
rel="noopener noreferrer"
>
{meeting.location}
</a>
) : (
<span class="inline align-middle">
{meeting.location}
</span>
)}
</div>
) : null}
</div>
Expand Down
6 changes: 3 additions & 3 deletions sigpwny.com/src/utils/icalendar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crypto from 'crypto';
import type { ICalLocation } from "ical-generator";
import type { ICalLocationWithTitle } from "ical-generator";

export function createICalendarUID(uniq_id: string, domain: string) {
const hash = crypto.createHash('sha256').update(uniq_id).digest('hex');
Expand Down Expand Up @@ -31,10 +31,10 @@ export function createICalendarLocation(locations: any[], init_loc?: string) {
address: full_loc.address,
radius: full_loc.radius ?? 100.0,
geo: full_loc.geo,
} as ICalLocation;
} as ICalLocationWithTitle;
}
}
return {
title: init_loc
} as ICalLocation;
} as ICalLocationWithTitle;
}

0 comments on commit ef3898f

Please sign in to comment.