@playkit-js/transcript 3.5.26-canary.0-ef2a1f1 → 3.5.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playkit-js/transcript",
3
- "version": "3.5.26-canary.0-ef2a1f1",
3
+ "version": "3.5.26",
4
4
  "main": "dist/playkit-transcript.js",
5
5
  "license": "AGPL-3.0",
6
6
  "private": false,
@@ -30,8 +30,7 @@ const translates = {
30
30
  errorDescripton: <Text id="transcript.load_failed">Failed to load transcript</Text>,
31
31
  attachTranscript: <Text id="transcript.attach_transcript">Bring Transcript back</Text>,
32
32
  detachTranscript: <Text id="transcript.detach_transcript">Popout transcript</Text>,
33
- toSearchResult: <Text id="transcript.to_search_result">Go to result</Text>,
34
- toSearchResultLabel: <Text id="transcript.to_search_result_label">Click to jump to this point in the video</Text>
33
+ toSearchResult: <Text id="transcript.to_search_result">Go to result</Text>
35
34
  };
36
35
 
37
36
  export interface TranscriptProps {
@@ -57,7 +56,6 @@ export interface TranscriptProps {
57
56
  attachTranscript?: string;
58
57
  detachTranscript?: string;
59
58
  toSearchResult?: string;
60
- toSearchResultLabel?: string;
61
59
  downloadDisabled: boolean;
62
60
  onDownload: () => void;
63
61
  printDisabled: boolean;
@@ -274,6 +272,24 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
274
272
  return styles.smallWidth;
275
273
  };
276
274
 
275
+ private _renderJumpToSearchButton = () => {
276
+ const {toSearchResult, onJumpToSearchMatch} = this.props;
277
+ const {search, activeSearchIndex, totalSearchResults} = this.state;
278
+ if (!search || totalSearchResults === 0 || activeSearchIndex === 0) {
279
+ return null;
280
+ }
281
+ return (
282
+ <Button
283
+ type={ButtonType.secondary}
284
+ className={styles.toSearchButton}
285
+ onClick={onJumpToSearchMatch}
286
+ ariaLabel={toSearchResult}
287
+ testId="transcript_jumpToSearchMatch">
288
+ {toSearchResult}
289
+ </Button>
290
+ );
291
+ };
292
+
277
293
  private _renderHeader = () => {
278
294
  const {
279
295
  toggledWithEnter,
@@ -286,11 +302,8 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
286
302
  isLoading,
287
303
  attachTranscript,
288
304
  detachTranscript,
289
- toSearchResult,
290
- toSearchResultLabel,
291
305
  onAttach,
292
- onDetach,
293
- onJumpToSearchMatch
306
+ onDetach
294
307
  } = this.props;
295
308
  const {search, activeSearchIndex, totalSearchResults} = this.state;
296
309
 
@@ -314,16 +327,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
314
327
  toggledWithEnter={toggledWithEnter}
315
328
  kitchenSinkActive={kitchenSinkActive}
316
329
  />
317
- {search && activeSearchIndex && (
318
- <Button
319
- type={ButtonType.secondary}
320
- className={styles.toSearchButton}
321
- onClick={onJumpToSearchMatch}
322
- ariaLabel={toSearchResultLabel}
323
- testId="transcript_jumpToSearchMatch">
324
- {toSearchResult}
325
- </Button>
326
- )}
330
+ {this._renderJumpToSearchButton()}
327
331
  <TranscriptMenu {...{downloadDisabled, onDownload, printDisabled, onPrint, isLoading, detachMenuItem, kitchenSinkDetached}} />
328
332
  {!detachMenuItem && this._renderDetachButton()}
329
333
  {!kitchenSinkDetached && (