diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index af394a3..6590845 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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 }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6a06b61..e327b2a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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] diff --git a/src/app/pourLes3Roles/page-connexion/page-connexion.component.html b/src/app/pourLes3Roles/page-connexion/page-connexion.component.html index f77d943..6966d79 100644 --- a/src/app/pourLes3Roles/page-connexion/page-connexion.component.html +++ b/src/app/pourLes3Roles/page-connexion/page-connexion.component.html @@ -1,6 +1,6 @@
- +

Connexion

diff --git a/src/app/pourLes3Roles/page-connexion/page-connexion.component.ts b/src/app/pourLes3Roles/page-connexion/page-connexion.component.ts index a3be2e7..abf9d28 100644 --- a/src/app/pourLes3Roles/page-connexion/page-connexion.component.ts +++ b/src/app/pourLes3Roles/page-connexion/page-connexion.component.ts @@ -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"; diff --git a/src/app/pourLes3Roles/register/page-register/page-register.component.html b/src/app/pourLes3Roles/register/page-register/page-register.component.html index 5ea96d6..364a1e4 100644 --- a/src/app/pourLes3Roles/register/page-register/page-register.component.html +++ b/src/app/pourLes3Roles/register/page-register/page-register.component.html @@ -1,6 +1,6 @@
- +

Inscription

diff --git a/src/app/pourLes3Roles/register/page-register/page-register.component.ts b/src/app/pourLes3Roles/register/page-register/page-register.component.ts index 7edfecb..fb7f049 100644 --- a/src/app/pourLes3Roles/register/page-register/page-register.component.ts +++ b/src/app/pourLes3Roles/register/page-register/page-register.component.ts @@ -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"; diff --git a/src/app/user/page-search/page-search.component.html b/src/app/user/page-search/page-search.component.html deleted file mode 100644 index 3ef4668..0000000 --- a/src/app/user/page-search/page-search.component.html +++ /dev/null @@ -1 +0,0 @@ -

page-search works!

