commencement de la 'page search'
This commit is contained in:
parent
5f4ecfc7b3
commit
58d80d1a6b
47 changed files with 889 additions and 84 deletions
|
|
@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule, Routes } from '@angular/router';
|
||||
import {PageConnexionComponent} from './pourLes3Roles/page-connexion/page-connexion.component';
|
||||
import {PageRegisterComponent} from './pourLes3Roles/register/page-register/page-register.component';
|
||||
import {PageSearchComponent} from "./user/page-search/page-search.component";
|
||||
import {PageSearchComponent} from "./user/search/page-search/page-search.component";
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: PageConnexionComponent },
|
||||
|
|
|
|||
|
|
@ -5,15 +5,24 @@ import { AppRoutingModule } from './app-routing.module';
|
|||
import { AppComponent } from './app.component';
|
||||
import { PageConnexionComponent } from './pourLes3Roles/page-connexion/page-connexion.component';
|
||||
import { PageRegisterComponent } from './pourLes3Roles/register/page-register/page-register.component';
|
||||
import { NavBarComponent } from './utils/nav-bar/nav-bar.component';
|
||||
import { NavBarComponent } from './utils/components/nav-bar/nav-bar.component';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
|
||||
import {FormsModule} from "@angular/forms";
|
||||
import { PageSearchComponent } from './user/page-search/page-search.component';
|
||||
import { PageSearchComponent } from './user/search/page-search/page-search.component';
|
||||
import {HttpClientModule} from "@angular/common/http";
|
||||
import { PopupConfirmationComponent } from './pourLes3Roles/register/popup-confirmation/popup-confirmation.component';
|
||||
import {MatDialogModule} from '@angular/material/dialog';
|
||||
import {MatButtonModule} from "@angular/material/button";
|
||||
import { PubComponent } from './utils/components/pub/pub.component';
|
||||
import { VideoCellComponent } from './user/search/video-cell/video-cell.component';
|
||||
import { VideoGridComponent } from './user/search/video-grid/video-grid.component';
|
||||
import {MatIconModule} from "@angular/material/icon";
|
||||
import { PopupAddVideoToPlaylistsComponent } from './utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component';
|
||||
import {MatInputModule} from "@angular/material/input";
|
||||
import {MatDividerModule} from "@angular/material/divider";
|
||||
import {MatCheckboxModule} from "@angular/material/checkbox";
|
||||
import {MatFormFieldModule} from "@angular/material/form-field";
|
||||
|
||||
|
||||
@NgModule({
|
||||
|
|
@ -23,7 +32,11 @@ import {MatButtonModule} from "@angular/material/button";
|
|||
PageRegisterComponent,
|
||||
NavBarComponent,
|
||||
PageSearchComponent,
|
||||
PopupConfirmationComponent
|
||||
PopupConfirmationComponent,
|
||||
PubComponent,
|
||||
VideoCellComponent,
|
||||
VideoGridComponent,
|
||||
PopupAddVideoToPlaylistsComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
|
@ -33,7 +46,12 @@ import {MatButtonModule} from "@angular/material/button";
|
|||
FormsModule,
|
||||
HttpClientModule,
|
||||
MatDialogModule,
|
||||
MatButtonModule
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatDividerModule,
|
||||
MatCheckboxModule,
|
||||
MatFormFieldModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<div class="conteneur">
|
||||
|
||||
<app-nav-bar complete="false"></app-nav-bar>
|
||||
<app-nav-bar pour="3roles"></app-nav-bar>
|
||||
|
||||
<div class="boite">
|
||||
<h1> Connexion </h1>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {MessageService} from "../../utils/message/message.service";
|
||||
import {MessageService} from "../../utils/services/message/message.service";
|
||||
import {Router} from "@angular/router";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<div class="conteneur">
|
||||
|
||||
<app-nav-bar complete="false"></app-nav-bar>
|
||||
<app-nav-bar pour="3roles"></app-nav-bar>
|
||||
|
||||
<div class="boite">
|
||||
<h1> Inscription </h1>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {MessageService} from "../../../utils/message/message.service";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {Router} from "@angular/router";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {PopupConfirmationComponent} from "../popup-confirmation/popup-confirmation.component";
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
38
src/app/utils/components/nav-bar/nav-bar.component.html
Normal file
38
src/app/utils/components/nav-bar/nav-bar.component.html
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<!-- pour les 3 roles -->
|
||||
<div *ngIf="pour === '3roles'">
|
||||
<ul>
|
||||
<li>
|
||||
<a routerLink="/connexion" class="StreamNotFound"> StreamNotFound </a>
|
||||
</li>
|
||||
<li style="float:right; margin-right: 20px;">
|
||||
<mat-slide-toggle></mat-slide-toggle>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- pour User -->
|
||||
<div *ngIf="pour === 'user'">
|
||||
<ul>
|
||||
<li>
|
||||
<a routerLink="/search" class="StreamNotFound"> StreamNotFound </a>
|
||||
</li>
|
||||
<li class="cliquable">
|
||||
<a routerLink="/search"> Rechercher </a>
|
||||
</li>
|
||||
<li class="cliquable">
|
||||
<a routerLink="/search"> Mes playlists </a>
|
||||
</li>
|
||||
<li class="cliquable">
|
||||
<a routerLink="/search"> Historique </a>
|
||||
</li>
|
||||
<li style="float:right; margin-right: 20px;">
|
||||
<a routerLink="/search">
|
||||
<mat-icon>settings</mat-icon>
|
||||
</a>
|
||||
</li>
|
||||
<li style="float:right; margin-right: 20px;">
|
||||
<mat-slide-toggle></mat-slide-toggle>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
68
src/app/utils/components/nav-bar/nav-bar.component.scss
Normal file
68
src/app/utils/components/nav-bar/nav-bar.component.scss
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
.StreamNotFound {
|
||||
font-style: oblique;
|
||||
font-family: cursive;
|
||||
font-size: xx-large;
|
||||
}
|
||||
|
||||
|
||||
mat-icon {
|
||||
margin-top: 2px;
|
||||
font-size: xx-large;
|
||||
}
|
||||
|
||||
|
||||
mat-slide-toggle {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: black;
|
||||
height: 70px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
li {
|
||||
float: left;
|
||||
font-size: x-large;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
|
||||
li a {
|
||||
display: block;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
|
||||
.cliquable a:hover:not(.active) {
|
||||
background-color: #c8c8c8;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
::ng-deep .mat-slide-toggle-thumb {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
::ng-deep .mat-slide-toggle-bar {
|
||||
background-color: #c8c8c8;
|
||||
}
|
||||
|
||||
::ng-deep .mat-slide-toggle.mat-checked:not(.mat-disabled) .mat-slide-toggle-thumb {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
::ng-deep .mat-slide-toggle.mat-checked:not(.mat-disabled) .mat-slide-toggle-bar {
|
||||
background-color: #646464;
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ import {Component, Input, OnInit} from '@angular/core';
|
|||
})
|
||||
export class NavBarComponent implements OnInit
|
||||
{
|
||||
@Input() complete = false;
|
||||
@Input() pour = "3roles";
|
||||
|
||||
constructor() { }
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<h3> Ajouter dans </h3>
|
||||
|
||||
|
||||
<mat-divider></mat-divider><!------------------------------------------------------------------------------------------------------------->
|
||||
|
||||
|
||||
<div class="conteneurPlaylists">
|
||||
<div *ngFor="let playlist of tabPlaylistAndBool" style="margin-left: 10px">
|
||||
<mat-checkbox [(ngModel)]="playlist.isSelected"> {{playlist.name}} </mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<mat-divider></mat-divider><!------------------------------------------------------------------------------------------------------------->
|
||||
|
||||
|
||||
<div class="conteneurBtnCreerPlaylist" *ngIf="!goToCreatePlaylist">
|
||||
<button mat-button (click)="goToCreatePlaylist=true">
|
||||
<mat-label>Creer une playlist</mat-label>
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="conteneurInputNewPlaylist" *ngIf="goToCreatePlaylist">
|
||||
<mat-form-field>
|
||||
<mat-label> Nom playlist </mat-label>
|
||||
<input matInput type="text" [(ngModel)]="newPlaylistName">
|
||||
</mat-form-field>
|
||||
<button mat-icon-button (click)="goToCreatePlaylist=false">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<mat-divider></mat-divider><!------------------------------------------------------------------------------------------------------------->
|
||||
|
||||
|
||||
<mat-dialog-actions style="justify-content: flex-end;">
|
||||
<button mat-button mat-dialog-close>Cancel</button>
|
||||
<button mat-button [mat-dialog-close]="true" cdkFocusInitial (click)="onValider">Valider</button>
|
||||
</mat-dialog-actions>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
h3 {
|
||||
text-align: center;
|
||||
margin-bottom: 10px
|
||||
}
|
||||
|
||||
.conteneurPlaylists {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.conteneurBtnCreerPlaylist {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.conteneurInputNewPlaylist {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PopupAddVideoToPlaylistsComponent } from './popup-add-video-to-playlists.component';
|
||||
|
||||
describe('PopupAddVideoToPlaylistsComponent', () => {
|
||||
let component: PopupAddVideoToPlaylistsComponent;
|
||||
let fixture: ComponentFixture<PopupAddVideoToPlaylistsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PopupAddVideoToPlaylistsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PopupAddVideoToPlaylistsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {Video} from "../../interfaces/video";
|
||||
|
||||
@Component({
|
||||
selector: 'app-popup-add-video-to-playlists',
|
||||
templateUrl: './popup-add-video-to-playlists.component.html',
|
||||
styleUrls: ['./popup-add-video-to-playlists.component.scss']
|
||||
})
|
||||
export class PopupAddVideoToPlaylistsComponent implements OnInit
|
||||
{
|
||||
video: Video;
|
||||
tabPlaylistAndBool = [];
|
||||
goToCreatePlaylist = false;
|
||||
newPlaylistName = "";
|
||||
|
||||
constructor( public dialogRef: MatDialogRef<PopupAddVideoToPlaylistsComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.video = this.data.video;
|
||||
const tabPlaylist = this.data.playlists;
|
||||
for(let playlist of tabPlaylist)
|
||||
{
|
||||
playlist["isSelected"] = false;
|
||||
this.tabPlaylistAndBool.push(playlist);
|
||||
}
|
||||
}
|
||||
|
||||
onValider(): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
3
src/app/utils/components/pub/pub.component.html
Normal file
3
src/app/utils/components/pub/pub.component.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div class="conteneur">
|
||||
<h1> Je suis une pub </h1>
|
||||
</div>
|
||||
25
src/app/utils/components/pub/pub.component.spec.ts
Normal file
25
src/app/utils/components/pub/pub.component.spec.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PubComponent } from './pub.component';
|
||||
|
||||
describe('PubComponent', () => {
|
||||
let component: PubComponent;
|
||||
let fixture: ComponentFixture<PubComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PubComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PubComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
19
src/app/utils/components/pub/pub.component.ts
Normal file
19
src/app/utils/components/pub/pub.component.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-pub',
|
||||
templateUrl: './pub.component.html',
|
||||
styleUrls: ['./pub.component.scss']
|
||||
})
|
||||
export class PubComponent implements OnInit
|
||||
{
|
||||
|
||||
constructor() { }
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
10
src/app/utils/interfaces/playlist.ts
Normal file
10
src/app/utils/interfaces/playlist.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import {Video} from "./video";
|
||||
|
||||
export interface Playlist
|
||||
{
|
||||
_id: string,
|
||||
user: any,
|
||||
name: string,
|
||||
count: number
|
||||
videos: Video[]
|
||||
}
|
||||
8
src/app/utils/interfaces/video.ts
Normal file
8
src/app/utils/interfaces/video.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export interface Video
|
||||
{
|
||||
_id: string,
|
||||
url: string,
|
||||
title: string,
|
||||
description: string,
|
||||
views: number
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<div *ngIf="complete">
|
||||
<ul>
|
||||
<li>
|
||||
<a routerLink="/connexion" style="color: white ; background-color: black">
|
||||
StreamNotFound
|
||||
</a>
|
||||
</li>
|
||||
<li style="float:right; margin-right: 20px;">
|
||||
<mat-slide-toggle></mat-slide-toggle>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div *ngIf="!complete">
|
||||
<ul>
|
||||
<li><a href="#home">Home</a></li>
|
||||
<li><a href="#news">News</a></li>
|
||||
<li><a href="#contact">Contact</a></li>
|
||||
<li style="float:right"><a class="active" href="#about">About</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
mat-slide-toggle {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: black;
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
li {
|
||||
float: left;
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
li a {
|
||||
display: block;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
li a:hover:not(.active) {
|
||||
background-color: #5caaff;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: #ff0000;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FictitiousDatasService } from './fictitious-datas.service';
|
||||
|
||||
describe('FictitiousDatasService', () => {
|
||||
let service: FictitiousDatasService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FictitiousDatasService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {Video} from "../../interfaces/video";
|
||||
import {Playlist} from "../../interfaces/playlist";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousDatasService
|
||||
{
|
||||
constructor() { }
|
||||
|
||||
|
||||
load_pageSeach(n: number): Video[]
|
||||
{
|
||||
let tabVideo = [];
|
||||
|
||||
let url0 = "" ;
|
||||
for(let i=0 ; i<n ; i++)
|
||||
{
|
||||
if(i%3 === 0) url0 = "https://www.youtube.com/watch?v=medPORJ8KO0";
|
||||
else if(i%3 === 1) url0 = "https://youtu.be/medPORJ8KO0";
|
||||
else url0 = "https://www.dailymotion.com/video/x7ahxdn";
|
||||
const video: Video = {
|
||||
_id: i.toString(),
|
||||
url: url0,
|
||||
title: "video_" + i,
|
||||
description: "blablabla",
|
||||
views: 59,
|
||||
}
|
||||
tabVideo.push(video)
|
||||
}
|
||||
|
||||
return tabVideo;
|
||||
}
|
||||
|
||||
|
||||
getTabPlaylist()
|
||||
{
|
||||
let tabTabPlaylist: Playlist[] = [];
|
||||
|
||||
for (let i = 0; i < 4; i++)
|
||||
{
|
||||
let playlist: Playlist = {
|
||||
_id: i.toString(),
|
||||
user: null,
|
||||
name: "name_"+i.toString(),
|
||||
count: 3,
|
||||
videos: []
|
||||
}
|
||||
tabTabPlaylist.push(playlist);
|
||||
}
|
||||
|
||||
return tabTabPlaylist
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {environment} from "../../../environments/environment";
|
||||
import {environment} from "../../../../environments/environment";
|
||||
import {Observable} from "rxjs";
|
||||
|
||||
@Injectable({
|
||||
16
src/app/utils/services/playlist/playlist.service.spec.ts
Normal file
16
src/app/utils/services/playlist/playlist.service.spec.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PlaylistService } from './playlist.service';
|
||||
|
||||
describe('PlaylistService', () => {
|
||||
let service: PlaylistService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PlaylistService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
60
src/app/utils/services/playlist/playlist.service.ts
Normal file
60
src/app/utils/services/playlist/playlist.service.ts
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {MessageService} from "../message/message.service";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {PopupAddVideoToPlaylistsComponent} from "../../components/popup-add-video-to-playlists/popup-add-video-to-playlists.component";
|
||||
import {FictitiousDatasService} from "../fictitiousDatas/fictitious-datas.service";
|
||||
import {Video} from "../../interfaces/video";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PlaylistService
|
||||
{
|
||||
|
||||
constructor( private messageService: MessageService,
|
||||
public dialog: MatDialog,
|
||||
private fictitiousDatasService: FictitiousDatasService ) { }
|
||||
|
||||
|
||||
addVideoToPlaylists(video0: Video): void
|
||||
{
|
||||
// --- DONNEES FICTIVES ---
|
||||
const config = {
|
||||
width: '30%',
|
||||
data: {
|
||||
video: video0,
|
||||
playlists: this.fictitiousDatasService.getTabPlaylist()
|
||||
}
|
||||
}
|
||||
this.dialog
|
||||
.open(PopupAddVideoToPlaylistsComponent, config)
|
||||
.afterClosed()
|
||||
.subscribe(result => {});
|
||||
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
this.messageService
|
||||
.sendMessage('user/get/playlists', null)
|
||||
.subscribe( retour => {
|
||||
|
||||
if(retour.status === "error") console.log(retour.data);
|
||||
else
|
||||
{
|
||||
const config = {
|
||||
width: '30%',
|
||||
data: {
|
||||
video: video0,
|
||||
playlists: retour.data,
|
||||
}
|
||||
};
|
||||
this.dialog
|
||||
.open(PopupAddVideoToPlaylistsComponent, config )
|
||||
.afterClosed()
|
||||
.subscribe(result => {});
|
||||
}
|
||||
})
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
16
src/app/utils/services/videoUrl/video-url.service.spec.ts
Normal file
16
src/app/utils/services/videoUrl/video-url.service.spec.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { VideoUrlService } from './video-url.service';
|
||||
|
||||
describe('VideoUrlService', () => {
|
||||
let service: VideoUrlService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(VideoUrlService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
45
src/app/utils/services/videoUrl/video-url.service.ts
Normal file
45
src/app/utils/services/videoUrl/video-url.service.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {DomSanitizer, SafeResourceUrl} from "@angular/platform-browser";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class VideoUrlService
|
||||
{
|
||||
|
||||
constructor(private _sanitizer: DomSanitizer) { }
|
||||
|
||||
|
||||
safeUrl(videoUrl: string): SafeResourceUrl
|
||||
{
|
||||
if(videoUrl.includes("youtu")) videoUrl = this.youtubeSafeUrl(videoUrl);
|
||||
if(videoUrl.includes("dailymotion")) videoUrl = this.daylimotionSafeUrl(videoUrl);
|
||||
return this._sanitizer.bypassSecurityTrustResourceUrl(videoUrl);
|
||||
}
|
||||
|
||||
|
||||
youtubeSafeUrl(videoUrl: string): string
|
||||
{
|
||||
if(videoUrl.includes("youtu.be"))
|
||||
{
|
||||
console.log("de la forme: https://youtu.be/blablabla");
|
||||
const tab = videoUrl.split("youtu.be/");
|
||||
videoUrl = tab[0] + "www.youtube.com/embed/" + tab[1];
|
||||
}
|
||||
else if(videoUrl.includes("youtube.com/watch?v="))
|
||||
{
|
||||
console.log("de la forme: https://www.youtube.com/watch?v=blablabla");
|
||||
const tab = videoUrl.split("youtube.com/watch?v=");
|
||||
videoUrl = tab[0] + "youtube.com/embed/" + tab[1];
|
||||
}
|
||||
return videoUrl;
|
||||
}
|
||||
|
||||
|
||||
daylimotionSafeUrl(videoUrl: string): string
|
||||
{
|
||||
console.log("de la forme: https://www.dailymotion.com/video/blablabla");
|
||||
const n = "https://www.dailymotion.com/".length;
|
||||
return videoUrl.slice(0, n) + "embed/" + videoUrl.slice(n);
|
||||
}
|
||||
}
|
||||
BIN
src/assets/logo_plateforms/Dailymotion.png
Normal file
BIN
src/assets/logo_plateforms/Dailymotion.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
BIN
src/assets/logo_plateforms/Youtube.png
Normal file
BIN
src/assets/logo_plateforms/Youtube.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
7
src/proxy.conf.json
Normal file
7
src/proxy.conf.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"/api/*": {
|
||||
"target": "http://localhost:3000",
|
||||
"secure": false,
|
||||
"logLevel": "debug"
|
||||
}
|
||||
}
|
||||
Reference in a new issue