Skip to content

Commit

Permalink
Integrated google calendar for events (#285)
Browse files Browse the repository at this point in the history
* integrated google calendar for events

* change btn variant
  • Loading branch information
Megha-Dev-19 committed May 14, 2024
1 parent 092abc5 commit 9406b99
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions apps/builddao/widget/events/GoogleCalendarJoin.jsx
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>
);
7 changes: 7 additions & 0 deletions apps/builddao/widget/events/ListView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,13 @@ const EventGroup = ({ date }) => {
>
Join Now
</Button>
<Widget
src="${config_account}/widget/events.GoogleCalendarJoin"
loading=""
props={{
data: event,
}}
/>
{eventAuthor === context.accountId && (
<Button
onClick={handleDelete}
Expand Down
7 changes: 7 additions & 0 deletions apps/builddao/widget/events/MonthView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ return (
>
Join Now
</Button>
<Widget
src="${config_account}/widget/events.GoogleCalendarJoin"
loading=""
props={{
data: data,
}}
/>
{eventAuthor === context.accountId && (
<Button
onClick={handleDelete}
Expand Down

0 comments on commit 9406b99

Please sign in to comment.