From 2318d22f38373a07b321a4493077ca3c72d7ae66 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Tue, 22 Mar 2022 17:47:33 +0200 Subject: [PATCH] embeds? --- client/src/pages/Media.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/client/src/pages/Media.js b/client/src/pages/Media.js index fe7cccd..17df219 100644 --- a/client/src/pages/Media.js +++ b/client/src/pages/Media.js @@ -85,8 +85,13 @@ const Media = () => { if (response.status !== 200) return console.error('Failed to get clip index'); const data = await response.json(); updateIndex(data); - if (location.hash) { - const video = data.find(vid => `#${vid.name.toLowerCase()}` === location.hash.toLowerCase()); + // if (location.hash) { + // const video = data.find(vid => `#${vid.name.toLowerCase()}` === location.hash.toLowerCase()); + // if (video) setVideo(video); + // } + const [, , videoname] = location.pathname.toLowerCase().split('/'); + if (videoname) { + const video = data.find(vid => vid.name.toLowerCase() === videoname); if (video) setVideo(video); } })(); @@ -95,12 +100,22 @@ const Media = () => { const clickHandler = (video) => { setVideo(video); - navigate(`#${video.name}`); + //navigate(`#${video.name}`); + navigate(`/media/${video.name}`); }; let i = 0; return (
+ + + V i d e o s + + + {index.map(entry => clickHandler(entry)} key={i++} {...entry} />)} {video ? :''}