-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrated google calendar for events (#285)
* integrated google calendar for events * change btn variant
- Loading branch information
1 parent
7de4d7f
commit a2d1ff0
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
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,22 @@ | ||
const { Button } = VM.require("${config_account}/widget/components") || { | ||
Button: () => <></>, | ||
}; | ||
|
||
const { data } = props; | ||
|
||
function parseDateForGoogleCalendar(date) { | ||
return date ? new Date(date).toISOString().replace(/-|:|\.\d+/g, "") : ""; | ||
} | ||
|
||
const googleEventLink = `https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(data.title)}&details=${encodeURIComponent(data.extendedProps.description ?? data.description)}&location=${encodeURIComponent(data?.url)}&dates=${encodeURIComponent(parseDateForGoogleCalendar(data.start))}/${encodeURIComponent(parseDateForGoogleCalendar(data.end))}`; | ||
|
||
return ( | ||
<Button | ||
noLink={true} | ||
href={`${googleEventLink}`} | ||
target="_blank" | ||
variant="outline" | ||
> | ||
Add to Google Calendar | ||
</Button> | ||
); |
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