Skip to content

Commit 2b8209b

Browse files
committed
fix: clean up isSelected should parse boolean not function as props
1 parent 52c7cf6 commit 2b8209b

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

packages/webui/src/client/ui/SegmentTimeline/SegmentTimelineContainer.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ interface IProps extends IResolvedSegmentProps {
7575
onSegmentSelect: (segmentId: SegmentId) => void
7676
}
7777

78-
interface IWithSelectionProps extends IProps {
79-
handleIsSelected: (segmentId: SegmentId) => boolean
80-
}
81-
8278
export function SegmentTimelineContainer(props: Readonly<IProps>): JSX.Element {
8379
const partIds = useTracker(
8480
() =>
@@ -156,19 +152,23 @@ function SegmentTimelineContainerWithSelection(props: Readonly<IProps>): JSX.Ele
156152
})
157153
}
158154

159-
const handleIsSelected = (segmentId: SegmentId) => {
160-
return isSelected(segmentId)
155+
const isElementSelected = () => {
156+
return isSelected(props.segmentId)
161157
}
162158

163159
return (
164160
<SegmentTimelineContainerContent
165161
{...props}
166-
handleIsSelected={handleIsSelected}
162+
isSelected={isElementSelected()}
167163
onSegmentSelect={handleSegmentSelect}
168164
/>
169165
)
170166
}
171167

168+
interface IWithSelectionProps extends IProps {
169+
isSelected: boolean
170+
}
171+
172172
const SegmentTimelineContainerContent = withResolvedSegment(
173173
class SegmentTimelineContainerContent extends React.Component<
174174
IWithSelectionProps & ITrackedResolvedSegmentProps,
@@ -696,10 +696,6 @@ const SegmentTimelineContainerContent = withResolvedSegment(
696696
this.props.onSegmentSelect(segmentId)
697697
}
698698

699-
isSelected = (segmentId: SegmentId) => {
700-
return this.props.handleIsSelected(segmentId)
701-
}
702-
703699
render(): JSX.Element | null {
704700
return this.props.segmentui ? (
705701
<React.Fragment key={unprotectString(this.props.segmentui._id)}>
@@ -748,7 +744,7 @@ const SegmentTimelineContainerContent = withResolvedSegment(
748744
fixedSegmentDuration={this.props.fixedSegmentDuration}
749745
showDurationSourceLayers={this.props.showDurationSourceLayers}
750746
onSegmentSelect={this.handleSegmentSelect}
751-
isSelected={this.isSelected(this.props.segmentui._id)}
747+
isSelected={this.props.isSelected}
752748
/>
753749
)}
754750
{this.props.segmentui.showShelf && this.props.adLibSegmentUi && (

0 commit comments

Comments
 (0)