Skip to content

Commit ef5f795

Browse files
committed
first stable version
1 parent f84e9f3 commit ef5f795

File tree

36 files changed

+740
-96
lines changed

36 files changed

+740
-96
lines changed

src/initialState.ts

Lines changed: 116 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,139 @@ import {
22

33
AppState,
44

5-
VideoSearchBar
5+
VideoSearchBar,
6+
VideoDetailModel
67

78
} from './modules/domain';
89

910
export const appState: AppState = {
1011
interfaceConfiguration: {
1112
commonConfiguration: {
1213
videoComplete: {
13-
byId: {},
14-
allIds: []
14+
byId: {
15+
"1": {
16+
id: "1",
17+
videoId: "1",
18+
videoDetailId: "1"
19+
},
20+
"2": {
21+
id: "2",
22+
videoId: "2",
23+
videoDetailId: "2"
24+
},
25+
"3": {
26+
id: "3",
27+
videoId: "3",
28+
videoDetailId: "3"
29+
},
30+
"4": {
31+
id: "4",
32+
videoId: "4",
33+
videoDetailId: "4"
34+
},
35+
"5": {
36+
id: "5",
37+
videoId: "5",
38+
videoDetailId: "5"
39+
}
40+
},
41+
allIds: ["1","2","3","4","5"]
1542
},
1643
videoDetailMap: {
17-
byId: {},
18-
allIds: []
44+
byId: {
45+
"1": {
46+
id: "1",
47+
title: "La Familia es para Siempre - Parkour Manizales - Gravedad Zero",
48+
description: "La nueva entrega, esperamos lo disfruten tanto como nosotros grabando, han sido muchas aventuras, sonrisas, viajes, tiempo compartido en familia.",
49+
url: "b9iV7Ks_XYQ"
50+
},
51+
"2": {
52+
id: "2",
53+
title: "Gravedad Zero Parkour Manizales - Pitman",
54+
description: "Después de una fractura que duró al rededor de 5 meses, un integrante de Gravedad Zero vuelve a los entrenamientos, con toda la dedicación, entrega y amor ...",
55+
url: "auRGCCzISNY"
56+
},
57+
"3": {
58+
id: "3",
59+
title: "¡ Especial de Navidad ! Gravedad Zero - Parkour Manizales !",
60+
description: "Song: Carol Of The Bells (Dubstep) Traceurs: Cale - https:www.facebook.comCamiloGarcia.3Run?fref=ts Nitram ...",
61+
url: "3q4es97LrvI"
62+
},
63+
"4": {
64+
id: "4",
65+
title: "¡ Nunca Caigas ! ¡ Parkour Manizales Gravedad Zero ! ¡Traceur Nitram !",
66+
description: "Gran Traceur, gran amigo, gran hermano.. Hermano, espero que se recupere pronto!! Lo amo mucho!! Empezamos juntos, acabamos juntos!!",
67+
url: "gaGkmSVnm_A"
68+
},
69+
"5": {
70+
id: "5",
71+
title: "Medesplazo 2016 || Gravedad Zero Parkour Manizales",
72+
description: "Esta fue una experiencia excelente, esperamos tener muchos mas viajes para poder compartir mas momentos juntos. compartan :D.",
73+
url: "0FYi7gK8894"
74+
},
75+
},
76+
allIds: ["1","2","3","4","5"]
1977
},
2078
videosMap: {
21-
byId: {},
22-
allIds: []
79+
byId: {
80+
"1": {
81+
id:"1",
82+
title:"La Familia es para Siempre - Parkour Manizales - Gravedad Zero",
83+
videoImgUrl:"https://i.ytimg.com/vi/b9iV7Ks_XYQ/mqdefault.jpg",
84+
videoDetailId:"1"
85+
},
86+
"2": {
87+
id:"2",
88+
title: "Gravedad Zero Parkour Manizales - Pitman",
89+
videoImgUrl: "https://i.ytimg.com/vi/auRGCCzISNY/mqdefault.jpg",
90+
videoDetailId: "2"
91+
},
92+
"3": {
93+
id:"3",
94+
title: "¡ Especial de Navidad ! Gravedad Zero - Parkour Manizales !",
95+
videoImgUrl: "https://i.ytimg.com/vi/3q4es97LrvI/mqdefault.jpg",
96+
videoDetailId: "3"
97+
},
98+
"4": {
99+
id:"4",
100+
title: "¡ Nunca Caigas ! ¡ Parkour Manizales Gravedad Zero ! ¡Traceur Nitram !",
101+
videoImgUrl: "https://i.ytimg.com/vi/gaGkmSVnm_A/mqdefault.jpg",
102+
videoDetailId: "4"
103+
},
104+
"5": {
105+
id:"5",
106+
title: "Medesplazo 2016 || Gravedad Zero Parkour Manizales",
107+
videoImgUrl: "https://i.ytimg.com/vi/0FYi7gK8894/mqdefault.jpg",
108+
videoDetailId: "5"
109+
},
110+
},
111+
allIds: ["1","2","3","4","5"]
23112
}
24113
}
25114
},
26115
ui: {
27116
videoSearchBarModule: {
28117
videoSearchViewModel: new VideoSearchBar.VideoSearchViewModel()
118+
},
119+
videoDetailModule: {
120+
videoDetailViewModel: {
121+
videoSelected: {
122+
id: "1",
123+
description: "La nueva entrega, esperamos lo disfruten tanto como nosotros grabando, han sido muchas aventuras, sonrisas, viajes, tiempo compartido en familia.",
124+
title: "La Familia es para Siempre - Parkour Manizales - Gravedad Zero",
125+
url: "b9iV7Ks_XYQ"
126+
}
127+
}
128+
},
129+
videoPlayerModule: {
130+
videoPlayerViewModel: {
131+
videoSelected: {
132+
id: "1",
133+
description: "La nueva entrega, esperamos lo disfruten tanto como nosotros grabando, han sido muchas aventuras, sonrisas, viajes, tiempo compartido en familia.",
134+
title: "La Familia es para Siempre - Parkour Manizales - Gravedad Zero",
135+
url: "b9iV7Ks_XYQ"
136+
}
137+
}
29138
}
30139
}
31140
};

