Skip to content

Commit

Permalink
refactor: Incorporate image_labels into ImagePlayer component
Browse files Browse the repository at this point in the history
  • Loading branch information
drikusroor committed Sep 2, 2024
1 parent b1d64ac commit afdb6c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions frontend/src/components/Playback/ImagePlayer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useCallback } from "react";
import MultiPlayer from "./MultiPlayer";
import { PlaybackArgs } from "@/types/Playback";

interface ImagePlayerProps {
images: string[];
// FIXME: image_labels is never passed as a prop by any parent component
image_labels?: string[];
interface ImagePlayerProps extends Pick<PlaybackArgs, "images" | "image_labels"> {
playSection: (index: number) => void;
}

Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Playback/Playback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ const Playback = ({
<ImagePlayer
{...attrs}
images={playbackArgs.images}
image_labels={playbackArgs.image_labels}
disabledPlayers={playbackArgs.play_once ? hasPlayed : undefined}
/>
);
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/types/Playback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ interface FrontendStyle {
[key: string]: string | FrontendStyle;
}

type Labels = { [key: string]: string };

export interface PlaybackArgs {
view: PlaybackView;
play_method: PlaybackMethod;
Expand All @@ -27,9 +25,10 @@ export interface PlaybackArgs {
sections: Section[];
play_from: number;

labels?: Labels;
labels?: string[];
image_labels?: string[];
images?: string[];
style?: FrontendStyle;
images?: { [key: string]: string };
mute?: boolean;
play_once?: boolean;
resume_play?: boolean;
Expand Down

0 comments on commit afdb6c5

Please sign in to comment.