diff --git a/src/app/user/page-search/page-search.component.ts b/src/app/user/page-search/page-search.component.ts deleted file mode 100644 index 2e28c69..0000000 --- a/src/app/user/page-search/page-search.component.ts +++ /dev/null @@ -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 { - } - -} diff --git a/src/app/user/search/page-search/page-search.component.html b/src/app/user/search/page-search/page-search.component.html new file mode 100644 index 0000000..f72da7c --- /dev/null +++ b/src/app/user/search/page-search/page-search.component.html @@ -0,0 +1,77 @@ +
+ + +
+ +
+ + + + +
+ + +
+
+ +
+
+ + + + +
+ + +
+
+   + +
+
+ + +
+
+ +   + + image + +   + +
+
+ + +
+ +
+ +
+ + + + +
+
+ +
+
+ +
+ + + + +
+
+
+
+ +
+
+
+
+ +
diff --git a/src/app/user/search/page-search/page-search.component.scss b/src/app/user/search/page-search/page-search.component.scss new file mode 100644 index 0000000..d21e578 --- /dev/null +++ b/src/app/user/search/page-search/page-search.component.scss @@ -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; +} diff --git a/src/app/user/page-search/page-search.component.spec.ts b/src/app/user/search/page-search/page-search.component.spec.ts similarity index 100% rename from src/app/user/page-search/page-search.component.spec.ts rename to src/app/user/search/page-search/page-search.component.spec.ts diff --git a/src/app/user/search/page-search/page-search.component.ts b/src/app/user/search/page-search/page-search.component.ts new file mode 100644 index 0000000..f8109be --- /dev/null +++ b/src/app/user/search/page-search/page-search.component.ts @@ -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; + }); + */ + } + +} diff --git a/src/app/user/search/video-cell/video-cell.component.html b/src/app/user/search/video-cell/video-cell.component.html new file mode 100644 index 0000000..299766c --- /dev/null +++ b/src/app/user/search/video-cell/video-cell.component.html @@ -0,0 +1,9 @@ + + +
+ + {{video.title}} + +
diff --git a/src/app/user/search/video-cell/video-cell.component.scss b/src/app/user/search/video-cell/video-cell.component.scss new file mode 100644 index 0000000..a56bfce --- /dev/null +++ b/src/app/user/search/video-cell/video-cell.component.scss @@ -0,0 +1,5 @@ +.conteneur { + text-align: center; + //border: solid black 2px; + //border-radius: 5px; +} diff --git a/src/app/user/search/video-cell/video-cell.component.spec.ts b/src/app/user/search/video-cell/video-cell.component.spec.ts new file mode 100644 index 0000000..c41f534 --- /dev/null +++ b/src/app/user/search/video-cell/video-cell.component.spec.ts @@ -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; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ VideoCellComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(VideoCellComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user/search/video-cell/video-cell.component.ts b/src/app/user/search/video-cell/video-cell.component.ts new file mode 100644 index 0000000..3891b2d --- /dev/null +++ b/src/app/user/search/video-cell/video-cell.component.ts @@ -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); + } +} diff --git a/src/app/user/search/video-grid/video-grid.component.html b/src/app/user/search/video-grid/video-grid.component.html new file mode 100644 index 0000000..e3552ca --- /dev/null +++ b/src/app/user/search/video-grid/video-grid.component.html @@ -0,0 +1,11 @@ +
+ +
diff --git a/src/app/user/search/video-grid/video-grid.component.scss b/src/app/user/search/video-grid/video-grid.component.scss new file mode 100644 index 0000000..3d2de80 --- /dev/null +++ b/src/app/user/search/video-grid/video-grid.component.scss @@ -0,0 +1,13 @@ +.conteneur { + border: solid black 2px; +} + +nav ul { + overflow: hidden; + overflow-y: scroll; + height: 66vh; +} + +.ligne { + margin: 30px 0px 30px 0px; +} diff --git a/src/app/user/search/video-grid/video-grid.component.spec.ts b/src/app/user/search/video-grid/video-grid.component.spec.ts new file mode 100644 index 0000000..17cea62 --- /dev/null +++ b/src/app/user/search/video-grid/video-grid.component.spec.ts @@ -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; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ VideoGridComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(VideoGridComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user/search/video-grid/video-grid.component.ts b/src/app/user/search/video-grid/video-grid.component.ts new file mode 100644 index 0000000..b42c91a --- /dev/null +++ b/src/app/user/search/video-grid/video-grid.component.ts @@ -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) + } + } + +} diff --git a/src/app/utils/components/nav-bar/nav-bar.component.html b/src/app/utils/components/nav-bar/nav-bar.component.html new file mode 100644 index 0000000..583da41 --- /dev/null +++ b/src/app/utils/components/nav-bar/nav-bar.component.html @@ -0,0 +1,38 @@ + +
+ +
+ + + + diff --git a/src/app/utils/components/nav-bar/nav-bar.component.scss b/src/app/utils/components/nav-bar/nav-bar.component.scss new file mode 100644 index 0000000..e1a6e80 --- /dev/null +++ b/src/app/utils/components/nav-bar/nav-bar.component.scss @@ -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; +} diff --git a/src/app/utils/nav-bar/nav-bar.component.spec.ts b/src/app/utils/components/nav-bar/nav-bar.component.spec.ts similarity index 100% rename from src/app/utils/nav-bar/nav-bar.component.spec.ts rename to src/app/utils/components/nav-bar/nav-bar.component.spec.ts diff --git a/src/app/utils/nav-bar/nav-bar.component.ts b/src/app/utils/components/nav-bar/nav-bar.component.ts similarity index 90% rename from src/app/utils/nav-bar/nav-bar.component.ts rename to src/app/utils/components/nav-bar/nav-bar.component.ts index 959b270..c1ba65b 100644 --- a/src/app/utils/nav-bar/nav-bar.component.ts +++ b/src/app/utils/components/nav-bar/nav-bar.component.ts @@ -7,7 +7,7 @@ import {Component, Input, OnInit} from '@angular/core'; }) export class NavBarComponent implements OnInit { - @Input() complete = false; + @Input() pour = "3roles"; constructor() { } diff --git a/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.html b/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.html new file mode 100644 index 0000000..c3e1dc1 --- /dev/null +++ b/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.html @@ -0,0 +1,41 @@ +

Ajouter dans

+ + + + + +
+
+ {{playlist.name}} +
+
+ + + + + +
+ +
+ +
+ + Nom playlist + + + +
+ + + + + + + + + diff --git a/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.scss b/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.scss new file mode 100644 index 0000000..ca6c275 --- /dev/null +++ b/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.scss @@ -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; +} diff --git a/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.spec.ts b/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.spec.ts new file mode 100644 index 0000000..5ace846 --- /dev/null +++ b/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.spec.ts @@ -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; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PopupAddVideoToPlaylistsComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PopupAddVideoToPlaylistsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.ts b/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.ts new file mode 100644 index 0000000..381f107 --- /dev/null +++ b/src/app/utils/components/popup-add-video-to-playlists/popup-add-video-to-playlists.component.ts @@ -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, + @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 + { + + } +} diff --git a/src/app/utils/components/pub/pub.component.html b/src/app/utils/components/pub/pub.component.html new file mode 100644 index 0000000..6522d0a --- /dev/null +++ b/src/app/utils/components/pub/pub.component.html @@ -0,0 +1,3 @@ +
+

Je suis une pub

