From 7f3b602259f0c35c9007a5b0158ee08ca23b4e14 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 30 Mar 2022 17:09:19 -0700 Subject: [PATCH] feat: Berrycast embed support --- public/images/berrycast.png | Bin 0 -> 774 bytes shared/editor/embeds/Berrycast.tsx | 27 +++++++++++++++++++++++++++ shared/editor/embeds/index.tsx | 9 +++++++++ 3 files changed, 36 insertions(+) create mode 100644 public/images/berrycast.png create mode 100644 shared/editor/embeds/Berrycast.tsx diff --git a/public/images/berrycast.png b/public/images/berrycast.png new file mode 100644 index 0000000000000000000000000000000000000000..b123fdd873822eba014ed8fa514d931bc012692c GIT binary patch literal 774 zcmV+h1Nr=kP)a^~0LE+wl7E#do*yFD0hvh)`Hv5-9RDQqKLvnkHkYFd?f8qF@d5zoEe|e8 zZ2U0!XH4V9rLH>}U$%Swr9cF-_pf`SG=Q;0lI|gd6YaJebD5O)8RH3Q*vzGnOwiRk zz?~RlWXtk1M#eknd5EYhDRVYTOZSDQM_C!Q;j@zfu*%XRXC|*b^uY40p`P8Q4P@e? zE*gXafGbsN#KeuN*}@oO#BX|eee#%6I7>F^(RvbH7uq~Ym07n8j z?e@Zs_Nfp;t8|31!=6Wt?d*6&kKa2uHC=?+0nm&wcG<@ZCrF`JpA;w_2;Bs__cb?f zkxibTZ^dgeUU<8U13ZKK#^-ZH&Mv3C&EKv)XS6ZfEn392Jz5jj?aSOnR(tkh=0$J6 zdXY=S@bqvetR08Ax2;`{$fX#ZXxP2R-D#^*E9@?6Is*oh zzTO;RtVxsn2nP{imx!J!lc~#5L=sZe@D{$`miBXa+nGE|KaVpYZPi4H1=T#9$) zLk?-GYW+`sEr%7VMy87QYDL|(meJ=e;|&cB4GllyFW+_{hSABwJ^%m!07*qoM6N<$ Ef&sXI`2YX_ literal 0 HcmV?d00001 diff --git a/shared/editor/embeds/Berrycast.tsx b/shared/editor/embeds/Berrycast.tsx new file mode 100644 index 000000000..7bee1ef24 --- /dev/null +++ b/shared/editor/embeds/Berrycast.tsx @@ -0,0 +1,27 @@ +import * as React from "react"; +import useComponentSize from "~/hooks/useComponentSize"; +import Frame from "../components/Frame"; +import { EmbedProps as Props } from "."; + +const URL_REGEX = /^https:\/\/(www\.)?berrycast.com\/conversations\/(.*)$/; + +export default function Berrycast(props: Props) { + const normalizedUrl = props.attrs.href.replace(/\/$/, ""); + const ref = React.useRef(null); + const { width } = useComponentSize(ref); + + return ( + <> +
+ + + ); +} + +Berrycast.ENABLED = [URL_REGEX]; diff --git a/shared/editor/embeds/index.tsx b/shared/editor/embeds/index.tsx index 4ac1d5a99..e6317f105 100644 --- a/shared/editor/embeds/index.tsx +++ b/shared/editor/embeds/index.tsx @@ -4,6 +4,7 @@ import { EmbedDescriptor } from "@shared/editor/types"; import Image from "../components/Image"; import Abstract from "./Abstract"; import Airtable from "./Airtable"; +import Berrycast from "./Berrycast"; import Bilibili from "./Bilibili"; import Cawemo from "./Cawemo"; import ClickUp from "./ClickUp"; @@ -86,6 +87,14 @@ const embeds: EmbedDescriptor[] = [ component: Airtable, matcher: matcher(Airtable), }, + { + title: "Berrycast", + keywords: "video", + defaultHidden: true, + icon: () => Berrycast, + component: Berrycast, + matcher: matcher(Berrycast), + }, { title: "Bilibili", keywords: "video",