From 835fd26a9508f0df5d975dd5722f9988257cf129 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 26 Aug 2021 20:20:15 -0700 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit ebe2fe07d1a9110a99a21772b79f189dd13b4ca8 Author: Tom Moor Date: Thu Aug 26 20:18:52 2021 -0700 fix: regex, formatting commit 1fd17b6f8a72191ecbe593d221e467559b01c70f Author: Matheus Breguêz Date: Thu Aug 26 09:37:12 2021 -0300 fix: change image size commit 30e9bad0f5f486c876e7bf49bc726789daf1e1bc Merge: ef99201c cc9468e2 Author: Matheus Breguêz Date: Thu Aug 26 09:28:34 2021 -0300 Merge branch 'main' into feat/google-calendar-embed commit ef99201c9d9728a1ecefa77eb36ab7845bbf69b5 Author: Matheus Breguêz Date: Fri Jul 9 11:53:56 2021 -0300 Update GoogleCalendar.js commit 0e910847566acd0f0dcb833822be6795f166eb1f Merge: e98f94c0 ec5c47e0 Author: Matheus Breguêz Date: Wed Jul 7 14:49:06 2021 -0300 Merge remote-tracking branch 'origin/feat/google-calendar-embed' into feat/google-calendar-embed commit e98f94c02d4d15f600a749d489a3277723767e74 Author: Matheus Breguêz Date: Wed Jul 7 14:29:49 2021 -0300 feat: Add Google Calendar Embed commit ec5c47e0c8d84e9a463e8196169ebd36beddfa7b Author: Matheus Breguêz Date: Wed Jul 7 14:29:49 2021 -0300 feat: Add Google Calendar Embed --- app/embeds/GoogleCalendar.js | 29 +++++++++++++++++++++++++++++ app/embeds/GoogleCalendar.test.js | 19 +++++++++++++++++++ app/embeds/index.js | 8 ++++++++ public/images/google-calendar.png | Bin 0 -> 3189 bytes 4 files changed, 56 insertions(+) create mode 100644 app/embeds/GoogleCalendar.js create mode 100644 app/embeds/GoogleCalendar.test.js create mode 100644 public/images/google-calendar.png diff --git a/app/embeds/GoogleCalendar.js b/app/embeds/GoogleCalendar.js new file mode 100644 index 000000000..06617bdbc --- /dev/null +++ b/app/embeds/GoogleCalendar.js @@ -0,0 +1,29 @@ +// @flow +import * as React from "react"; +import Frame from "./components/Frame"; + +const URL_REGEX = new RegExp( + "^https?://calendar.google.com/calendar/embed\\?src=(.*)$" +); + +type Props = {| + attrs: {| + href: string, + matches: string[], + |}, +|}; + +export default class GoogleCalendar extends React.Component { + static ENABLED = [URL_REGEX]; + + render() { + return ( + + ); + } +} diff --git a/app/embeds/GoogleCalendar.test.js b/app/embeds/GoogleCalendar.test.js new file mode 100644 index 000000000..2e9cffbd7 --- /dev/null +++ b/app/embeds/GoogleCalendar.test.js @@ -0,0 +1,19 @@ +/* eslint-disable flowtype/require-valid-file-annotation */ +import GoogleCalendar from "./GoogleCalendar"; + +describe("GoogleCalendar", () => { + const match = GoogleCalendar.ENABLED[0]; + test("to be enabled on share link", () => { + expect( + "https://calendar.google.com/calendar/embed?src=tom%40outline.com&ctz=America%2FSao_Paulo".match( + match + ) + ).toBeTruthy(); + }); + + test("to not be enabled elsewhere", () => { + expect("https://calendar.google.com/calendar".match(match)).toBe(null); + expect("https://calendar.google.com".match(match)).toBe(null); + expect("https://www.google.com".match(match)).toBe(null); + }); +}); diff --git a/app/embeds/index.js b/app/embeds/index.js index 007cd9624..2ee824d55 100644 --- a/app/embeds/index.js +++ b/app/embeds/index.js @@ -12,6 +12,7 @@ import Diagrams from "./Diagrams"; import Figma from "./Figma"; import Framer from "./Framer"; import Gist from "./Gist"; +import GoogleCalendar from "./GoogleCalendar"; import GoogleDataStudio from "./GoogleDataStudio"; import GoogleDocs from "./GoogleDocs"; import GoogleDrawings from "./GoogleDrawings"; @@ -157,6 +158,13 @@ export default [ component: GoogleSlides, matcher: matcher(GoogleSlides), }, + { + title: "Google Calendar", + keywords: "calendar", + icon: () => , + component: GoogleCalendar, + matcher: matcher(GoogleCalendar), + }, { title: "Google Data Studio", keywords: "business intelligence", diff --git a/public/images/google-calendar.png b/public/images/google-calendar.png new file mode 100644 index 0000000000000000000000000000000000000000..c46cb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