+
diff --git a/src/app/user/page-search/page-search.component.scss b/src/app/utils/components/pub/pub.component.scss similarity index 100% rename from src/app/user/page-search/page-search.component.scss rename to src/app/utils/components/pub/pub.component.scss diff --git a/src/app/utils/components/pub/pub.component.spec.ts b/src/app/utils/components/pub/pub.component.spec.ts new file mode 100644 index 0000000..f9328bc --- /dev/null +++ b/src/app/utils/components/pub/pub.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PubComponent } from './pub.component'; + +describe('PubComponent', () => { + let component: PubComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PubComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PubComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/utils/components/pub/pub.component.ts b/src/app/utils/components/pub/pub.component.ts new file mode 100644 index 0000000..d23b635 --- /dev/null +++ b/src/app/utils/components/pub/pub.component.ts @@ -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 { + } + +} diff --git a/src/app/utils/interfaces/playlist.ts b/src/app/utils/interfaces/playlist.ts new file mode 100644 index 0000000..09a6140 --- /dev/null +++ b/src/app/utils/interfaces/playlist.ts @@ -0,0 +1,10 @@ +import {Video} from "./video"; + +export interface Playlist +{ + _id: string, + user: any, + name: string, + count: number + videos: Video[] +} diff --git a/src/app/utils/interfaces/video.ts b/src/app/utils/interfaces/video.ts new file mode 100644 index 0000000..1d6f375 --- /dev/null +++ b/src/app/utils/interfaces/video.ts @@ -0,0 +1,8 @@ +export interface Video +{ + _id: string, + url: string, + title: string, + description: string, + views: number +} diff --git a/src/app/utils/nav-bar/nav-bar.component.html b/src/app/utils/nav-bar/nav-bar.component.html deleted file mode 100644 index ece85d2..0000000 --- a/src/app/utils/nav-bar/nav-bar.component.html +++ /dev/null @@ -1,23 +0,0 @@ -
- -
- - - -
- -
diff --git a/src/app/utils/nav-bar/nav-bar.component.scss b/src/app/utils/nav-bar/nav-bar.component.scss deleted file mode 100644 index d6337b7..0000000 --- a/src/app/utils/nav-bar/nav-bar.component.scss +++ /dev/null @@ -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; -} diff --git a/src/app/utils/services/fictitiousDatas/fictitious-datas.service.spec.ts b/src/app/utils/services/fictitiousDatas/fictitious-datas.service.spec.ts new file mode 100644 index 0000000..17d518a --- /dev/null +++ b/src/app/utils/services/fictitiousDatas/fictitious-datas.service.spec.ts @@ -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(); + }); +}); diff --git a/src/app/utils/services/fictitiousDatas/fictitious-datas.service.ts b/src/app/utils/services/fictitiousDatas/fictitious-datas.service.ts new file mode 100644 index 0000000..99bc4c3 --- /dev/null +++ b/src/app/utils/services/fictitiousDatas/fictitious-datas.service.ts @@ -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 { + let service: PlaylistService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(PlaylistService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/utils/services/playlist/playlist.service.ts b/src/app/utils/services/playlist/playlist.service.ts new file mode 100644 index 0000000..3dc64ec --- /dev/null +++ b/src/app/utils/services/playlist/playlist.service.ts @@ -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 => {}); + } + }) + */ + } + +} diff --git a/src/app/utils/services/videoUrl/video-url.service.spec.ts b/src/app/utils/services/videoUrl/video-url.service.spec.ts new file mode 100644 index 0000000..7ded62b --- /dev/null +++ b/src/app/utils/services/videoUrl/video-url.service.spec.ts @@ -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(); + }); +}); diff --git a/src/app/utils/services/videoUrl/video-url.service.ts b/src/app/utils/services/videoUrl/video-url.service.ts new file mode 100644 index 0000000..9317046 --- /dev/null +++ b/src/app/utils/services/videoUrl/video-url.service.ts @@ -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); + } +} diff --git a/src/assets/logo_plateforms/Dailymotion.png b/src/assets/logo_plateforms/Dailymotion.png new file mode 100644 index 0000000..d35ee8a Binary files /dev/null and b/src/assets/logo_plateforms/Dailymotion.png differ diff --git a/src/assets/logo_plateforms/Youtube.png b/src/assets/logo_plateforms/Youtube.png new file mode 100644 index 0000000..5924c8d Binary files /dev/null and b/src/assets/logo_plateforms/Youtube.png differ diff --git a/src/proxy.conf.json b/src/proxy.conf.json new file mode 100644 index 0000000..f1e4285 --- /dev/null +++ b/src/proxy.conf.json @@ -0,0 +1,7 @@ +{ + "/api/*": { + "target": "http://localhost:3000", + "secure": false, + "logLevel": "debug" + } +}