fix(parser): ThumbnailView background color (#686)

This commit is contained in:
Brahim Hadriche
2024-07-11 13:31:27 -04:00
committed by GitHub
parent 7d03469e64
commit 0f8f92a28a
3 changed files with 21 additions and 15 deletions

View File

@@ -6,7 +6,7 @@ export default class CollectionThumbnailView extends YTNode {
static type = 'CollectionThumbnailView';
primary_thumbnail: ThumbnailView | null;
stack_color: {
stack_color?: {
light_theme: number;
dark_theme: number;
};
@@ -15,9 +15,11 @@ export default class CollectionThumbnailView extends YTNode {
super();
this.primary_thumbnail = Parser.parseItem(data.primaryThumbnail, ThumbnailView);
this.stack_color = {
light_theme: data.stackColor.lightTheme,
dark_theme: data.stackColor.darkTheme
};
if (data.stackColor) {
this.stack_color = {
light_theme: data.stackColor.lightTheme,
dark_theme: data.stackColor.darkTheme
};
}
}
}

View File

@@ -7,7 +7,7 @@ export default class ThumbnailBadgeView extends YTNode {
icon_name: string;
text: string;
badge_style: string;
background_color: {
background_color?: {
light_theme: number;
dark_theme: number;
};
@@ -18,9 +18,11 @@ export default class ThumbnailBadgeView extends YTNode {
this.icon_name = data.icon.sources[0].clientResource.imageName;
this.text = data.text;
this.badge_style = data.badgeStyle;
this.background_color = {
light_theme: data.backgroundColor.lightTheme,
dark_theme: data.backgroundColor.darkTheme
};
if (data.backgroundColor) {
this.background_color = {
light_theme: data.backgroundColor.lightTheme,
dark_theme: data.backgroundColor.darkTheme
};
}
}
}

View File

@@ -9,7 +9,7 @@ export default class ThumbnailView extends YTNode {
image: Thumbnail[];
overlays: (ThumbnailOverlayBadgeView | ThumbnailHoverOverlayView)[];
background_color: {
background_color?: {
light_theme: number;
dark_theme: number;
};
@@ -19,9 +19,11 @@ export default class ThumbnailView extends YTNode {
this.image = Thumbnail.fromResponse(data.image);
this.overlays = Parser.parseArray(data.overlays, [ ThumbnailOverlayBadgeView, ThumbnailHoverOverlayView ]);
this.background_color = {
light_theme: data.backgroundColor.lightTheme,
dark_theme: data.backgroundColor.darkTheme
};
if (data.backgroundColor) {
this.background_color = {
light_theme: data.backgroundColor.lightTheme,
dark_theme: data.backgroundColor.darkTheme
};
}
}
}