src/modules/app/reducers.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ import {
88
} from '../domain';
99

1010
import * as VideoSearchBar from '../video-search-bar';
11+
import * as VideoDetail from '../video-detail';
12+
import * as VideoPlayer from '../video-player';
1113

1214
export namespace Reducers {
1315

1416
export const ui: Reducer<UI> = combineReducers<UI>({
15-
videoSearchBarModule: VideoSearchBar.Reducers.videoSearchBarModule
17+
videoSearchBarModule: VideoSearchBar.Reducers.videoSearchBarModule,
18+
videoDetailModule: VideoDetail.Reducers.videoDetailModule,
19+
videoPlayerModule: VideoPlayer.Reducers.videoPlayerModule
1620
});
1721
}

src/modules/domain/common.ts

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
1-
export namespace Common{
1+
import axios, { AxiosPromise, AxiosResponse } from 'axios';
2+
import YTSearch from 'youtube-api-search';
3+
4+
import {
5+
6+
VideoSearchBar
7+
8+
} from './';
9+
10+
import {
11+
12+
ActionResultDTO
13+
14+
} from '../utils';
15+
16+
export namespace Common {
217

318
export const YOUTUBE_URL = 'https://www.googleapis.com/youtube/v3/search';
419
export const API_KEY = 'AIzaSyAvucYb8pcxTx20CHE6StwLF8iGT76K1RA';
20+
21+
export namespace Services {
22+
23+
export class VideoSearchServices {
24+
25+
26+
public searchVideos(videoSearchName: string): AxiosPromise {
27+
28+
const params = {
29+
part: 'snippet',
30+
key: API_KEY,
31+
q: videoSearchName,
32+
type: 'video'
33+
};
34+
35+
const request = axios.get(YOUTUBE_URL, { params: params });
36+
37+
return request;
38+
}
39+
40+
public mapVideosList(response: AxiosResponse): VideoSearchBar.VideoSearchViewModel {
41+
42+
let videoSearchViewModel = new VideoSearchBar.VideoSearchViewModel();
43+
44+
response.data.items.map((item) => {
45+
46+
let videoDTO = new VideoSearchBar.VideoDTO();
47+
48+
videoDTO.id = item.id.videoId;
49+
videoDTO.title = item.snippet.title;
50+
videoDTO.imageUrl = item.snippet.thumbnails.medium.url;
51+
videoDTO.detail = item.snippet.description;
52+
videoDTO.url = item.id.videoId;
53+
54+
videoSearchViewModel.videoSearchDTO.searchResult.push(videoDTO);
55+
});
56+
57+
return videoSearchViewModel;
58+
}
59+
}
60+
}
561
}

src/modules/domain/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ export * from './services';
66
export * from './common';
77
export * from './actions';
88
export * from './actionTypes';
9-
export * from './videoSearchBar';
9+
export * from './videoSearchBar';
10+
export * from './videoDetail';
11+
export * from './videoPlayer';

src/modules/domain/models.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class Video{
1818

1919
class VideoDetail{
2020
id: string;
21-
detail: string;
21+
title: string;
22+
description: string;
2223
url: string;
2324
}
2425

src/modules/domain/selectors.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ export namespace Selectors{
111111
export const getVideoDetailById = (videoDetailId:string) => {
112112
return createSelector(
113113
getVideosDetailList,
114-
(videosList:Array<VideoDetail>): VideoDetail => {
115-
return videosList.find((videoDetail:VideoDetail)=> videoDetail.id == videoDetailId);
114+
(videosList:Array<VideoDetail>): Array<VideoDetail> => {
115+
return videosList.filter((videoDetail:VideoDetail) => {
116+
return videoDetail.id == videoDetailId
117+
});
116118
}
117-
);
119+
);
118120
};
119121
}
120122

src/modules/domain/services.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import * as u from 'updeep';
2-
import axios from 'axios';
3-
import YTSearch from 'youtube-api-search';
42

53
import {
64

src/modules/domain/state.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
import {
22
InterfaceConfiguration,
3-
VideoSearchBar
3+
VideoSearchBar,
4+
VideoDetailModel,
5+
VideoPlayerModel
46
} from './';
57

68
class VideoSearchBarModule{
7-
videoSearchViewModel: VideoSearchBar.VideoSearchViewModel
9+
videoSearchViewModel: VideoSearchBar.VideoSearchViewModel;
10+
}
11+
12+
class VideoDetailModule{
13+
videoDetailViewModel: VideoDetailModel.VideoDetailViewModel;
14+
}
15+
16+
class VideoPlayerModule{
17+
videoPlayerViewModel: VideoPlayerModel.VideoPlayerViewModel
818
}
919

1020
class UI{
1121
videoSearchBarModule: VideoSearchBarModule;
22+
videoDetailModule: VideoDetailModule;
23+
videoPlayerModule: VideoPlayerModule;
1224
}
1325

1426
class AppState{
@@ -20,5 +32,7 @@ export
2032
{
2133
AppState,
2234
UI,
23-
VideoSearchBarModule
35+
VideoSearchBarModule,
36+
VideoDetailModule,
37+
VideoPlayerModule
2438
}

src/modules/domain/videoDetail.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
3+
VideoDetail
4+
5+
} from './';
6+
7+
export namespace VideoDetailModel {
8+
9+
export class VideoDetailViewModel {
10+
11+
constructor(){
12+
this.videoSelected = new VideoDetail();
13+
}
14+
15+
videoSelected: VideoDetail;
16+
}
17+
}

src/modules/domain/videoPlayer.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
3+
VideoDetail
4+
5+
} from './';
6+
7+
export namespace VideoPlayerModel {
8+
9+
export class VideoPlayerViewModel {
10+
11+
constructor(){
12+
this.videoSelected = new VideoDetail();
13+
}
14+
15+
videoSelected: VideoDetail;
16+
}
17+
}

0 commit comments

Comments
 (0)