amélioration du style
This commit is contained in:
parent
7ebacdc287
commit
4336169d2e
72 changed files with 2172 additions and 529 deletions
|
|
@ -0,0 +1,74 @@
|
|||
<div [class]="themeService.getClassTheme()">
|
||||
<div class="myContainer">
|
||||
|
||||
<app-nav-bar [pour]="forNavbar"></app-nav-bar><br><br>
|
||||
|
||||
<div class="boite">
|
||||
|
||||
<!-- Photo de profil -->
|
||||
<div style="text-align: center">
|
||||
<img [src]="model.profilePictureUrl"
|
||||
onerror="this.onerror=null; this.src='assets/profil.png'"
|
||||
alt="">
|
||||
<br>
|
||||
<button mat-button (click)="onChangePP()"> Changer photo de profil</button>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- Pseudo -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Pseudo</mat-label>
|
||||
<input matInput type="text" [(ngModel)]="model.login">
|
||||
</mat-form-field>
|
||||
<br>
|
||||
|
||||
<!-- Email -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Email</mat-label>
|
||||
<input matInput type="text" [(ngModel)]="model.mail">
|
||||
</mat-form-field>
|
||||
<br>
|
||||
|
||||
<!-- Role -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Type de compte</mat-label>
|
||||
<input matInput type="text" *ngIf="model.role==='user'" value="Utilisateur" disabled>
|
||||
<input matInput type="text" *ngIf="model.role==='advertiser'" value="Annonceur" disabled>
|
||||
<input matInput type="text" *ngIf="model.role==='admin'" value="Admin" disabled>
|
||||
</mat-form-field>
|
||||
<br>
|
||||
|
||||
<!-- Modifier mot de passe -->
|
||||
Modifier mot de passe:
|
||||
<mat-checkbox [(ngModel)]="changePassword"></mat-checkbox>
|
||||
<br>
|
||||
|
||||
<!-- Nouveau mot de passe -->
|
||||
<div *ngIf="changePassword">
|
||||
<!-- Nouveau mot de passe -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Nouveau mot de passe</mat-label>
|
||||
<input matInput type="password" [(ngModel)]="model.newPassword">
|
||||
</mat-form-field>
|
||||
<br>
|
||||
<!-- Confirmation npuveau mot de passe -->
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Confirmation nouveau mot de passe</mat-label>
|
||||
<input matInput type="password" [(ngModel)]="confirmNewPassword">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- Bouton valider -->
|
||||
<div style="width: 100%; text-align: center">
|
||||
<button mat-button (click)="onEnregistrer()"> Enregistrer </button>
|
||||
</div>
|
||||
|
||||
<!-- Message d'erreur -->
|
||||
<div *ngIf="hasError" style="text-align: center; margin-top: 10px;">
|
||||
<span class="mat-error"> {{errorMessage}} </span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
.myContainer {
|
||||
max-width: 100vw;
|
||||
height: 100vh;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.boite {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 20%;
|
||||
margin-top: 20px;
|
||||
border: solid 3px;
|
||||
border-radius: 10px;
|
||||
padding: 20px 40px 20px 40px;
|
||||
background-color: #ffffff;
|
||||
text-align: center;
|
||||
box-shadow: 10px 5px 5px black;
|
||||
}
|
||||
.lightTheme .boite {
|
||||
border-color: black;
|
||||
}
|
||||
.darkTheme .boite {
|
||||
border-color: white;
|
||||
}
|
||||
|
||||
img {
|
||||
margin: 0px 0px 10px 0px;
|
||||
width: 5vw;
|
||||
height: 5vw;
|
||||
border: solid 2px black;
|
||||
border-radius: 50%;
|
||||
font-size: xxx-large;
|
||||
}
|
||||
|
||||
mat-form-field {
|
||||
padding: 2px 0px 2px 0px;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
button {
|
||||
border: solid 1px black;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// aura
|
||||
::ng-deep .mat-checkbox-ripple .mat-ripple-element {
|
||||
background-color: grey !important;
|
||||
}
|
||||
|
||||
// contenu coche
|
||||
::ng-deep .mat-checkbox-checked.mat-accent .mat-checkbox-background {
|
||||
background-color: black !important;
|
||||
}
|
||||
|
||||
// indeterminate
|
||||
::ng-deep .mat-checkbox .mat-checkbox-frame {
|
||||
border-color: black !important;
|
||||
background-color: white !important;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PageMyProfilComponent } from './page-my-profil.component';
|
||||
|
||||
describe('PageMyProfilComponent', () => {
|
||||
let component: PageMyProfilComponent;
|
||||
let fixture: ComponentFixture<PageMyProfilComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PageMyProfilComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PageMyProfilComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {MessageService} from "../../../services/message/message.service";
|
||||
import {ThemeService} from "../../../services/theme/theme.service";
|
||||
import {FictitiousDatasService} from "../../../services/fictitiousDatas/fictitious-datas.service";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {PopupAddVideoToPlaylistsComponent} from "../../popup-add-video-to-playlists/popup-add-video-to-playlists.component";
|
||||
import {PopupPictureProfilUrlComponent} from "../popup-picture-profil-url/popup-picture-profil-url.component";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {Router} from "@angular/router";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-my-profil',
|
||||
templateUrl: './page-my-profil.component.html',
|
||||
styleUrls: ['./page-my-profil.component.scss']
|
||||
})
|
||||
export class PageMyProfilComponent implements OnInit
|
||||
{
|
||||
model = {
|
||||
_id: "",
|
||||
profilePictureUrl: "",
|
||||
login: "",
|
||||
mail: "",
|
||||
role: "",
|
||||
newPassword: ""
|
||||
};
|
||||
confirmNewPassword: string = "" ;
|
||||
changePassword: boolean = false ;
|
||||
hasError: boolean = false;
|
||||
errorMessage: string = "" ;
|
||||
forNavbar: string = "" ;
|
||||
|
||||
|
||||
constructor( private messageService: MessageService,
|
||||
public themeService: ThemeService,
|
||||
private fictitiousDatasService: FictitiousDatasService,
|
||||
public dialog: MatDialog,
|
||||
private snackBar: MatSnackBar,
|
||||
private router: Router ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
let profil ;
|
||||
if(this.router.url.startsWith("/user")) {
|
||||
profil = this.fictitiousDatasService.getUser();
|
||||
this.forNavbar = "user";
|
||||
}
|
||||
else if(this.router.url.startsWith("/advertiser")) {
|
||||
profil = this.fictitiousDatasService.getAdvertiser();
|
||||
this.forNavbar = "advertiser";
|
||||
}
|
||||
else if(this.router.url.startsWith("/admin")) {
|
||||
profil = this.fictitiousDatasService.getAdmin();
|
||||
this.forNavbar = "admin";
|
||||
}
|
||||
this.model._id = profil._id;
|
||||
this.model.profilePictureUrl = profil.profilePictureUrl;
|
||||
this.model.login = profil.login;
|
||||
this.model.mail = profil.mail;
|
||||
this.model.role = profil.role;
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
this.messageService
|
||||
.sendMessage("user/get/profil", null)
|
||||
.subscribe( retour => {
|
||||
|
||||
if(retour.status === "error") console.log(retour);
|
||||
else {
|
||||
const profil = retour.data.profil;
|
||||
this.model._id = profil._id;
|
||||
this.model.profilePictureUrl = profil.profilePictureUrl;
|
||||
this.model.pseudo = profil.pseudo;
|
||||
this.model.email = profil.email;
|
||||
this.model.role = profil.role;
|
||||
this.model.newPassword = profil.newPassword;
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
onEnregistrer()
|
||||
{
|
||||
console.log(this.model);
|
||||
this.checkField();
|
||||
|
||||
// --- VRAI CODE ---
|
||||
/*
|
||||
if(!this.hasError)
|
||||
{
|
||||
this.messageService
|
||||
.sendMessage("user/set/profil", this.model)
|
||||
.subscribe( retour => {} );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
checkField()
|
||||
{
|
||||
if(this.model.login.length === 0) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'pseudo'"
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.model.mail.length === 0)
|
||||
{
|
||||
this.errorMessage = "Veuillez remplir le champ 'email'"
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(!this.isValidEmail(this.model.mail))
|
||||
{
|
||||
this.errorMessage = "Email invalide"
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.changePassword)
|
||||
{
|
||||
if (this.model.newPassword.length === 0) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'mot de passe'"
|
||||
this.hasError = true;
|
||||
} else if (this.model.newPassword !== this.confirmNewPassword) {
|
||||
this.errorMessage = "Le mot de passe est différent de sa confirmation"
|
||||
this.hasError = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.errorMessage = "" ;
|
||||
this.hasError = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
isValidEmail(email)
|
||||
{
|
||||
let re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
return re.test(email);
|
||||
}
|
||||
|
||||
|
||||
onChangePP()
|
||||
{
|
||||
const config = {
|
||||
width: '25%',
|
||||
data: { profilePictureUrl: this.model.profilePictureUrl }
|
||||
};
|
||||
this.dialog
|
||||
.open(PopupPictureProfilUrlComponent, config )
|
||||
.afterClosed()
|
||||
.subscribe(retour => {
|
||||
|
||||
if((retour === null) || (retour === undefined)) {
|
||||
const config = { duration: 1000, panelClass: "custom-class" };
|
||||
this.snackBar.open( "Opération annulé", "", config);
|
||||
}
|
||||
else {
|
||||
this.model.profilePictureUrl = retour;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<div class="myContainer">
|
||||
<img [src]="profilePictureUrl"
|
||||
onerror="this.onerror=null; this.src='https://www.qualibre-formations.fr/wp-content/uploads/2020/02/icon_single.png'"
|
||||
routerLink="/advertiser/myProfil"
|
||||
alt="???">
|
||||
<br>
|
||||
<input [(ngModel)]="profilePictureUrl" placeholder="url de l'image"><br>
|
||||
<button mat-button (click)="onValider()"> Valider </button>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
.myContainer {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
img {
|
||||
margin: 0px 0px 10px 0px;
|
||||
width: 10vw;
|
||||
height: 10vw;
|
||||
border: solid 2px black;
|
||||
border-radius: 50%;
|
||||
font-size: xxx-large;
|
||||
}
|
||||
|
||||
input {
|
||||
margin: 0px;
|
||||
margin: 0px 0px 10px 0px;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PopupPictureProfilUrlComponent } from './popup-picture-profil-url.component';
|
||||
|
||||
describe('PopupPictureProfilUrlComponent', () => {
|
||||
let component: PopupPictureProfilUrlComponent;
|
||||
let fixture: ComponentFixture<PopupPictureProfilUrlComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PopupPictureProfilUrlComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PopupPictureProfilUrlComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-popup-picture-profil-url',
|
||||
templateUrl: './popup-picture-profil-url.component.html',
|
||||
styleUrls: ['./popup-picture-profil-url.component.scss']
|
||||
})
|
||||
export class PopupPictureProfilUrlComponent implements OnInit
|
||||
{
|
||||
profilePictureUrl: string = "" ;
|
||||
|
||||
constructor( public dialogRef: MatDialogRef<PopupPictureProfilUrlComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data ) { }
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.profilePictureUrl = this.data.profilePictureUrl;
|
||||
}
|
||||
|
||||
onValider()
|
||||
{
|
||||
this.dialogRef.close(this.profilePictureUrl);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +1,36 @@
|
|||
<!-- --------------------------------------------------------------------------------------------------------- -->
|
||||
|
||||
|
||||
<!-- 3 Roles -->
|
||||
<div *ngIf="pour === '3roles'">
|
||||
<!-- Login -->
|
||||
<div *ngIf="pour === 'login'">
|
||||
<nav class="navbar navbar-expand-lg">
|
||||
|
||||
<!-- PolyNotFound -->
|
||||
<a class="navbar-brand" routerLink=""> StreamNotFound </a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<!-- Rien -->
|
||||
<div class="collapse navbar-collapse"></div>
|
||||
|
||||
<!-- Slide -->
|
||||
<mat-slide-toggle (click)="onClick()" style="font-size: x-large; margin: 0px 50px 0px 10px;"></mat-slide-toggle>
|
||||
|
||||
<!-- S'inscrire -->
|
||||
<button mat-button class="btnDeconnexion" routerLink="/register">
|
||||
S'inscrire
|
||||
</button>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- --------------------------------------------------------------------------------------------------------- -->
|
||||
|
||||
|
||||
<!-- Register -->
|
||||
<div *ngIf="pour === 'register'">
|
||||
<nav class="navbar navbar-expand-lg">
|
||||
|
||||
<!-- PolyNotFound -->
|
||||
|
|
@ -53,8 +81,8 @@
|
|||
<mat-slide-toggle (click)="onClick()" style="font-size: x-large; margin: 0px 10px 0px 10px;"></mat-slide-toggle>
|
||||
|
||||
<!-- Mon profil -->
|
||||
<img src="https://ih1.redbubble.net/image.945612860.1330/flat,750x1000,075,f.jpg"
|
||||
onerror="this.onerror=null; this.src='https://www.qualibre-formations.fr/wp-content/uploads/2020/02/icon_single.png'"
|
||||
<img [src]=urlImage
|
||||
onerror="this.onerror=null; this.src='assets/profil.png'"
|
||||
routerLink="/user/myProfil"
|
||||
alt="">
|
||||
|
||||
|
|
@ -75,32 +103,20 @@
|
|||
<nav class="navbar navbar-expand-lg">
|
||||
|
||||
<!-- PolyNotFound -->
|
||||
<a class="navbar-brand" routerLink="/advertiser/search"> StreamNotFound </a>
|
||||
<a class="navbar-brand" routerLink="/advertiser"> StreamNotFound </a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<!-- [Recherche] [Mes Playlists] [Historique] -->
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item active monLi">
|
||||
<a class="nav-link" routerLink="/advertiser/addAd"> Ajouter une pub </a>
|
||||
</li>
|
||||
<li class="nav-item active monLi">
|
||||
<a class="nav-link" routerLink="/advertiser/adList"> Liste des pubs </a>
|
||||
</li>
|
||||
<li class="nav-item active monLi">
|
||||
<a class="nav-link" routerLink="/advertiser/history"> Historique des pubs </a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Vide -->
|
||||
<div class="collapse navbar-collapse"></div>
|
||||
|
||||
<!-- Slide -->
|
||||
<mat-slide-toggle (click)="onClick()" style="font-size: x-large; margin: 0px 10px 0px 10px;"></mat-slide-toggle>
|
||||
|
||||
<!-- Mon profil -->
|
||||
<img src="https://ih1.redbubble.net/image.945612860.1330/flat,750x1000,075,f.jpg"
|
||||
onerror="this.onerror=null; this.src='https://www.qualibre-formations.fr/wp-content/uploads/2020/02/icon_single.png'"
|
||||
<img [src]=urlImage
|
||||
onerror="this.onerror=null; this.src='assets/profil.png'"
|
||||
routerLink="/advertiser/myProfil"
|
||||
alt="">
|
||||
|
||||
|
|
@ -145,8 +161,8 @@
|
|||
<mat-slide-toggle (click)="onClick()" style="font-size: x-large; margin: 0px 10px 0px 10px;"></mat-slide-toggle>
|
||||
|
||||
<!-- Mon profil -->
|
||||
<img src="https://ih1.redbubble.net/image.945612860.1330/flat,750x1000,075,f.jpg"
|
||||
onerror="this.onerror=null; this.src='https://www.qualibre-formations.fr/wp-content/uploads/2020/02/icon_single.png'"
|
||||
<img [src]=urlImage
|
||||
onerror="this.onerror=null; this.src='assets/profil.png'"
|
||||
routerLink="/admin/myProfil"
|
||||
alt="">
|
||||
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@
|
|||
|
||||
// PolyNotFound
|
||||
.navbar-brand {
|
||||
font-family: "Lucida Console";
|
||||
font-family: cursive;
|
||||
font-weight: bold;
|
||||
font-style: oblique 90deg;
|
||||
font-size: xx-large;
|
||||
//font-style: oblique 90deg;
|
||||
font-size: xxx-large;
|
||||
margin-left: 30px;
|
||||
color: white;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,48 @@
|
|||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {ThemeService} from "../../services/theme/theme.service";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-nav-bar',
|
||||
templateUrl: './nav-bar.component.html',
|
||||
styleUrls: ['./nav-bar.component.scss']
|
||||
})
|
||||
export class NavBarComponent
|
||||
export class NavBarComponent implements OnInit
|
||||
{
|
||||
@Input() pour = "3roles";
|
||||
@Input() pour = "login";
|
||||
urlImage: string = "" ;
|
||||
|
||||
constructor(public themeService: ThemeService) { }
|
||||
|
||||
constructor( public themeService: ThemeService ) { }
|
||||
|
||||
onClick(): void {
|
||||
this.themeService.isLightTheme = !this.themeService.isLightTheme;
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
// --- FAUX CODE ---
|
||||
switch (this.pour)
|
||||
{
|
||||
case "user":
|
||||
this.urlImage = "https://www.figurines-goodies.com/1185-thickbox_default/huey-duck-tales-disney-funko-pop.jpg" ;
|
||||
break;
|
||||
case "advertiser":
|
||||
this.urlImage = "https://www.figurines-goodies.com/1188-large_default/dewey-duck-tales-disney-funko-pop.jpg" ;
|
||||
break;
|
||||
case "admin":
|
||||
this.urlImage = "https://www.reference-gaming.com/assets/media/product/41195/figurine-pop-duck-tales-n-309-loulou.jpg" ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
onDeconnexion(): void {
|
||||
|
||||
onClick(): void
|
||||
{
|
||||
this.themeService.isLightTheme = !this.themeService.isLightTheme;
|
||||
}
|
||||
|
||||
|
||||
onDeconnexion(): void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,3 +17,23 @@ h3 {
|
|||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
// aura
|
||||
::ng-deep .mat-checkbox-ripple .mat-ripple-element {
|
||||
background-color: grey !important;
|
||||
}
|
||||
|
||||
// contenu coche
|
||||
::ng-deep .mat-checkbox-checked.mat-accent .mat-checkbox-background {
|
||||
background-color: black !important;
|
||||
}
|
||||
|
||||
// indeterminate
|
||||
::ng-deep .mat-checkbox .mat-checkbox-frame {
|
||||
border-color: black !important;
|
||||
background-color: white !important;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export class PopupCreatePlaylistComponent implements OnInit
|
|||
if(!this.hasError)
|
||||
{
|
||||
this.messageService
|
||||
.sendMessage("user/create/playlist", {name: this.data.name})
|
||||
.sendMessage("user/create/playlist", {title: this.data.title})
|
||||
.subscribe(retour => {
|
||||
|
||||
if (retour.status === "error") {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
export interface Advert
|
||||
{
|
||||
_id: string,
|
||||
title: string,
|
||||
advertiser: string,
|
||||
images: {
|
||||
url: string,
|
||||
description: string,
|
||||
}[]
|
||||
text: string,
|
||||
subjectTarget: any[]
|
||||
seen: number,
|
||||
date: Date,
|
||||
}[],
|
||||
tags: string[],
|
||||
comment: string,
|
||||
views: number,
|
||||
createdAt: Date,
|
||||
lastUpdate: Date,
|
||||
isVisible: boolean,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,25 +88,75 @@ const TAB_VIDEO = [
|
|||
]
|
||||
|
||||
|
||||
|
||||
const TAB_ADVERT = [
|
||||
{
|
||||
_id: "idNutella",
|
||||
title: "pot de nutella XXL",
|
||||
advertiser: "nutella",
|
||||
images: [
|
||||
{ url: "nutella_v_1.jpeg", description: "image nutella 1" },
|
||||
{ url: "nutella_v_2.png", description: "image nutella 2" },
|
||||
{ url: "nutella_v_3.jpg", description: "image nutella 3" }
|
||||
],
|
||||
tags: [ "bon", "petit-déjeuner", "chocolat" ],
|
||||
comment: "pub pour vacances de noêl",
|
||||
views: 5,
|
||||
createdAt: new Date(),
|
||||
lastUpdate: new Date(),
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
_id: "idRolex",
|
||||
title: "Rolex",
|
||||
advertiser: "rolex",
|
||||
images: [
|
||||
{ url: "rolex_v_1.jpg", description: "rolex 1" },
|
||||
{ url: "rolex_v_2.png", description: "rolex 2" },
|
||||
],
|
||||
tags: [ "montre", "luxe", "suisse" ],
|
||||
comment: "pub pour cette année",
|
||||
views: 2,
|
||||
createdAt: new Date(),
|
||||
lastUpdate: new Date(),
|
||||
isVisible: true
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousDatasService
|
||||
{
|
||||
constructor() { }
|
||||
|
||||
private makeid(length)
|
||||
{
|
||||
let res = '';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for( let i = 0; i < length; i++ )
|
||||
{
|
||||
const k = Math.floor(Math.random() * characters.length);
|
||||
res += characters.charAt(k);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
getVideo(): Video
|
||||
{
|
||||
const idx = Math.floor(Math.random() * TAB_VIDEO.length);
|
||||
let video = Object.assign({}, TAB_VIDEO[idx]);
|
||||
video._id = video._id + this.makeid(5);
|
||||
return video;
|
||||
}
|
||||
|
||||
getTabVideo(n: number): Video[]
|
||||
{
|
||||
let tabVideo = [];
|
||||
const l = TAB_VIDEO.length;
|
||||
|
||||
for(let i=0 ; i<n ; i++)
|
||||
{
|
||||
const idx = Math.floor(Math.random() * l);
|
||||
tabVideo.push(TAB_VIDEO[idx]);
|
||||
}
|
||||
|
||||
for(let i=0 ; i<n ; i++) tabVideo.push(this.getVideo());
|
||||
return tabVideo;
|
||||
}
|
||||
|
||||
|
|
@ -132,40 +182,39 @@ export class FictitiousDatasService
|
|||
|
||||
getAdvert(): Advert
|
||||
{
|
||||
return {
|
||||
_id: "monId",
|
||||
advertiser: "nutella",
|
||||
images: [
|
||||
{ url: "nutella_v_1.jpeg", description: "image nutella 1" },
|
||||
{ url: "nutella_v_2.png", description: "image nutella 2" },
|
||||
{ url: "nutella_v_3.jpg", description: "image nutella 3" }
|
||||
],
|
||||
text: "Voici du bon nutella",
|
||||
subjectTarget: [],
|
||||
seen: 4,
|
||||
date: new Date(),
|
||||
}
|
||||
const idx = Math.floor(Math.random() * TAB_ADVERT.length);
|
||||
let advert = Object.assign({}, TAB_ADVERT[idx]);
|
||||
advert._id = advert._id + this.makeid(5);
|
||||
advert.tags = advert.tags.slice();
|
||||
advert.isVisible = (Math.random() < 0.5);
|
||||
return advert;
|
||||
}
|
||||
|
||||
getTabAdvert(n: number): Advert[]
|
||||
{
|
||||
let tabAdvert = [];
|
||||
for(let i=0 ; i<n ; i++) tabAdvert.push(this.getAdvert());
|
||||
return tabAdvert;
|
||||
}
|
||||
|
||||
|
||||
getTabWatchedVideo(n): WatchedVideo[]
|
||||
getWatchedVideo(): WatchedVideo
|
||||
{
|
||||
const idx = Math.floor(Math.random() * TAB_VIDEO.length);
|
||||
const video: Video = TAB_VIDEO[idx];
|
||||
const watchedVideo: WatchedVideo = {
|
||||
_id: video._id,
|
||||
url: video.url,
|
||||
title: video.title,
|
||||
date: new Date()
|
||||
};
|
||||
return watchedVideo ;
|
||||
}
|
||||
|
||||
getTabWatchedVideo(n: number): WatchedVideo[]
|
||||
{
|
||||
let tabWatchedVideo = [];
|
||||
const l = TAB_VIDEO.length;
|
||||
|
||||
for(let i=0 ; i<n ; i++)
|
||||
{
|
||||
const idx = Math.floor(Math.random() * l);
|
||||
const video: Video = TAB_VIDEO[idx];
|
||||
const watchedVideo: WatchedVideo = {
|
||||
_id: video._id,
|
||||
url: video.url,
|
||||
title: video.title,
|
||||
date: new Date()
|
||||
};
|
||||
tabWatchedVideo.push(watchedVideo);
|
||||
}
|
||||
|
||||
for(let i=0 ; i<n ; i++) tabWatchedVideo.push(this.getWatchedVideo());
|
||||
return tabWatchedVideo;
|
||||
}
|
||||
|
||||
|
|
@ -173,13 +222,43 @@ export class FictitiousDatasService
|
|||
getUser(): User
|
||||
{
|
||||
return {
|
||||
_id: "blablablaId",
|
||||
login: "yoyo",
|
||||
_id: "ririId",
|
||||
login: "Riri",
|
||||
hashPass: "agourgroou",
|
||||
mail: "yoyo@gmail.com",
|
||||
mail: "riri@gmail.com",
|
||||
role: "user",
|
||||
profilePictureUrl: "https://ih1.redbubble.net/image.945612860.1330/flat,750x1000,075,f.jpg"
|
||||
profilePictureUrl: "https://www.figurines-goodies.com/1185-thickbox_default/huey-duck-tales-disney-funko-pop.jpg"
|
||||
}
|
||||
}
|
||||
|
||||
getAdvertiser(): User
|
||||
{
|
||||
return {
|
||||
_id: "fifiId",
|
||||
login: "Fifi",
|
||||
hashPass: "agourgroou",
|
||||
mail: "fifi@gmail.com",
|
||||
role: "advertiser",
|
||||
profilePictureUrl: "https://www.figurines-goodies.com/1188-large_default/dewey-duck-tales-disney-funko-pop.jpg"
|
||||
}
|
||||
}
|
||||
|
||||
getAdmin(): User
|
||||
{
|
||||
return {
|
||||
_id: "loulouId",
|
||||
login: "Loulou",
|
||||
hashPass: "agourgroou",
|
||||
mail: "loulou@gmail.com",
|
||||
role: "advertiser",
|
||||
profilePictureUrl: "https://www.reference-gaming.com/assets/media/product/41195/figurine-pop-duck-tales-n-309-loulou.jpg?format=product-cover-large&k=1519639530"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getTags(): string[]
|
||||
{
|
||||
return [ "musique", "rap", "rock", "sport", "foot", "basket", "tennis", "film", "action", "aventure", "horreur", "romance", "comedie"];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HistoriqueService } from './historique.service';
|
||||
import { UserHistoryService } from './userHistory.service';
|
||||
|
||||
describe('HistoriqueService', () => {
|
||||
let service: HistoriqueService;
|
||||
let service: UserHistoryService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(HistoriqueService);
|
||||
service = TestBed.inject(UserHistoryService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
|
|
@ -6,7 +6,7 @@ import {MessageService} from "../message/message.service";
|
|||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class HistoriqueService
|
||||
export class UserHistoryService
|
||||
{
|
||||
private tabVideoUrlClicked: string[] = [];
|
||||
|
||||
Reference in a new issue