From 3095bb04a86eb37e3351a022a6057144d71a4178 Mon Sep 17 00:00:00 2001 From: Kentai Radiquum Date: Tue, 30 Apr 2024 16:47:05 +0500 Subject: [PATCH] refactor(frontend/release): add a loading circle for release player when fetching episodes data --- .../app/components/Release/ReleaseInfo.jsx | 42 +++++ .../app/components/Release/ReleasePlayer.jsx | 170 +++++++++--------- frontend/app/release/[id]/page.js | 42 +---- 3 files changed, 132 insertions(+), 122 deletions(-) diff --git a/frontend/app/components/Release/ReleaseInfo.jsx b/frontend/app/components/Release/ReleaseInfo.jsx index e69de29..7885302 100644 --- a/frontend/app/components/Release/ReleaseInfo.jsx +++ b/frontend/app/components/Release/ReleaseInfo.jsx @@ -0,0 +1,42 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { getData } from "@/app/api/api-utils"; +import { endpoints } from "@/app/api/config"; + +export const ReleaseInfo = (props) => { + const [releaseInfo, setReleaseInfo] = useState(); + + useEffect(() => { + async function _fetchInfo() { + const release = await getData(`${endpoints.release}/${props.id}`); + setReleaseInfo(release); + } + if (props.id) { + _fetchInfo(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return ( +
+
+
+ +
+
+
+
Title
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. +

+ +
+
+
+
+ ); +}; diff --git a/frontend/app/components/Release/ReleasePlayer.jsx b/frontend/app/components/Release/ReleasePlayer.jsx index d768999..261abeb 100644 --- a/frontend/app/components/Release/ReleasePlayer.jsx +++ b/frontend/app/components/Release/ReleasePlayer.jsx @@ -77,87 +77,95 @@ export const ReleasePlayer = (props) => { }, [selectedEpisode]); return ( -
-