commencement de la 'page search'

This commit is contained in:
MiharyR 2021-10-27 01:48:30 +02:00
parent 5f4ecfc7b3
commit 58d80d1a6b
47 changed files with 889 additions and 84 deletions

View file

@ -1 +0,0 @@
<p>page-search works!</p>

View file

@ -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 {
}
}

View 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"> &nbsp;
<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">
&nbsp;
<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>
&nbsp;
</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>

View 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;
}

View 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;
});
*/
}
}

View 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>

View file

@ -0,0 +1,5 @@
.conteneur {
text-align: center;
//border: solid black 2px;
//border-radius: 5px;
}

View 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();
});
});

View 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);
}
}

View 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>

View 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;
}

View 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();
});
});

View 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)
}
}
}