From bbad2f032a77b4401e4a073404244109913c49a5 Mon Sep 17 00:00:00 2001
From: Dorian Koch <doriank@fsmpi.rwth-aachen.de>
Date: Wed, 11 Sep 2024 15:10:37 +0200
Subject: [PATCH] Add live label, closes #4

---
 src/components/CourseListing.tsx | 3 +--
 src/components/VideoCard.tsx     | 4 ++--
 src/pages/index.tsx              | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/components/CourseListing.tsx b/src/components/CourseListing.tsx
index 5143868..be089d9 100644
--- a/src/components/CourseListing.tsx
+++ b/src/components/CourseListing.tsx
@@ -16,8 +16,7 @@ import type { GetCourseResponse, lecture } from "@/api/api_v1_types";
 import { ResourceType } from "@/misc/PromiseHelpers";
 import { AuthenticationMethodIcons } from "@/misc/Util";
 import { useLanguage } from "./LanguageProvider";
-import { DateTime } from "luxon";
-import LiveLabel, { LectureLiveLabel } from "./LiveLabel";
+import { LectureLiveLabel } from "./LiveLabel";
 
 function ListingHeader({ course }: { course: GetCourseResponse }) {
     const { editMode } = useEditMode();
diff --git a/src/components/VideoCard.tsx b/src/components/VideoCard.tsx
index fe17629..c6766c2 100644
--- a/src/components/VideoCard.tsx
+++ b/src/components/VideoCard.tsx
@@ -5,7 +5,7 @@ import type { lecture, course } from "@/api/api_v1_types";
 import { StylizedText } from "@/components/StylizedText";
 import { urlForLecture } from "@/misc/Util";
 import { useLanguage } from "./LanguageProvider";
-import LiveLabel, { LectureLiveLabel } from "./LiveLabel";
+import { LectureLiveLabel } from "./LiveLabel";
 
 export function VideoCard({
     lecture,
@@ -78,7 +78,7 @@ export function VideoCard({
                     </li>
                     <li>
                         <strong>{course.full_name}</strong>
-                        {typeof lecture.livestream_url === "string" && <LiveLabel nowlive={true} />}
+                        <LectureLiveLabel lecture={lecture} />
                     </li>
                     <li>{dateStr}</li>
                     {lecture.speaker ? (
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index c97fb61..e9da8aa 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -20,7 +20,7 @@ import { useLanguage } from "@/components/LanguageProvider";
 import { useSearchParams } from "next/navigation";
 import { useRouter } from "next/router";
 import { VideoCard } from "@/components/VideoCard";
-import LiveLabel, { LectureLiveLabel } from "@/components/LiveLabel";
+import { LectureLiveLabel } from "@/components/LiveLabel";
 
 function FeatureCard({ data, all_featured }: { data: featured; all_featured: featured[] }) {
     const { editMode } = useEditMode();
-- 
GitLab