Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(parser): ThumbnailView background color #686

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/parser/classes/CollectionThumbnailView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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
};
}
}
}
12 changes: 7 additions & 5 deletions src/parser/classes/ThumbnailBadgeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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
};
}
}
}
12 changes: 7 additions & 5 deletions src/parser/classes/ThumbnailView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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
};
}
}
}
Loading