Skip to content

Commit

Permalink
feat(CompactLink): Parse subtitle, iconType, and iconType
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Jan 24, 2025
1 parent 32125c7 commit 6d57353
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/parser/classes/CompactLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,27 @@ import type { RawNode } from '../index.js';
export default class CompactLink extends YTNode {
static type = 'CompactLink';

title: string;
endpoint: NavigationEndpoint;
style: string;
public title: string;
public subtitle?: Text;
public endpoint: NavigationEndpoint;
public style: string;
public icon_type?: string;
public secondary_icon_type?: string;

constructor(data: RawNode) {
super();
this.title = new Text(data.title).toString();
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);

if ('subtitle' in data)
this.subtitle = new Text(data.subtitle);

if ('icon' in data && 'iconType' in data.icon)
this.icon_type = data.icon.iconType;

if ('secondaryIcon' in data && 'iconType' in data.secondaryIcon)
this.secondary_icon_type = data.secondaryIcon.iconType;

this.endpoint = new NavigationEndpoint(data.navigationEndpoint || data.serviceEndpoint);
this.style = data.style;
}
}

0 comments on commit 6d57353

Please sign in to comment.