File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 1
1
import { YTNode } from '../helpers.js' ;
2
2
import { Parser , type RawNode } from '../index.js' ;
3
+ import ThumbnailView from './ThumbnailView.js' ;
3
4
import CollectionThumbnailView from './CollectionThumbnailView.js' ;
4
5
import LockupMetadataView from './LockupMetadataView.js' ;
5
6
import RendererContext from './misc/RendererContext.js' ;
6
7
7
8
export default class LockupView extends YTNode {
8
9
static type = 'LockupView' ;
9
10
10
- public content_image : CollectionThumbnailView | null ;
11
+ public content_image : CollectionThumbnailView | ThumbnailView | null ;
11
12
public metadata : LockupMetadataView | null ;
12
13
public content_id : string ;
13
14
public content_type : 'VIDEO' | 'MOVIE' | 'CHANNEL' | 'CLIP' | 'SOURCE' | 'PLAYLIST' | 'ALBUM' | 'PODCAST' | 'SHOPPING_COLLECTION' | 'SHORT' | 'GAME' | 'PRODUCT' ;
14
15
public renderer_context : RendererContext ;
15
16
16
17
constructor ( data : RawNode ) {
17
18
super ( ) ;
18
- this . content_image = Parser . parseItem ( data . contentImage , CollectionThumbnailView ) ;
19
+ this . content_image = Parser . parseItem ( data . contentImage , [ CollectionThumbnailView , ThumbnailView ] ) ;
19
20
this . metadata = Parser . parseItem ( data . metadata , LockupMetadataView ) ;
20
21
this . content_id = data . contentId ;
21
22
this . content_type = data . contentType . replace ( 'LOCKUP_CONTENT_TYPE_' , '' ) ;
Original file line number Diff line number Diff line change @@ -4,22 +4,25 @@ import ThumbnailHoverOverlayView from './ThumbnailHoverOverlayView.js';
4
4
import ThumbnailOverlayBadgeView from './ThumbnailOverlayBadgeView.js' ;
5
5
import Thumbnail from './misc/Thumbnail.js' ;
6
6
7
+ export type ThumbnailBackgroundColor = {
8
+ light_theme : number ;
9
+ dark_theme : number ;
10
+ } ;
11
+
7
12
export default class ThumbnailView extends YTNode {
8
13
static type = 'ThumbnailView' ;
9
14
10
- image : Thumbnail [ ] ;
11
- overlays : ( ThumbnailOverlayBadgeView | ThumbnailHoverOverlayView ) [ ] ;
12
- background_color ?: {
13
- light_theme : number ;
14
- dark_theme : number ;
15
- } ;
15
+ public image : Thumbnail [ ] ;
16
+ public overlays : ( ThumbnailOverlayBadgeView | ThumbnailHoverOverlayView ) [ ] ;
17
+ public background_color ?: ThumbnailBackgroundColor ;
16
18
17
19
constructor ( data : RawNode ) {
18
20
super ( ) ;
19
21
20
22
this . image = Thumbnail . fromResponse ( data . image ) ;
21
23
this . overlays = Parser . parseArray ( data . overlays , [ ThumbnailOverlayBadgeView , ThumbnailHoverOverlayView ] ) ;
22
- if ( data . backgroundColor ) {
24
+
25
+ if ( 'backgroundColor' in data ) {
23
26
this . background_color = {
24
27
light_theme : data . backgroundColor . lightTheme ,
25
28
dark_theme : data . backgroundColor . darkTheme
You can’t perform that action at this time.
0 commit comments