From 43b4fc0a0c734861dedc73cb7e909da3239c6e1f Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Mon, 28 Oct 2024 12:46:26 +0000 Subject: [PATCH] lint --- src/reactions/RaisedHandIndicator.test.tsx | 6 +++--- src/reactions/RaisedHandIndicator.tsx | 16 ++++++++++++---- src/tile/MediaView.tsx | 8 +------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/reactions/RaisedHandIndicator.test.tsx b/src/reactions/RaisedHandIndicator.test.tsx index 8463a625..6db9ada4 100644 --- a/src/reactions/RaisedHandIndicator.test.tsx +++ b/src/reactions/RaisedHandIndicator.test.tsx @@ -15,18 +15,18 @@ configure({ }); describe("RaisedHandIndicator", () => { - test("renders nothing when no hand has been raised", async () => { + test("renders nothing when no hand has been raised", () => { const { container } = render(); expect(container.firstChild).toBeNull(); }); - test("renders an indicator when a hand has been raised", async () => { + test("renders an indicator when a hand has been raised", () => { const dateTime = new Date(); const { container } = render( , ); expect(container.firstChild).toMatchSnapshot(); }); - test("renders an indicator when a hand has been raised with the expected time", async () => { + test("renders an indicator when a hand has been raised with the expected time", () => { const dateTime = new Date(new Date().getTime() - 60000); const { container } = render( , diff --git a/src/reactions/RaisedHandIndicator.tsx b/src/reactions/RaisedHandIndicator.tsx index 012fa571..ba7e8788 100644 --- a/src/reactions/RaisedHandIndicator.tsx +++ b/src/reactions/RaisedHandIndicator.tsx @@ -1,18 +1,26 @@ -import { useEffect, useState } from "react"; +/* +Copyright 2024 New Vector Ltd. + +SPDX-License-Identifier: AGPL-3.0-only +Please see LICENSE in the repository root for full details. +*/ + +import { ReactNode, useEffect, useState } from "react"; + import styles from "./RaisedHandIndicator.module.css"; export function RaisedHandIndicator({ raisedHandTime, }: { raisedHandTime?: Date; -}) { +}): ReactNode { const [raisedHandDuration, setRaisedHandDuration] = useState(""); useEffect(() => { if (!raisedHandTime) { return; } - const calculateTime = () => { + const calculateTime = (): void => { const totalSeconds = Math.ceil( (new Date().getTime() - raisedHandTime.getTime()) / 1000, ); @@ -22,8 +30,8 @@ export function RaisedHandIndicator({ `${minutes < 10 ? "0" : ""}${minutes}:${seconds < 10 ? "0" : ""}${seconds}`, ); }; - const to = setInterval(calculateTime, 1000); calculateTime(); + const to = setInterval(calculateTime, 1000); return (): void => clearInterval(to); }, [setRaisedHandDuration, raisedHandTime]); diff --git a/src/tile/MediaView.tsx b/src/tile/MediaView.tsx index 41a3bdc1..be2d4a62 100644 --- a/src/tile/MediaView.tsx +++ b/src/tile/MediaView.tsx @@ -8,13 +8,7 @@ Please see LICENSE in the repository root for full details. import { TrackReferenceOrPlaceholder } from "@livekit/components-core"; import { animated } from "@react-spring/web"; import { RoomMember } from "matrix-js-sdk/src/matrix"; -import { - ComponentProps, - ReactNode, - forwardRef, - useEffect, - useState, -} from "react"; +import { ComponentProps, ReactNode, forwardRef } from "react"; import { useTranslation } from "react-i18next"; import classNames from "classnames"; import { VideoTrack } from "@livekit/components-react";