commencement de la 'page search'
This commit is contained in:
parent
5f4ecfc7b3
commit
58d80d1a6b
47 changed files with 889 additions and 84 deletions
|
|
@ -1 +0,0 @@
|
|||
<p>page-search works!</p>
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-search',
|
||||
templateUrl: './page-search.component.html',
|
||||
styleUrls: ['./page-search.component.scss']
|
||||
})
|
||||
export class PageSearchComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
77
src/app/user/search/page-search/page-search.component.html
Normal file
77
src/app/user/search/page-search/page-search.component.html
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<div class="conteneur">
|
||||
|
||||
<!-- Navbar -->
|
||||
<div style="margin-bottom: 50px">
|
||||
<app-nav-bar pour="user"></app-nav-bar>
|
||||
</div>
|
||||
|
||||
<!-- ---------------------------------------------------------------------------------------------------------- -->
|
||||
|
||||
<!-- bloc du milieu: niveau 1 -->
|
||||
<div class="row blocMilieu1">
|
||||
|
||||
<!-- pub de gauche -->
|
||||
<div class="col-2">
|
||||
<div class="conteneurPubGauche">
|
||||
<app-pub></app-pub>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ------------------------- -->
|
||||
|
||||
<!-- bloc du milieu: niveau 2 -->
|
||||
<div class="col-8">
|
||||
|
||||
<!-- Search bar -->
|
||||
<div class="row" style="margin-bottom: 10px">
|
||||
<div>
|
||||
<input type="search" placeholder="recherche..." class="inputSearchBar" [(ngModel)]="search">
|
||||
<button class="btnRechercher" (click)="onSearch()"> Rechercher </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Site de streaming -->
|
||||
<div class="row" style="margin-bottom: 10px">
|
||||
<div>
|
||||
<span *ngFor="let plateforme of tabPlateform">
|
||||
|
||||
<input type="checkbox" [id]="plateforme.name" [name]="plateforme.name" style="margin-left: 5px" [(ngModel)]="plateforme.isSelected">
|
||||
<img [src]="'/assets/logo_plateforms/'+plateforme.name+'.png'" alt="image" width="25px" height="25px" style="margin-left: 5px">
|
||||
<label [for]="plateforme.name" style="margin-left: 5px"> {{plateforme.name}}</label>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Grille des videos -->
|
||||
<div class="row">
|
||||
<app-video-grid [tabVideo]="tabVideo"></app-video-grid>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ------------------------- -->
|
||||
|
||||
<!-- pub de droite -->
|
||||
<div class="col-2">
|
||||
<div class="conteneurPubDroite">
|
||||
<app-pub></app-pub>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ---------------------------------------------------------------------------------------------------------- -->
|
||||
|
||||
<!-- pub du bas-->
|
||||
<div class="row">
|
||||
<div class="col-2"></div>
|
||||
<div class="col-8">
|
||||
<div class="conteneurPubBas">
|
||||
<app-pub></app-pub>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
41
src/app/user/search/page-search/page-search.component.scss
Normal file
41
src/app/user/search/page-search/page-search.component.scss
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
.conteneur {
|
||||
text-align: center;
|
||||
max-width: 100%;
|
||||
max-height: 100vh;
|
||||
overflow-x: hidden;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.blocMilieu1 {
|
||||
height: 70vh;
|
||||
margin-bottom: 70px
|
||||
}
|
||||
|
||||
.inputSearchBar {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.btnRechercher {
|
||||
border: solid black 1px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.conteneurPubGauche {
|
||||
border: solid black 2px;
|
||||
height: 75vh;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.conteneurPubDroite {
|
||||
border: solid black 2px;
|
||||
height: 75vh;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.conteneurPubBas {
|
||||
//width: 80%;
|
||||
//margin-left: auto;
|
||||
//margin-right: auto;
|
||||
height: 100%;
|
||||
border: solid black 2px;
|
||||
}
|
||||
79
src/app/user/search/page-search/page-search.component.ts
Normal file
79
src/app/user/search/page-search/page-search.component.ts
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {FictitiousDatasService} from "../../../utils/services/fictitiousDatas/fictitious-datas.service";
|
||||
import {PlaylistService} from "../../../utils/services/playlist/playlist.service";
|
||||
import {Video} from "../../../utils/interfaces/video";
|
||||
|
||||
|
||||
|
||||
let TAB_PLATEFORM = [
|
||||
{ name: "Youtube", isSelected: false },
|
||||
{ name: "Dailymotion", isSelected: false }
|
||||
];
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-search',
|
||||
templateUrl: './page-search.component.html',
|
||||
styleUrls: ['./page-search.component.scss']
|
||||
})
|
||||
export class PageSearchComponent implements OnInit
|
||||
{
|
||||
tabPlateform = TAB_PLATEFORM;
|
||||
tabVideo: Video[] = [];
|
||||
search: string = "";
|
||||
|
||||
|
||||
constructor( private messageService: MessageService,
|
||||
private fictitiousDatasService: FictitiousDatasService) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
// --- DONNEES FICTIVES ---
|
||||
this.tabVideo = this.fictitiousDatasService.load_pageSeach(7);
|
||||
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
let tabPlateformName = [];
|
||||
for(let plateform of this.tabPlateform) tabPlateformName.push(plateform.name);
|
||||
let data = { search: "", plaateforms: tabPlateformName };
|
||||
this.messageService
|
||||
.sendMessage("user/searchVideo", data)
|
||||
.subscribe(retour => {
|
||||
if(retour.status === "error") console.log(retour.data);
|
||||
else this.tabVideo = retour.data;
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
onSearch()
|
||||
{
|
||||
// --- DONNEES FICTIVES ---
|
||||
console.log(this.tabPlateform)
|
||||
this.tabVideo = [];
|
||||
console.log(this.tabVideo)
|
||||
//this.fictitiousDatasService.load_pageSeach(4);
|
||||
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
let tabPlateformName = [];
|
||||
for(let plateform of this.tabPlateform)
|
||||
{
|
||||
if(plateform.isSelected) tabPlateformName.push(plateform.name);
|
||||
}
|
||||
let data = { search: "", plaateforms: tabPlateformName };
|
||||
this.messageService
|
||||
.sendMessage("user/searchVideo", data)
|
||||
.subscribe(retour => {
|
||||
if(retour.status === "error") console.log(retour.data);
|
||||
else this.tabVideo = retour.data;
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
9
src/app/user/search/video-cell/video-cell.component.html
Normal file
9
src/app/user/search/video-cell/video-cell.component.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
|
||||
<div class="conteneur">
|
||||
<iframe [src]=safeUrl allowfullscreen></iframe>
|
||||
<span>{{video.title}}</span>
|
||||
<button mat-icon-button (click)="onAdd()">
|
||||
<mat-icon > add_circle </mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
5
src/app/user/search/video-cell/video-cell.component.scss
Normal file
5
src/app/user/search/video-cell/video-cell.component.scss
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.conteneur {
|
||||
text-align: center;
|
||||
//border: solid black 2px;
|
||||
//border-radius: 5px;
|
||||
}
|
||||
25
src/app/user/search/video-cell/video-cell.component.spec.ts
Normal file
25
src/app/user/search/video-cell/video-cell.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { VideoCellComponent } from './video-cell.component';
|
||||
|
||||
describe('RectangleVideoComponent', () => {
|
||||
let component: VideoCellComponent;
|
||||
let fixture: ComponentFixture<VideoCellComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ VideoCellComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(VideoCellComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
33
src/app/user/search/video-cell/video-cell.component.ts
Normal file
33
src/app/user/search/video-cell/video-cell.component.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {VideoUrlService} from "../../../utils/services/videoUrl/video-url.service";
|
||||
import {PlaylistService} from "../../../utils/services/playlist/playlist.service";
|
||||
import {Video} from "../../../utils/interfaces/video";
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-video-cell',
|
||||
templateUrl: './video-cell.component.html',
|
||||
styleUrls: ['./video-cell.component.scss']
|
||||
})
|
||||
export class VideoCellComponent implements OnInit
|
||||
{
|
||||
@Input() video: Video;
|
||||
safeUrl;
|
||||
|
||||
|
||||
constructor( private videoUrlService: VideoUrlService,
|
||||
private playlistService: PlaylistService ) {}
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.safeUrl = this.videoUrlService.safeUrl(this.video.url);
|
||||
}
|
||||
|
||||
|
||||
onAdd(): void
|
||||
{
|
||||
this.playlistService.addVideoToPlaylists(this.video)
|
||||
console.log("onAdd:" + this.video.title);
|
||||
}
|
||||
}
|
||||
11
src/app/user/search/video-grid/video-grid.component.html
Normal file
11
src/app/user/search/video-grid/video-grid.component.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<div class="conteneur">
|
||||
<nav>
|
||||
<ul>
|
||||
<li class="row ligne" *ngFor="let triplet of tabTriplet">
|
||||
<div class="col-4" *ngFor="let video0 of triplet">
|
||||
<app-video-cell [video]="video0"></app-video-cell>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
13
src/app/user/search/video-grid/video-grid.component.scss
Normal file
13
src/app/user/search/video-grid/video-grid.component.scss
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
.conteneur {
|
||||
border: solid black 2px;
|
||||
}
|
||||
|
||||
nav ul {
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
height: 66vh;
|
||||
}
|
||||
|
||||
.ligne {
|
||||
margin: 30px 0px 30px 0px;
|
||||
}
|
||||
25
src/app/user/search/video-grid/video-grid.component.spec.ts
Normal file
25
src/app/user/search/video-grid/video-grid.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { VideoGridComponent } from './video-grid.component';
|
||||
|
||||
describe('VideoGridComponent', () => {
|
||||
let component: VideoGridComponent;
|
||||
let fixture: ComponentFixture<VideoGridComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ VideoGridComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(VideoGridComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
34
src/app/user/search/video-grid/video-grid.component.ts
Normal file
34
src/app/user/search/video-grid/video-grid.component.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
|
||||
import {Video} from "../../../utils/interfaces/video";
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-video-grid',
|
||||
templateUrl: './video-grid.component.html',
|
||||
styleUrls: ['./video-grid.component.scss']
|
||||
})
|
||||
export class VideoGridComponent implements OnChanges
|
||||
{
|
||||
@Input() tabVideo: Video[] = [];
|
||||
tabTriplet = [];
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void
|
||||
{
|
||||
this.tabTriplet = [];
|
||||
let n = this.tabVideo.length;
|
||||
let i = 0;
|
||||
while(i < n)
|
||||
{
|
||||
let triplet = []
|
||||
let compteur = 0;
|
||||
while((compteur < 3) && (i < n))
|
||||
{
|
||||
triplet.push(this.tabVideo[i]);
|
||||
i++ ;
|
||||
compteur++ ;
|
||||
}
|
||||
this.tabTriplet.push(triplet)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in a new issue