From 30533076beaaaba0f821e3d3ea269424d3711917 Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 24 Jan 2023 19:01:16 -0600 Subject: [PATCH 01/35] adds mixcloud --- src/Const.ts | 6 ++++++ src/Element/MixCloudEmbed.tsx | 27 +++++++++++++++++++++++++++ src/Element/Text.tsx | 6 +++++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/Element/MixCloudEmbed.tsx diff --git a/src/Const.ts b/src/Const.ts index bcea7a8b..d8f0827e 100644 --- a/src/Const.ts +++ b/src/Const.ts @@ -95,3 +95,9 @@ export const TidalRegex = /tidal\.com\/(?:browse\/)?(\w+)\/([a-z0-9-]+)/i; */ export const SoundCloudRegex = /soundcloud\.com\/(?!live)([a-zA-Z0-9]+)\/([a-zA-Z0-9-]+)/ + +/** + * Mixcloud regex + */ + +export const MixCloudRegex = /mixcloud\.com\/(?!live)([a-zA-Z0-9]+)\/([a-zA-Z0-9-]+)/ \ No newline at end of file diff --git a/src/Element/MixCloudEmbed.tsx b/src/Element/MixCloudEmbed.tsx new file mode 100644 index 00000000..8812b65e --- /dev/null +++ b/src/Element/MixCloudEmbed.tsx @@ -0,0 +1,27 @@ +import { MixCloudRegex } from "Const"; +import { useSelector } from "react-redux"; +import { RootState } from "State/Store"; + +const MixCloudEmbed = ({link}: {link: string}) => { + + const feedPath = (MixCloudRegex.test(link) && RegExp.$1) + "%2F" + ( MixCloudRegex.test(link) && RegExp.$2) + + const lightTheme = useSelector(s => s.login.preferences.theme === "light"); + + const lightParams = lightTheme ? "light=1" : "light=0"; + + return( + <> +
+