Skip to content

Commit f26adc3

Browse files
authored
include Teams link in confLink (#29)
1 parent 194a317 commit f26adc3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Specifies the text to add for each calendar event. The following placeholders ar
113113
- `{description}` - the description of the event
114114
- `{link}` - the link for the event
115115
- `{hangout}` - the hangout link for the event
116-
- `{confLink}` - a conference link for the event (labeled 'Meet' or 'Zoom' as appropriate)
116+
- `{confLink}` - a conference link for the event (labeled 'Meet', 'Zoom', or 'Teams' as appropriate)
117117
- `{location}` - the location for the event
118118
- `{start}` - the start time of the event. Add a colon and format to customize the start time format. For example, `{start:hh:mm}` will resolve to `12:00`. See the [date-fns library](https://date-fns.org/v2.22.1/docs/format) for more details on time formats.
119119
- `{end}` - the end time of the event. Add a colon and format to customize the end time format. For example, `{end:hh:mmaaaaa}` will resolve to `12:00p`. See the [date-fns library](https://date-fns.org/v2.22.1/docs/format) for more details on time formats.

src/utils/event.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ export const blockFormatEvent = (
4848
format: InputTextNode
4949
): InputTextNode => {
5050
const summary = resolveSummary(e);
51-
const meetLink = e.hangoutLink ? ` - [Meet](${e.hangoutLink})` : "";
51+
52+
const teamsLinkExtract =
53+
e.description?.match(
54+
/https:\/\/teams\.live\.com\/meet\/[\w\/?=+-]+/
55+
)?.[0] || "";
56+
const teamsLink = teamsLinkExtract ? `[Teams](${teamsLinkExtract})` : "";
57+
const meetLink = e.hangoutLink ? `[Meet](${e.hangoutLink})` : "";
5258
const zoomLink =
5359
e.location && e.location.indexOf("zoom.us") > -1
54-
? ` - [Zoom](${e.location})`
60+
? `[Zoom](${e.location})`
5561
: "";
5662
return {
5763
text: format.text
@@ -66,7 +72,7 @@ export const blockFormatEvent = (
6672
.replace(/{summary}/g, summary)
6773
.replace(/{link}/g, e.htmlLink || "")
6874
.replace(/{hangout}/g, e.hangoutLink || "")
69-
.replace(/{confLink}/g, meetLink + zoomLink || "")
75+
.replace(/{confLink}/g, meetLink + zoomLink + teamsLink || "")
7076
.replace(/{location}/g, e.location || "")
7177
.replace(/{attendees:?(.*?)}/g, (_, format) =>
7278
resolveAttendees(e, format)

0 commit comments

Comments
 (0)