-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
VideoMetadataCarouselView
(#839)
- Loading branch information
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { Parser, type RawNode } from '../index.js'; | ||
import TextCarouselItemView from './TextCarouselItemView.js'; | ||
|
||
export default class CarouselItemView extends YTNode { | ||
static type = 'CarouselItemView'; | ||
|
||
item_type: string; | ||
carousel_item: TextCarouselItemView | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.item_type = data.itemType; | ||
this.carousel_item = Parser.parseItem(data.carouselItem, TextCarouselItemView); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { Parser, type RawNode } from '../index.js'; | ||
import ButtonView from './ButtonView.js'; | ||
|
||
export default class CarouselTitleView extends YTNode { | ||
static type = 'CarouselTitleView'; | ||
|
||
title: string; | ||
previous_button: ButtonView | null; | ||
next_button: ButtonView | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = data.title; | ||
this.previous_button = Parser.parseItem(data.previousButton, ButtonView); | ||
this.next_button = Parser.parseItem(data.nextButton, ButtonView); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { Parser, type RawNode } from '../index.js'; | ||
import { Text } from '../misc.js'; | ||
import ButtonView from './ButtonView.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
|
||
export default class TextCarouselItemView extends YTNode { | ||
static type = 'TextCarouselItemView'; | ||
|
||
icon_name: string; | ||
text: Text; | ||
on_tap_endpoint: NavigationEndpoint; | ||
button: ButtonView | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.icon_name = data.iconName; | ||
this.text = Text.fromAttributed(data.text); | ||
this.on_tap_endpoint = new NavigationEndpoint(data.onTap); | ||
this.button = Parser.parseItem(data.button, ButtonView); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { YTNode, type ObservedArray } from '../helpers.js'; | ||
import { Parser, type RawNode } from '../index.js'; | ||
import CarouselItemView from './CarouselItemView.js'; | ||
import CarouselTitleView from './CarouselTitleView.js'; | ||
|
||
export default class VideoMetadataCarouselView extends YTNode { | ||
static type = 'VideoMetadataCarouselView'; | ||
|
||
carousel_titles: ObservedArray<CarouselTitleView> | null; | ||
carousel_items: ObservedArray<CarouselItemView> | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.carousel_titles = Parser.parse(data.carouselTitles, true, CarouselTitleView); | ||
this.carousel_items = Parser.parse(data.carouselItems, true, CarouselItemView); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters