From dd54d02d4b58497471ca6f9d789e7d5eec04b5c4 Mon Sep 17 00:00:00 2001 From: sphinxrave <62570796+sphinxrave@users.noreply.github.com> Date: Sat, 2 Dec 2023 01:13:12 -0800 Subject: [PATCH] kinda all over the place, these changes. --- .../react/src/components/video/VideoCard.tsx | 3 ++ packages/react/src/routes/watch.tsx | 30 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/packages/react/src/components/video/VideoCard.tsx b/packages/react/src/components/video/VideoCard.tsx index 9bdde6484..b52602cc3 100644 --- a/packages/react/src/components/video/VideoCard.tsx +++ b/packages/react/src/components/video/VideoCard.tsx @@ -280,6 +280,7 @@ export function VideoCard({ > { - const videoPlaceholder: QueueVideo = { + const videoPlaceholder: QueueVideo = location.state.video ?? { id: id!, url: `https://youtu.be/${id}`, channel_id: "", @@ -76,6 +74,11 @@ export default function Watch() { type: "vtuber", }, }; + videoPlaceholder.url = + location.state?.video?.link?.includes("twitch") ?? + data?.link?.includes("twitch") + ? location.state.video?.link + : `https://youtu.be/${id}`; setMiniPlayer(false); setCurrentVideo(videoPlaceholder); if (queue.length) @@ -95,14 +98,25 @@ export default function Watch() { if (isSuccess) { setCurrentVideo({ ...data, - url: isTwitch ? data.link : `https://youtu.be/${id}`, + url: + location.state?.video?.link?.includes("twitch") ?? + data?.link?.includes("twitch") + ? data.link + : `https://youtu.be/${id}`, }); if (queue.length) setQueue((q) => q.toSpliced( q.findIndex((q) => q.id === id), 1, - { ...data, url: isTwitch ? data.link : `https://youtu.be/${id}` }, + { + ...data, + url: + location.state?.video?.link?.includes("twitch") ?? + data?.link?.includes("twitch") + ? data.link + : `https://youtu.be/${id}`, + }, ), ); } @@ -146,7 +160,7 @@ export default function Watch() { )} )} - {data && } + {currentVideo && }

{data?.title}

- {data && } + {currentVideo && }
{channel && } - {!isTwitch && data?.description && ( + {!data?.link?.includes("twitch") && data?.description && ( )}