File tree Expand file tree Collapse file tree 6 files changed +119
-1
lines changed Expand file tree Collapse file tree 6 files changed +119
-1
lines changed Original file line number Diff line number Diff line change 67
67
<p>{{ trendingFirst.stats.views | number:'1.0' }}</p>
68
68
<p>{{ trendingFirst.stats.videoCount | number:'1.0' }}</p>-->
69
69
</ div >
70
+ < div class ="categories ">
71
+ < div *ngFor ="let category of categories.items " id ="category-{{category.id}} ">
72
+ < p > {{category.snippet.title}}</ p >
73
+ </ div >
74
+ </ div >
70
75
< div id ="feed-video-list " class ="video-list " [ngClass] ="{'grid-list': !listGrid } ">
71
76
< div *ngFor ="let feedVideo of feedVideos; let i = index " [ngClass] ="{'hidden-thumbnails': !thumbnails } " [attr.data-index] ="i " class ="video-item ">
72
77
< div class ="video-item-info ">
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export class SearchComponent implements OnInit {
22
22
videos : Array < ISearchVideo > ;
23
23
feedVideos : Array < IFeedVideo > ;
24
24
channel : IChannelList ;
25
+ categories : any ;
25
26
26
27
_shared : any ;
27
28
_app : any ;
@@ -62,6 +63,21 @@ export class SearchComponent implements OnInit {
62
63
this . setSettings ( ) ;
63
64
this . searchFunction ( ) ;
64
65
this . getFeedVideos ( ) ;
66
+ this . initCategories ( ) ;
67
+ }
68
+
69
+ initCategories ( ) {
70
+ this . _shared . getCategories ( ) . subscribe (
71
+ data => {
72
+ this . categories = data ;
73
+ console . log ( this . categories ) ;
74
+ }
75
+ ) ;
76
+ this . _shared . getVideoCategories ( 2 ) . subscribe (
77
+ result => {
78
+ console . log ( result ) ;
79
+ }
80
+ ) ;
65
81
}
66
82
67
83
searchFunction ( ) {
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ export class SharedService {
12
12
public historyVideos : Array < any > = [ ] ;
13
13
public settings : any ;
14
14
public channel : any ;
15
+ public categories : any ;
16
+ public videoCategories : any ;
15
17
public playlist : Array < any > ;
16
18
17
19
_update : any ;
@@ -73,6 +75,46 @@ export class SharedService {
73
75
} ) ;
74
76
}
75
77
78
+ getCategories ( ) : Observable < any > {
79
+ return new Observable ( observer => {
80
+ if ( this . categories ) {
81
+ observer . next ( this . categories ) ;
82
+ return observer . complete ( ) ;
83
+ } else {
84
+ this . youtube . categories ( ) . subscribe (
85
+ result => {
86
+ this . categories = result ;
87
+ observer . next ( this . categories ) ;
88
+ observer . complete ( ) ;
89
+ } ,
90
+ error => {
91
+ console . log ( error ) ;
92
+ }
93
+ ) ;
94
+ }
95
+ } ) ;
96
+ }
97
+
98
+ getVideoCategories ( value : number ) : Observable < any > {
99
+ return new Observable ( observer => {
100
+ if ( this . videoCategories ) {
101
+ observer . next ( this . videoCategories ) ;
102
+ return observer . complete ( ) ;
103
+ } else {
104
+ this . youtube . videoCategories ( value ) . subscribe (
105
+ result => {
106
+ this . videoCategories = result ;
107
+ observer . next ( this . videoCategories ) ;
108
+ observer . complete ( ) ;
109
+ } ,
110
+ error => {
111
+ console . log ( error ) ;
112
+ }
113
+ ) ;
114
+ }
115
+ } ) ;
116
+ }
117
+
76
118
getSettings ( ) : Observable < any > {
77
119
return new Observable ( observer => {
78
120
if ( this . settings ) {
Original file line number Diff line number Diff line change @@ -88,4 +88,27 @@ export class YoutubeGetVideo {
88
88
. map ( response => response ) ;
89
89
}
90
90
}
91
+
92
+ categories ( ) {
93
+ if ( this . apiKey ) {
94
+ return this . http . get (
95
+ this . url + 'videoCategories?part=snippet®ionCode='
96
+ + this . regionCode + '&key='
97
+ + this . apiKey
98
+ )
99
+ . map ( response => response ) ;
100
+ }
101
+ }
102
+
103
+ videoCategories ( category : number ) {
104
+ if ( this . apiKey ) {
105
+ return this . http . get (
106
+ this . url + 'videos?part=snippet,contentDetails&chart=mostPopular&maxResults=25&videoCategoryId='
107
+ + category + '®ionCode='
108
+ + this . regionCode + '&key='
109
+ + this . apiKey
110
+ )
111
+ . map ( response => response ) ;
112
+ }
113
+ }
91
114
}
Original file line number Diff line number Diff line change 67
67
margin-top : 20px ;
68
68
align-items : center ;
69
69
}
70
+ }
71
+
72
+ .categories {
73
+ display : flex ;
74
+ flex-wrap : nowrap ;
75
+ width : 100% ;
76
+ height : 69px ;
77
+ overflow-x : scroll ;
78
+ > div {
79
+ width : 80px ;
80
+ flex : 0 0 80px ;
81
+ }
82
+ p {
83
+ margin : 0 ;
84
+ }
85
+ & ::-webkit-scrollbar-track {
86
+ border-radius : 2px ;
87
+ }
88
+
89
+ & ::-webkit-scrollbar {
90
+ height : 6px ;
91
+ background-color : transparent ;
92
+ }
93
+
94
+ & ::-webkit-scrollbar-thumb {
95
+ border-radius : 20px ;
96
+ background-color : rgba (#FFF , 0.1 );
97
+ & :hover {
98
+ background-color : rgba (#FFF , 0.4 );
99
+ }
100
+ }
70
101
}
Original file line number Diff line number Diff line change @@ -322,6 +322,7 @@ iframe {
322
322
.video-list-featured {
323
323
margin : 0 ;
324
324
height : 200px ;
325
+ width : 100% ;
325
326
background-position : center center ;
326
327
background-size : cover ;
327
328
position : relative ;
@@ -386,7 +387,7 @@ iframe {
386
387
#feed-video-list {
387
388
top : inherit ;
388
389
bottom : 0 ;
389
- height : calc (100% - 200 px );
390
+ height : calc (100% - 270 px );
390
391
width : calc (100% - 40px );
391
392
max-height : none ;
392
393
background-color : var (--c-gray );
You can’t perform that action at this time.
0 commit comments