|
| 1 | +import React from 'react' |
1 | 2 | import { ISourceLayer, SourceLayerType } from '@sofie-automation/blueprints-integration' |
2 | 3 | import { PartId, PartInstanceId } from '@sofie-automation/corelib/dist/dataModel/Ids' |
3 | 4 | import { UIStudio } from '../../../../../lib/api/studios' |
@@ -27,31 +28,32 @@ export interface IProps { |
27 | 28 | isNext: boolean |
28 | 29 | } |
29 | 30 |
|
30 | | -export default function renderThumbnail(props: Readonly<IProps>): JSX.Element { |
| 31 | +export const ThumbnailRenderer = React.memo(function ThumbnailRenderer(props: Readonly<IProps>): JSX.Element { |
31 | 32 | const type = props.layer?.type |
| 33 | + |
32 | 34 | switch (type) { |
33 | 35 | case SourceLayerType.VT: |
34 | 36 | case SourceLayerType.LIVE_SPEAK: |
35 | | - return VTThumbnailRenderer(props) |
| 37 | + return <VTThumbnailRenderer {...props} /> |
36 | 38 | case SourceLayerType.CAMERA: |
37 | 39 | case SourceLayerType.REMOTE: |
38 | | - return CameraThumbnailRenderer(props) |
| 40 | + return <CameraThumbnailRenderer {...props} /> |
39 | 41 | case SourceLayerType.SPLITS: |
40 | | - return SplitsThumbnailRenderer(props) |
| 42 | + return <SplitsThumbnailRenderer {...props} /> |
41 | 43 | case SourceLayerType.GRAPHICS: |
42 | 44 | case SourceLayerType.LOWER_THIRD: |
43 | 45 | case SourceLayerType.STUDIO_SCREEN: |
44 | | - return GraphicsThumbnailRenderer(props) |
| 46 | + return <GraphicsThumbnailRenderer {...props} /> |
45 | 47 | case SourceLayerType.LOCAL: |
46 | | - return LocalThumbnailRenderer(props) |
| 48 | + return <LocalThumbnailRenderer {...props} /> |
47 | 49 | case SourceLayerType.AUDIO: |
48 | 50 | case SourceLayerType.SCRIPT: |
49 | 51 | case SourceLayerType.TRANSITION: |
50 | 52 | case SourceLayerType.UNKNOWN: |
51 | 53 | case undefined: |
52 | | - return DefaultThumbnailRenderer(props) |
| 54 | + return <DefaultThumbnailRenderer {...props} /> |
53 | 55 | default: |
54 | 56 | assertNever(type) |
55 | | - return DefaultThumbnailRenderer(props) |
| 57 | + return <DefaultThumbnailRenderer {...props} /> |
56 | 58 | } |
57 | | -} |
| 59 | +}) |
0 commit comments