refactor: fix inconsistencies in the guide nodes (#379)

This commit is contained in:
LuanRT
2023-04-11 05:52:47 -03:00
committed by GitHub
parent 342d1d95e9
commit ec9c0979f5
6 changed files with 43 additions and 60 deletions

View File

@@ -1,35 +1,19 @@
import Text from './misc/Text.js';
import { YTNode } from '../helpers.js';
import Parser from '../parser.js';
import GuideEntry from './GuideEntry.js';
import type { RawNode } from '../index.js';
import { YTNode } from '../helpers.js';
class GuideCollapsibleEntry extends YTNode {
export default class GuideCollapsibleEntry extends YTNode {
static type = 'GuideCollapsibleEntry';
expander_item: {
title: string,
icon_type: string
};
collapser_item: {
title: string,
icon_type: string
};
expander_item: GuideEntry | null;
collapser_item: GuideEntry | null;
expandable_items;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.expander_item = {
title: new Text(data.expanderItem.guideEntryRenderer.formattedTitle).toString(),
icon_type: data.expanderItem.guideEntryRenderer.icon.iconType
};
this.collapser_item = {
title: new Text(data.collapserItem.guideEntryRenderer.formattedTitle).toString(),
icon_type: data.collapserItem.guideEntryRenderer.icon.iconType
};
this.expander_item = Parser.parseItem(data.expanderItem, GuideEntry);
this.collapser_item = Parser.parseItem(data.collapserItem, GuideEntry);
this.expandable_items = Parser.parseArray(data.expandableItems);
}
}
export default GuideCollapsibleEntry;
}