Skip to content

Commit

Permalink
feat(Parser): Add MusicResponsiveHeader node
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Apr 29, 2024
1 parent 0ba8c54 commit ea82bea
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/parser/classes/MusicResponsiveHeader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Parser, type RawNode } from '../index.js';
import { YTNode } from '../helpers.js';
import MusicThumbnail from './MusicThumbnail.js';
import MusicDescriptionShelf from './MusicDescriptionShelf.js';
import MusicInlineBadge from './MusicInlineBadge.js';
import MusicPlayButton from './MusicPlayButton.js';
import ToggleButton from './ToggleButton.js';
import Menu from './menus/Menu.js';

import type { ObservedArray } from '../helpers.js';

export default class MusicResponsiveHeader extends YTNode {
static type = 'MusicResponsiveHeader';

thumbnail: MusicThumbnail | null;
buttons: ObservedArray<ToggleButton | MusicPlayButton | Menu> | null;
title: Text;
subtitle: Text;
strapline_text_one: Text;
strapline_thumbnail: MusicThumbnail | null;
second_subtitle: Text;
subtitle_badge?: ObservedArray<MusicInlineBadge> | null;
description?: MusicDescriptionShelf | null;

constructor(data: RawNode) {
super();
this.thumbnail = Parser.parseItem(data.thumbnail, MusicThumbnail);
this.buttons = Parser.parseArray(data.buttons, [ ToggleButton, MusicPlayButton, Menu ]);
this.title = new Text(data.title);
this.subtitle = new Text(data.subtitle);
this.strapline_text_one = new Text(data.straplineTextOne);
this.strapline_thumbnail = Parser.parseItem(data.straplineThumbnail, MusicThumbnail);
this.second_subtitle = new Text(data.secondSubtitle);

if (Reflect.has(data, 'subtitleBadge')) {
this.subtitle_badge = Parser.parseArray(data.subtitleBadge, MusicInlineBadge);
}

if (Reflect.has(data, 'description')) {
this.description = Parser.parseItem(data.description, MusicDescriptionShelf);
}
}
}
1 change: 1 addition & 0 deletions src/parser/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export { default as MusicNavigationButton } from './classes/MusicNavigationButto
export { default as MusicPlayButton } from './classes/MusicPlayButton.js';
export { default as MusicPlaylistShelf } from './classes/MusicPlaylistShelf.js';
export { default as MusicQueue } from './classes/MusicQueue.js';
export { default as MusicResponsiveHeader } from './classes/MusicResponsiveHeader.js';
export { default as MusicResponsiveListItem } from './classes/MusicResponsiveListItem.js';
export { default as MusicResponsiveListItemFixedColumn } from './classes/MusicResponsiveListItemFixedColumn.js';
export { default as MusicResponsiveListItemFlexColumn } from './classes/MusicResponsiveListItemFlexColumn.js';
Expand Down

0 comments on commit ea82bea

Please sign in to comment.