Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
d94a22e87f
31 changed files with 397 additions and 239 deletions
|
|
@ -25,6 +25,7 @@ export class InputInterestsAdminComponent implements OnInit
|
||||||
allInterests: string[] = [];
|
allInterests: string[] = [];
|
||||||
@Output() eventEmitter = new EventEmitter<string[]>();
|
@Output() eventEmitter = new EventEmitter<string[]>();
|
||||||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||||
|
interestsNotSelected: string[] = [];
|
||||||
|
|
||||||
|
|
||||||
constructor( private messageService: MessageService ) {}
|
constructor( private messageService: MessageService ) {}
|
||||||
|
|
@ -34,7 +35,7 @@ export class InputInterestsAdminComponent implements OnInit
|
||||||
{
|
{
|
||||||
this.filteredInterests = this.formControl.valueChanges.pipe(
|
this.filteredInterests = this.formControl.valueChanges.pipe(
|
||||||
startWith(null),
|
startWith(null),
|
||||||
map((fruit: string | null) => fruit ? this._filter(fruit) : this.allInterests.slice()));
|
map((fruit: string | null) => fruit ? this._filter(fruit) : this.interestsNotSelected.slice()));
|
||||||
|
|
||||||
this.messageService
|
this.messageService
|
||||||
.get("misc/getInterests")
|
.get("misc/getInterests")
|
||||||
|
|
@ -45,8 +46,11 @@ export class InputInterestsAdminComponent implements OnInit
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.allInterests = [];
|
this.allInterests = [];
|
||||||
for(let elt of retour.data) this.allInterests.push(elt.interest);
|
for(let elt of retour.data)
|
||||||
this.allInterests.sort();
|
{
|
||||||
|
this.allInterests.push(elt.interest);
|
||||||
|
this.interestsNotSelected.push(elt.interest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -55,28 +59,53 @@ export class InputInterestsAdminComponent implements OnInit
|
||||||
add(event: MatChipInputEvent): void
|
add(event: MatChipInputEvent): void
|
||||||
{
|
{
|
||||||
const value = (event.value || '').trim();
|
const value = (event.value || '').trim();
|
||||||
if (value && (this.allInterests.indexOf(value) !== -1) && (!this.myInterests.includes(value)))
|
const index = this.interestsNotSelected.indexOf(value);
|
||||||
|
if (value && (index !== -1) && (!this.myInterests.includes(value)))
|
||||||
{
|
{
|
||||||
this.myInterests.push(value);
|
this.myInterests.push(value);
|
||||||
event.chipInput!.clear();
|
event.chipInput!.clear();
|
||||||
this.formControl.setValue(null);
|
this.formControl.setValue(null);
|
||||||
this.eventEmitter.emit(this.myInterests);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
this.interestsNotSelected.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remove(tag: string): void
|
remove(interest: string): void
|
||||||
{
|
{
|
||||||
const index = this.myInterests.indexOf(tag);
|
// supprimer 'interest' de 'myInterest'
|
||||||
|
const index = this.myInterests.indexOf(interest);
|
||||||
if (index >= 0) this.myInterests.splice(index, 1);
|
if (index >= 0) this.myInterests.splice(index, 1);
|
||||||
this.eventEmitter.emit(this.myInterests);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
|
||||||
|
// remmettre 'interest' dans 'interestsNotSelected'
|
||||||
|
if(!this.interestsNotSelected.includes(interest))
|
||||||
|
{
|
||||||
|
const indexOfAutres = this.interestsNotSelected.indexOf("Autres");
|
||||||
|
if(indexOfAutres !== -1)
|
||||||
|
{
|
||||||
|
this.interestsNotSelected.splice(indexOfAutres, 1);
|
||||||
|
if(interest !== "Autres") this.interestsNotSelected.push(interest);
|
||||||
|
this.interestsNotSelected.sort();
|
||||||
|
this.interestsNotSelected.push("Autres");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.interestsNotSelected.push(interest);
|
||||||
|
if(interest !== "Autres") this.interestsNotSelected.sort();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
selected(event: MatAutocompleteSelectedEvent): void
|
selected(event: MatAutocompleteSelectedEvent): void
|
||||||
{
|
{
|
||||||
const value = event.option.viewValue;
|
const value = event.option.viewValue;
|
||||||
if(!this.myInterests.includes(value))this.myInterests.push(value);
|
if(!this.myInterests.includes(value))
|
||||||
|
{
|
||||||
|
this.myInterests.push(value);
|
||||||
|
const index = this.interestsNotSelected.indexOf(value);
|
||||||
|
this.interestsNotSelected.splice(index, 1);
|
||||||
|
}
|
||||||
this.tagInput.nativeElement.value = '';
|
this.tagInput.nativeElement.value = '';
|
||||||
this.formControl.setValue(null);
|
this.formControl.setValue(null);
|
||||||
this.eventEmitter.emit(this.myInterests);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
|
@ -86,7 +115,7 @@ export class InputInterestsAdminComponent implements OnInit
|
||||||
private _filter(value: string): string[]
|
private _filter(value: string): string[]
|
||||||
{
|
{
|
||||||
const filterValue = value.toLowerCase();
|
const filterValue = value.toLowerCase();
|
||||||
return this.allInterests.filter(fruit => fruit.toLowerCase().includes(filterValue));
|
return this.interestsNotSelected.filter(fruit => fruit.toLowerCase().includes(filterValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export class NavbarAdminComponent
|
||||||
|
|
||||||
onDeconnexionCallback(retour: any): void
|
onDeconnexionCallback(retour: any): void
|
||||||
{
|
{
|
||||||
console.log(retour);
|
if(retour.status !== "success") console.log(retour);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ export class DragAndDropComponent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.files.splice(index, 1);
|
this.files.splice(index, 1);
|
||||||
|
this.eventEmitter.emit(this.files);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -9,18 +9,18 @@
|
||||||
<mat-chip-list #chipList aria-label="Fruit selection">
|
<mat-chip-list #chipList aria-label="Fruit selection">
|
||||||
|
|
||||||
<mat-chip
|
<mat-chip
|
||||||
*ngFor="let tag of myTags"
|
*ngFor="let interest of myInterests"
|
||||||
[selectable]="selectable"
|
[selectable]="selectable"
|
||||||
[removable]="removable"
|
[removable]="removable"
|
||||||
(removed)="remove(tag)">
|
(removed)="remove(interest)">
|
||||||
{{tag}}
|
{{interest}}
|
||||||
<button matChipRemove *ngIf="removable">
|
<button matChipRemove *ngIf="removable">
|
||||||
<mat-icon>cancel</mat-icon>
|
<mat-icon>cancel</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</mat-chip>
|
</mat-chip>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
placeholder="Tapez un sujet et pressez 'Entré' pour l'inserer"
|
placeholder="Tapez un centre d'intérêt et pressez 'Entrer' pour l'inserer"
|
||||||
#tagInput
|
#tagInput
|
||||||
[formControl]="formControl"
|
[formControl]="formControl"
|
||||||
[matAutocomplete]="auto"
|
[matAutocomplete]="auto"
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
<!-- ------------------------------------------------------------------------------------ -->
|
<!-- ------------------------------------------------------------------------------------ -->
|
||||||
|
|
||||||
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)">
|
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)">
|
||||||
<mat-option *ngFor="let tag of filteredTags | async" [value]="tag">
|
<mat-option *ngFor="let interest of filteredInterests | async" [value]="interest">
|
||||||
{{tag}}
|
{{interest}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-autocomplete>
|
</mat-autocomplete>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,12 @@ export class InputInterestsAdComponent implements OnInit
|
||||||
removable = true;
|
removable = true;
|
||||||
separatorKeysCodes: number[] = [ENTER, COMMA];
|
separatorKeysCodes: number[] = [ENTER, COMMA];
|
||||||
formControl = new FormControl();
|
formControl = new FormControl();
|
||||||
filteredTags: Observable<string[]>;
|
filteredInterests: Observable<string[]>;
|
||||||
@Input() myTags: string[] = [];
|
@Input() myInterests: string[] = [];
|
||||||
allTags: string[] = [];
|
allInterests: string[] = [];
|
||||||
@Output() eventEmitter = new EventEmitter<string[]>();
|
@Output() eventEmitter = new EventEmitter<string[]>();
|
||||||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||||
|
interestsNotSelected: string[] = [];
|
||||||
|
|
||||||
|
|
||||||
constructor( private messageService: MessageService ) {}
|
constructor( private messageService: MessageService ) {}
|
||||||
|
|
@ -32,9 +33,9 @@ export class InputInterestsAdComponent implements OnInit
|
||||||
|
|
||||||
ngOnInit(): void
|
ngOnInit(): void
|
||||||
{
|
{
|
||||||
this.filteredTags = this.formControl.valueChanges.pipe(
|
this.filteredInterests = this.formControl.valueChanges.pipe(
|
||||||
startWith(null),
|
startWith(null),
|
||||||
map((fruit: string | null) => fruit ? this._filter(fruit) : this.allTags.slice()));
|
map((fruit: string | null) => fruit ? this._filter(fruit) : this.interestsNotSelected.slice()));
|
||||||
|
|
||||||
this.messageService
|
this.messageService
|
||||||
.get("misc/getInterests")
|
.get("misc/getInterests")
|
||||||
|
|
@ -44,8 +45,12 @@ export class InputInterestsAdComponent implements OnInit
|
||||||
console.log(retour);
|
console.log(retour);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.allTags = retour.data.map(x => x.interest)
|
this.allInterests = [];
|
||||||
this.allTags.sort();
|
for(let elt of retour.data)
|
||||||
|
{
|
||||||
|
this.allInterests.push(elt.interest);
|
||||||
|
this.interestsNotSelected.push(elt.interest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -54,38 +59,63 @@ export class InputInterestsAdComponent implements OnInit
|
||||||
add(event: MatChipInputEvent): void
|
add(event: MatChipInputEvent): void
|
||||||
{
|
{
|
||||||
const value = (event.value || '').trim();
|
const value = (event.value || '').trim();
|
||||||
if (value && (this.allTags.indexOf(value) !== -1) && (!this.myTags.includes(value)))
|
const index = this.interestsNotSelected.indexOf(value);
|
||||||
|
if (value && (index !== -1) && (!this.myInterests.includes(value)))
|
||||||
{
|
{
|
||||||
this.myTags.push(value);
|
this.myInterests.push(value);
|
||||||
event.chipInput!.clear();
|
event.chipInput!.clear();
|
||||||
this.formControl.setValue(null);
|
this.formControl.setValue(null);
|
||||||
this.eventEmitter.emit(this.myTags);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
this.interestsNotSelected.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remove(tag: string): void
|
remove(interest: string): void
|
||||||
{
|
{
|
||||||
const index = this.myTags.indexOf(tag);
|
// supprimer 'interest' de 'myInterest'
|
||||||
if (index >= 0) this.myTags.splice(index, 1);
|
const index = this.myInterests.indexOf(interest);
|
||||||
this.eventEmitter.emit(this.myTags);
|
if (index >= 0) this.myInterests.splice(index, 1);
|
||||||
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
|
||||||
|
// remmettre 'interest' dans 'interestsNotSelected'
|
||||||
|
if(!this.interestsNotSelected.includes(interest))
|
||||||
|
{
|
||||||
|
const indexOfAutres = this.interestsNotSelected.indexOf("Autres");
|
||||||
|
if(indexOfAutres !== -1)
|
||||||
|
{
|
||||||
|
this.interestsNotSelected.splice(indexOfAutres, 1);
|
||||||
|
if(interest !== "Autres") this.interestsNotSelected.push(interest);
|
||||||
|
this.interestsNotSelected.sort();
|
||||||
|
this.interestsNotSelected.push("Autres");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.interestsNotSelected.push(interest);
|
||||||
|
if(interest !== "Autres") this.interestsNotSelected.sort();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
selected(event: MatAutocompleteSelectedEvent): void
|
selected(event: MatAutocompleteSelectedEvent): void
|
||||||
{
|
{
|
||||||
const value = event.option.viewValue;
|
const value = event.option.viewValue;
|
||||||
if(!this.myTags.includes(value))this.myTags.push(value);
|
if(!this.myInterests.includes(value))
|
||||||
|
{
|
||||||
|
this.myInterests.push(value);
|
||||||
|
const index = this.interestsNotSelected.indexOf(value);
|
||||||
|
this.interestsNotSelected.splice(index, 1);
|
||||||
|
}
|
||||||
this.tagInput.nativeElement.value = '';
|
this.tagInput.nativeElement.value = '';
|
||||||
this.formControl.setValue(null);
|
this.formControl.setValue(null);
|
||||||
this.eventEmitter.emit(this.myTags);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private _filter(value: string): string[]
|
private _filter(value: string): string[]
|
||||||
{
|
{
|
||||||
const filterValue = value.toLowerCase();
|
const filterValue = value.toLowerCase();
|
||||||
return this.allTags.filter(fruit => fruit.toLowerCase().includes(filterValue));
|
return this.interestsNotSelected.filter(fruit => fruit.toLowerCase().includes(filterValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,11 +84,14 @@ export class PageAdListAdvertiserComponent implements AfterViewInit
|
||||||
console.log(retour);
|
console.log(retour);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(retour.data.length !== 0)
|
||||||
|
{
|
||||||
for(let advert of retour.data) this.tabAdvertWithCountViews.push(this.advertToAdvertWithCountViews(advert));
|
for(let advert of retour.data) this.tabAdvertWithCountViews.push(this.advertToAdvertWithCountViews(advert));
|
||||||
this.dataSource = new MatTableDataSource<AdvertWithCountViews>();
|
this.dataSource = new MatTableDataSource<AdvertWithCountViews>();
|
||||||
this.onFilter();
|
this.onFilter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
applyFilter(event: Event): void
|
applyFilter(event: Event): void
|
||||||
|
|
@ -124,7 +127,7 @@ export class PageAdListAdvertiserComponent implements AfterViewInit
|
||||||
{
|
{
|
||||||
const config = {
|
const config = {
|
||||||
width: '75%',
|
width: '75%',
|
||||||
height: '80%',
|
//height: '80%',
|
||||||
panelClass: 'custom-dialog-container',
|
panelClass: 'custom-dialog-container',
|
||||||
data: {
|
data: {
|
||||||
action: "add",
|
action: "add",
|
||||||
|
|
@ -146,7 +149,7 @@ export class PageAdListAdvertiserComponent implements AfterViewInit
|
||||||
else {
|
else {
|
||||||
this.tabAdvertWithCountViews.push(this.advertToAdvertWithCountViews(advertAdded));
|
this.tabAdvertWithCountViews.push(this.advertToAdvertWithCountViews(advertAdded));
|
||||||
this.onFilter();
|
this.onFilter();
|
||||||
message = "L'annoonce a bien été ajoutée ✔" ;
|
message = "L'annonce a bien été ajoutée ✔" ;
|
||||||
}
|
}
|
||||||
this.snackBar.open( message, "", config);
|
this.snackBar.open( message, "", config);
|
||||||
});
|
});
|
||||||
|
|
@ -157,7 +160,7 @@ export class PageAdListAdvertiserComponent implements AfterViewInit
|
||||||
{
|
{
|
||||||
const config = {
|
const config = {
|
||||||
width: '75%',
|
width: '75%',
|
||||||
height: '80%',
|
//height: '80%',
|
||||||
panelClass: 'custom-dialog-container',
|
panelClass: 'custom-dialog-container',
|
||||||
data: {
|
data: {
|
||||||
action: "update",
|
action: "update",
|
||||||
|
|
|
||||||
|
|
@ -15,24 +15,24 @@
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
|
|
||||||
<!-- Title -->
|
<!-- Title -->
|
||||||
<mat-form-field appearance="fill">
|
<mat-form-field class="titleContainer" appearance="fill">
|
||||||
<mat-label> Titre annonce </mat-label>
|
<mat-label> Titre annonce </mat-label>
|
||||||
<input matInput type="text" [(ngModel)]="advert.title">
|
<input matInput type="text" [(ngModel)]="advert.title" required>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<!-- Interests -->
|
<!-- Interests -->
|
||||||
<app-input-interests-ad [myTags]="advert.interests" (eventEmitter)="onEventInputTags($event)"></app-input-interests-ad>
|
<app-input-interests-ad [myInterests]="advert.interests" (eventEmitter)="onEventInputTags($event)"></app-input-interests-ad>
|
||||||
|
|
||||||
<!-- Comments -->
|
<!-- Comments -->
|
||||||
<mat-form-field class="commentContainer" appearance="fill">
|
<mat-form-field class="commentContainer" appearance="fill">
|
||||||
<mat-label> Commentaire </mat-label>
|
<mat-label> Commentaire </mat-label>
|
||||||
<textarea matInput [(ngModel)]="advert.comment"></textarea>
|
<textarea matInput [(ngModel)]="advert.comment" rows="5" style="resize: none;"></textarea>
|
||||||
</mat-form-field><br>
|
</mat-form-field><br>
|
||||||
|
|
||||||
<!-- url -->
|
<!-- url -->
|
||||||
<mat-form-field class="commentContainer" appearance="fill">
|
<mat-form-field class="commentContainer" appearance="fill">
|
||||||
<mat-label> URL </mat-label>
|
<mat-label> URL </mat-label>
|
||||||
<textarea matInput [(ngModel)]="advert.url"></textarea>
|
<input matInput [(ngModel)]="advert.url">
|
||||||
</mat-form-field><br>
|
</mat-form-field><br>
|
||||||
|
|
||||||
<!-- IsVisible -->
|
<!-- IsVisible -->
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ h1 {
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.titleContainer {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.commentContainer {
|
.commentContainer {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ export class PopupAddOrUpdateAdComponent implements OnInit
|
||||||
if(this.data.action === "add")
|
if(this.data.action === "add")
|
||||||
{
|
{
|
||||||
this.advert = Object.assign({}, ADVERT_VIDE);
|
this.advert = Object.assign({}, ADVERT_VIDE);
|
||||||
|
this.advert.images = [];
|
||||||
this.advert.interests = [];
|
this.advert.interests = [];
|
||||||
this.title = "Ajouter annonce" ;
|
this.title = "Ajouter annonce" ;
|
||||||
}
|
}
|
||||||
|
|
@ -103,12 +104,15 @@ export class PopupAddOrUpdateAdComponent implements OnInit
|
||||||
checkField()
|
checkField()
|
||||||
{
|
{
|
||||||
if(this.advert.title.length === 0) {
|
if(this.advert.title.length === 0) {
|
||||||
this.errorMessage = "Veuillez remplir le champ 'titre'" ;
|
this.errorMessage = "Veuillez remplir le champ 'titre'." ;
|
||||||
this.hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
else if(this.allTitle.includes(this.advert.title))
|
else if(this.allTitle.includes(this.advert.title)) {
|
||||||
{
|
this.errorMessage = "Ce titre est déjà pris." ;
|
||||||
this.errorMessage = "Ce titre est déjà pris" ;
|
this.hasError = true;
|
||||||
|
}
|
||||||
|
else if((this.advert.images.length === 0) && (this.tabOfNewImagesName.length === 0)) {
|
||||||
|
this.errorMessage = "Veuillez uploader au moins une image." ;
|
||||||
this.hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- chart -->
|
<!-- chart -->
|
||||||
<div class="chartContainer">
|
<div *ngIf="isDisplayable" class="chartContainer">
|
||||||
<canvas baseChart
|
<canvas baseChart
|
||||||
[datasets]="lineChartData"
|
[datasets]="lineChartData"
|
||||||
[labels]="lineChartLabels"
|
[labels]="lineChartLabels"
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ interface CoupleNameViews {
|
||||||
})
|
})
|
||||||
export class PagesPopularityComponent implements OnInit
|
export class PagesPopularityComponent implements OnInit
|
||||||
{
|
{
|
||||||
formControl: FormControl;
|
formControl: FormControl = new FormControl();
|
||||||
allCoupleNameViews: CoupleNameViews[] = [];
|
allCoupleNameViews: CoupleNameViews[] = [];
|
||||||
|
|
||||||
allInterests: string[] = [];
|
allInterests: string[] = [];
|
||||||
|
|
@ -48,6 +48,8 @@ export class PagesPopularityComponent implements OnInit
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
isDisplayable: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
constructor( private router: Router,
|
constructor( private router: Router,
|
||||||
public themeService: ThemeService,
|
public themeService: ThemeService,
|
||||||
|
|
@ -167,8 +169,8 @@ export class PagesPopularityComponent implements OnInit
|
||||||
this.lineChartLabels = [];
|
this.lineChartLabels = [];
|
||||||
|
|
||||||
if(this.step <= 0) this.step = 0;
|
if(this.step <= 0) this.step = 0;
|
||||||
if(this.endDate === null) this.endDate = new Date();
|
if((this.endDate === null) || (this.endDate === undefined)) this.endDate = new Date();
|
||||||
if(this.startDate === null) this.startDate = new Date(this.endDate.getTime() - this.oneWeek); // date d'il y a une semaine
|
if((this.startDate === null) || (this.startDate === undefined)) this.startDate = new Date(this.endDate.getTime() - this.oneWeek); // date d'il y a une semaine
|
||||||
|
|
||||||
const startTime = this.startDate.getTime();
|
const startTime = this.startDate.getTime();
|
||||||
const endTime = this.endDate.getTime();
|
const endTime = this.endDate.getTime();
|
||||||
|
|
@ -211,6 +213,7 @@ export class PagesPopularityComponent implements OnInit
|
||||||
|
|
||||||
this.lineChartData.push({"data": data.slice(), "label": label});
|
this.lineChartData.push({"data": data.slice(), "label": label});
|
||||||
}
|
}
|
||||||
|
this.isDisplayable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -282,9 +285,9 @@ export class PagesPopularityComponent implements OnInit
|
||||||
{
|
{
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let n = tabDate.length;
|
let n = tabDate.length;
|
||||||
let time0 = date0.getTime();
|
let time0 = (new Date(date0)).getTime();
|
||||||
|
|
||||||
while((i <n) && (time0 > tabDate[i].getTime())) i++;
|
while((i <n) && (time0 > (new Date(tabDate[i])).getTime())) i++;
|
||||||
if(i === n) tabDate.push(date0);
|
if(i === n) tabDate.push(date0);
|
||||||
else tabDate.splice(i, 0, date0);
|
else tabDate.splice(i, 0, date0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export class NavbarAdvertiserComponent
|
||||||
|
|
||||||
onDeconnexionCallback(retour: any): void
|
onDeconnexionCallback(retour: any): void
|
||||||
{
|
{
|
||||||
console.log(retour);
|
if(retour.status !== "success") console.log(retour);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ export class PageLoginComponent implements OnInit
|
||||||
|
|
||||||
onSeConnecterCallback(retour): void
|
onSeConnecterCallback(retour): void
|
||||||
{
|
{
|
||||||
console.log(retour);
|
|
||||||
if(retour.status !== "success") {
|
if(retour.status !== "success") {
|
||||||
|
console.log(retour);
|
||||||
this.errorMessage = retour.error.reason;
|
this.errorMessage = retour.error.reason;
|
||||||
this.hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ export class InputInterestsRegisterComponent implements OnInit
|
||||||
allInterests: string[] = [];
|
allInterests: string[] = [];
|
||||||
@Output() eventEmitter = new EventEmitter<string[]>();
|
@Output() eventEmitter = new EventEmitter<string[]>();
|
||||||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||||
|
interestsNotSelected: string[] = [];
|
||||||
|
|
||||||
|
|
||||||
constructor( private messageService: MessageService ) {}
|
constructor( private messageService: MessageService ) {}
|
||||||
|
|
@ -34,7 +35,7 @@ export class InputInterestsRegisterComponent implements OnInit
|
||||||
{
|
{
|
||||||
this.filteredInterests = this.formControl.valueChanges.pipe(
|
this.filteredInterests = this.formControl.valueChanges.pipe(
|
||||||
startWith(null),
|
startWith(null),
|
||||||
map((fruit: string | null) => fruit ? this._filter(fruit) : this.allInterests.slice()));
|
map((fruit: string | null) => fruit ? this._filter(fruit) : this.interestsNotSelected.slice()));
|
||||||
|
|
||||||
this.messageService
|
this.messageService
|
||||||
.get("misc/getInterests")
|
.get("misc/getInterests")
|
||||||
|
|
@ -45,8 +46,11 @@ export class InputInterestsRegisterComponent implements OnInit
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.allInterests = [];
|
this.allInterests = [];
|
||||||
for(let elt of retour.data) this.allInterests.push(elt.interest);
|
for(let elt of retour.data)
|
||||||
this.allInterests.sort();
|
{
|
||||||
|
this.allInterests.push(elt.interest);
|
||||||
|
this.interestsNotSelected.push(elt.interest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -55,28 +59,53 @@ export class InputInterestsRegisterComponent implements OnInit
|
||||||
add(event: MatChipInputEvent): void
|
add(event: MatChipInputEvent): void
|
||||||
{
|
{
|
||||||
const value = (event.value || '').trim();
|
const value = (event.value || '').trim();
|
||||||
if (value && (this.allInterests.indexOf(value) !== -1) && (!this.myInterests.includes(value)))
|
const index = this.interestsNotSelected.indexOf(value);
|
||||||
|
if (value && (index !== -1) && (!this.myInterests.includes(value)))
|
||||||
{
|
{
|
||||||
this.myInterests.push(value);
|
this.myInterests.push(value);
|
||||||
event.chipInput!.clear();
|
event.chipInput!.clear();
|
||||||
this.formControl.setValue(null);
|
this.formControl.setValue(null);
|
||||||
this.eventEmitter.emit(this.myInterests);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
this.interestsNotSelected.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remove(tag: string): void
|
remove(interest: string): void
|
||||||
{
|
{
|
||||||
const index = this.myInterests.indexOf(tag);
|
// supprimer 'interest' de 'myInterest'
|
||||||
|
const index = this.myInterests.indexOf(interest);
|
||||||
if (index >= 0) this.myInterests.splice(index, 1);
|
if (index >= 0) this.myInterests.splice(index, 1);
|
||||||
this.eventEmitter.emit(this.myInterests);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
|
||||||
|
// remmettre 'interest' dans 'interestsNotSelected'
|
||||||
|
if(!this.interestsNotSelected.includes(interest))
|
||||||
|
{
|
||||||
|
const indexOfAutres = this.interestsNotSelected.indexOf("Autres");
|
||||||
|
if(indexOfAutres !== -1)
|
||||||
|
{
|
||||||
|
this.interestsNotSelected.splice(indexOfAutres, 1);
|
||||||
|
if(interest !== "Autres") this.interestsNotSelected.push(interest);
|
||||||
|
this.interestsNotSelected.sort();
|
||||||
|
this.interestsNotSelected.push("Autres");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.interestsNotSelected.push(interest);
|
||||||
|
if(interest !== "Autres") this.interestsNotSelected.sort();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
selected(event: MatAutocompleteSelectedEvent): void
|
selected(event: MatAutocompleteSelectedEvent): void
|
||||||
{
|
{
|
||||||
const value = event.option.viewValue;
|
const value = event.option.viewValue;
|
||||||
if(!this.myInterests.includes(value))this.myInterests.push(value);
|
if(!this.myInterests.includes(value))
|
||||||
|
{
|
||||||
|
this.myInterests.push(value);
|
||||||
|
const index = this.interestsNotSelected.indexOf(value);
|
||||||
|
this.interestsNotSelected.splice(index, 1);
|
||||||
|
}
|
||||||
this.tagInput.nativeElement.value = '';
|
this.tagInput.nativeElement.value = '';
|
||||||
this.formControl.setValue(null);
|
this.formControl.setValue(null);
|
||||||
this.eventEmitter.emit(this.myInterests);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
|
@ -86,7 +115,7 @@ export class InputInterestsRegisterComponent implements OnInit
|
||||||
private _filter(value: string): string[]
|
private _filter(value: string): string[]
|
||||||
{
|
{
|
||||||
const filterValue = value.toLowerCase();
|
const filterValue = value.toLowerCase();
|
||||||
return this.allInterests.filter(fruit => fruit.toLowerCase().includes(filterValue));
|
return this.interestsNotSelected.filter(fruit => fruit.toLowerCase().includes(filterValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,16 +46,22 @@ export class PageMyPlaylistsComponent implements OnInit
|
||||||
|
|
||||||
transmitPlaylistToVideoList(playlist): void
|
transmitPlaylistToVideoList(playlist): void
|
||||||
{
|
{
|
||||||
|
if ((playlist === null) || (playlist === undefined)) {
|
||||||
|
this.playlist = playlist;
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.messageService
|
this.messageService
|
||||||
.get("playlist/findOne/" + playlist.id)
|
.get("playlist/findOne/" + playlist.id)
|
||||||
.subscribe(ret => this.afterReceivingPlaylistWithVideo(ret), err => this.afterReceivingPlaylistWithVideo(err));
|
.subscribe(ret => this.afterReceivingPlaylistWithVideo(ret, playlist), err => this.afterReceivingPlaylistWithVideo(err, playlist));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
afterReceivingPlaylistWithVideo(retour: any): void
|
afterReceivingPlaylistWithVideo(retour: any, playlist): void
|
||||||
{
|
{
|
||||||
if(retour.status !== "success") {
|
if(retour.status !== "success") {
|
||||||
console.log(retour);
|
console.log(retour);
|
||||||
|
this.playlist = playlist;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.playlist = retour.data;
|
this.playlist = retour.data;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||||
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||||
import {MessageService} from "../../../utils/services/message/message.service";
|
import {MessageService} from "../../../utils/services/message/message.service";
|
||||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||||
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
|
|
||||||
import {Router} from "@angular/router";
|
import {Router} from "@angular/router";
|
||||||
import {ProfilService} from "../../../utils/services/profil/profil.service";
|
import {ProfilService} from "../../../utils/services/profil/profil.service";
|
||||||
|
|
||||||
|
|
@ -24,7 +23,6 @@ export class VideoListComponent implements OnChanges
|
||||||
public themeService: ThemeService,
|
public themeService: ThemeService,
|
||||||
private addVideoToPlaylistsService: AddVideoToPlaylistsService,
|
private addVideoToPlaylistsService: AddVideoToPlaylistsService,
|
||||||
private snackBar: MatSnackBar,
|
private snackBar: MatSnackBar,
|
||||||
private historiqueService: UserHistoryService,
|
|
||||||
private profilService: ProfilService,
|
private profilService: ProfilService,
|
||||||
private router: Router ) { }
|
private router: Router ) { }
|
||||||
|
|
||||||
|
|
@ -45,14 +43,14 @@ export class VideoListComponent implements OnChanges
|
||||||
|
|
||||||
onDelete(video0: any, indexVideo: number): void
|
onDelete(video0: any, indexVideo: number): void
|
||||||
{
|
{
|
||||||
let _idsVideo = this.videosInPlaylist.filter( x => (x._id !== video0._id) );
|
const data = {
|
||||||
_idsVideo = _idsVideo.map( x => x._id );
|
videoId: {
|
||||||
|
id: video0._id,
|
||||||
console.log("_idsVideo:");
|
action: "delete"
|
||||||
console.log(_idsVideo);
|
}
|
||||||
|
}
|
||||||
this.messageService
|
this.messageService
|
||||||
.put("playlist/update/"+this.playlist._id, {videoIds: _idsVideo})
|
.put("playlist/update/"+this.playlist._id, data)
|
||||||
.subscribe( ret => this.onDeleteCallback(ret, indexVideo), err => this.onDeleteCallback(err, indexVideo));
|
.subscribe( ret => this.onDeleteCallback(ret, indexVideo), err => this.onDeleteCallback(err, indexVideo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ export class InputInterestsProfilComponent implements OnInit
|
||||||
allInterests: string[] = [];
|
allInterests: string[] = [];
|
||||||
@Output() eventEmitter = new EventEmitter<string[]>();
|
@Output() eventEmitter = new EventEmitter<string[]>();
|
||||||
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
|
||||||
|
interestsNotSelected: string[] = [];
|
||||||
|
|
||||||
|
|
||||||
constructor( private messageService: MessageService ) {}
|
constructor( private messageService: MessageService ) {}
|
||||||
|
|
@ -34,7 +35,7 @@ export class InputInterestsProfilComponent implements OnInit
|
||||||
{
|
{
|
||||||
this.filteredInterests = this.formControl.valueChanges.pipe(
|
this.filteredInterests = this.formControl.valueChanges.pipe(
|
||||||
startWith(null),
|
startWith(null),
|
||||||
map((fruit: string | null) => fruit ? this._filter(fruit) : this.allInterests.slice()));
|
map((fruit: string | null) => fruit ? this._filter(fruit) : this.interestsNotSelected.slice()));
|
||||||
|
|
||||||
this.messageService
|
this.messageService
|
||||||
.get("misc/getInterests")
|
.get("misc/getInterests")
|
||||||
|
|
@ -45,8 +46,11 @@ export class InputInterestsProfilComponent implements OnInit
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.allInterests = [];
|
this.allInterests = [];
|
||||||
for(let elt of retour.data) this.allInterests.push(elt.interest);
|
for(let elt of retour.data)
|
||||||
this.allInterests.sort();
|
{
|
||||||
|
this.allInterests.push(elt.interest);
|
||||||
|
this.interestsNotSelected.push(elt.interest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -55,28 +59,53 @@ export class InputInterestsProfilComponent implements OnInit
|
||||||
add(event: MatChipInputEvent): void
|
add(event: MatChipInputEvent): void
|
||||||
{
|
{
|
||||||
const value = (event.value || '').trim();
|
const value = (event.value || '').trim();
|
||||||
if (value && (this.allInterests.indexOf(value) !== -1) && (!this.myInterests.includes(value)))
|
const index = this.interestsNotSelected.indexOf(value);
|
||||||
|
if (value && (index !== -1) && (!this.myInterests.includes(value)))
|
||||||
{
|
{
|
||||||
this.myInterests.push(value);
|
this.myInterests.push(value);
|
||||||
event.chipInput!.clear();
|
event.chipInput!.clear();
|
||||||
this.formControl.setValue(null);
|
this.formControl.setValue(null);
|
||||||
this.eventEmitter.emit(this.myInterests);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
this.interestsNotSelected.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remove(tag: string): void
|
remove(interest: string): void
|
||||||
{
|
{
|
||||||
const index = this.myInterests.indexOf(tag);
|
// supprimer 'interest' de 'myInterest'
|
||||||
|
const index = this.myInterests.indexOf(interest);
|
||||||
if (index >= 0) this.myInterests.splice(index, 1);
|
if (index >= 0) this.myInterests.splice(index, 1);
|
||||||
this.eventEmitter.emit(this.myInterests);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
|
||||||
|
// remmettre 'interest' dans 'interestsNotSelected'
|
||||||
|
if(!this.interestsNotSelected.includes(interest))
|
||||||
|
{
|
||||||
|
const indexOfAutres = this.interestsNotSelected.indexOf("Autres");
|
||||||
|
if(indexOfAutres !== -1)
|
||||||
|
{
|
||||||
|
this.interestsNotSelected.splice(indexOfAutres, 1);
|
||||||
|
if(interest !== "Autres") this.interestsNotSelected.push(interest);
|
||||||
|
this.interestsNotSelected.sort();
|
||||||
|
this.interestsNotSelected.push("Autres");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.interestsNotSelected.push(interest);
|
||||||
|
if(interest !== "Autres") this.interestsNotSelected.sort();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
selected(event: MatAutocompleteSelectedEvent): void
|
selected(event: MatAutocompleteSelectedEvent): void
|
||||||
{
|
{
|
||||||
const value = event.option.viewValue;
|
const value = event.option.viewValue;
|
||||||
if(!this.myInterests.includes(value))this.myInterests.push(value);
|
if(!this.myInterests.includes(value))
|
||||||
|
{
|
||||||
|
this.myInterests.push(value);
|
||||||
|
const index = this.interestsNotSelected.indexOf(value);
|
||||||
|
this.interestsNotSelected.splice(index, 1);
|
||||||
|
}
|
||||||
this.tagInput.nativeElement.value = '';
|
this.tagInput.nativeElement.value = '';
|
||||||
this.formControl.setValue(null);
|
this.formControl.setValue(null);
|
||||||
this.eventEmitter.emit(this.myInterests);
|
this.eventEmitter.emit(this.myInterests);
|
||||||
|
|
@ -86,7 +115,7 @@ export class InputInterestsProfilComponent implements OnInit
|
||||||
private _filter(value: string): string[]
|
private _filter(value: string): string[]
|
||||||
{
|
{
|
||||||
const filterValue = value.toLowerCase();
|
const filterValue = value.toLowerCase();
|
||||||
return this.allInterests.filter(fruit => fruit.toLowerCase().includes(filterValue));
|
return this.interestsNotSelected.filter(fruit => fruit.toLowerCase().includes(filterValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
<!-- Search bar -->
|
<!-- Search bar -->
|
||||||
<div class="input-group" style="width: 100%; margin: 0 auto;">
|
<div class="input-group" style="width: 100%; margin: 0 auto;">
|
||||||
<div class="form-outline" style="width: 100%; margin: 0 auto;">
|
<div class="form-outline" style="width: 100%; margin: 0 auto;">
|
||||||
<input type="search" placeholder="Rechercher..." class="inputSearchBar" [(ngModel)]="search"/>
|
<input type="search" placeholder="Rechercher..." class="inputSearchBar" [(ngModel)]="search" (keydown)="onEnterOnSearchBar($event)"/>
|
||||||
<button mat-icon-button (click)="onSearch()">
|
<button mat-icon-button (click)="onSearch()">
|
||||||
<mat-icon>search</mat-icon>
|
<mat-icon>search</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ export class PageSearchComponent implements OnInit
|
||||||
tabPlateform = TAB_PLATEFORM;
|
tabPlateform = TAB_PLATEFORM;
|
||||||
tabVideo: VideoAll[] = [];
|
tabVideo: VideoAll[] = [];
|
||||||
search: string = "";
|
search: string = "";
|
||||||
ad1: any = { title: "", url: "", images: [] };
|
ad1: any;
|
||||||
ad2: any = { title: "", url: "", images: [] };
|
ad2: any;
|
||||||
|
|
||||||
|
|
||||||
constructor( private messageService: MessageService,
|
constructor( private messageService: MessageService,
|
||||||
|
|
@ -45,8 +45,11 @@ export class PageSearchComponent implements OnInit
|
||||||
|
|
||||||
adCallback(retour: any): void
|
adCallback(retour: any): void
|
||||||
{
|
{
|
||||||
if(retour !== "success") {
|
console.log("adCallback retour:");
|
||||||
console.log(retour);
|
console.log(retour);
|
||||||
|
|
||||||
|
if(retour.status !== "success") {
|
||||||
|
//console.log(retour);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.ad1 = retour.data[0];
|
this.ad1 = retour.data[0];
|
||||||
|
|
@ -65,7 +68,6 @@ export class PageSearchComponent implements OnInit
|
||||||
else if((!this.tabPlateform[0].isSelected) && this.tabPlateform[1].isSelected) sources += "dm" ;
|
else if((!this.tabPlateform[0].isSelected) && this.tabPlateform[1].isSelected) sources += "dm" ;
|
||||||
else if(this.tabPlateform[0].isSelected && (!this.tabPlateform[1].isSelected)) sources += "yt" ;
|
else if(this.tabPlateform[0].isSelected && (!this.tabPlateform[1].isSelected)) sources += "yt" ;
|
||||||
else sources += "" ;
|
else sources += "" ;
|
||||||
console.log(sources);
|
|
||||||
params = params.append('sources', sources);
|
params = params.append('sources', sources);
|
||||||
|
|
||||||
this.messageService
|
this.messageService
|
||||||
|
|
@ -84,4 +86,10 @@ export class PageSearchComponent implements OnInit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onEnterOnSearchBar(event)
|
||||||
|
{
|
||||||
|
if(event.key === 'Enter') this.onSearch();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@
|
||||||
{{tronquage(tabVideo[indexPage+k].title)}}
|
{{tronquage(tabVideo[indexPage+k].title)}}
|
||||||
<br>
|
<br>
|
||||||
<span style="color: gray">
|
<span style="color: gray">
|
||||||
{{tabVideo[indexPage+k].views | number: '1.0-0'}} vues. Il y a 2h.
|
{{tabVideo[indexPage+k].views | number: '1.0-0'}} vues.
|
||||||
|
Il y a {{dateToElapsedTime(tabVideo[indexPage+k].publishedAt)}}.
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</mat-grid-tile>
|
</mat-grid-tile>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import {Component, Input } from '@angular/core';
|
import {Component, Input } from '@angular/core';
|
||||||
import {VideoAll} from "../../../utils/interfaces/video";
|
import {VideoAll} from "../../../utils/interfaces/video";
|
||||||
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
|
|
||||||
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||||
import {Router} from "@angular/router";
|
import {Router} from "@angular/router";
|
||||||
import {MessageService} from "../../../utils/services/message/message.service";
|
import {MessageService} from "../../../utils/services/message/message.service";
|
||||||
|
|
@ -19,8 +18,7 @@ export class VideoGridComponent
|
||||||
indexPage: number = 0;
|
indexPage: number = 0;
|
||||||
|
|
||||||
|
|
||||||
constructor( private historiqueService: UserHistoryService,
|
constructor( private addVideoToPlaylistsService: AddVideoToPlaylistsService,
|
||||||
private addVideoToPlaylistsService: AddVideoToPlaylistsService,
|
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private messageService: MessageService ) {}
|
private messageService: MessageService ) {}
|
||||||
|
|
||||||
|
|
@ -33,8 +31,8 @@ export class VideoGridComponent
|
||||||
|
|
||||||
tronquage(str: string)
|
tronquage(str: string)
|
||||||
{
|
{
|
||||||
if(str.length < 33) return str;
|
if(str.length < 30) return str;
|
||||||
else return str.substring(0, 30) + "..." ;
|
else return str.substring(0, 27) + "..." ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -55,4 +53,44 @@ export class VideoGridComponent
|
||||||
if(retour.status !== "success") console.log(retour);
|
if(retour.status !== "success") console.log(retour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dateToElapsedTime(date0): string
|
||||||
|
{
|
||||||
|
const ellapsedTimeInMilliSeconds = (new Date()).getTime() - (new Date(date0)).getTime();
|
||||||
|
|
||||||
|
// seconde
|
||||||
|
const ellapsedTimeInSeconds = Math.trunc(ellapsedTimeInMilliSeconds / 1000);
|
||||||
|
if(ellapsedTimeInSeconds < 60) {
|
||||||
|
if(ellapsedTimeInSeconds <= 1)return ellapsedTimeInSeconds + " seconde" ;
|
||||||
|
else return ellapsedTimeInSeconds + " secondes" ;
|
||||||
|
}
|
||||||
|
// minute
|
||||||
|
const ellapsedTimeInMinutes = Math.trunc(ellapsedTimeInSeconds / 60);
|
||||||
|
if(ellapsedTimeInMinutes < 60) {
|
||||||
|
if(ellapsedTimeInMinutes <= 1) return ellapsedTimeInMinutes + " minute" ;
|
||||||
|
else return ellapsedTimeInMinutes + " minutes" ;
|
||||||
|
}
|
||||||
|
// heure
|
||||||
|
const ellapsedTimeInHours = Math.trunc(ellapsedTimeInMinutes / 60);
|
||||||
|
if(ellapsedTimeInHours < 24) {
|
||||||
|
if(ellapsedTimeInHours <= 1) return ellapsedTimeInHours + " heure" ;
|
||||||
|
else return ellapsedTimeInHours + " heures" ;
|
||||||
|
}
|
||||||
|
// jour
|
||||||
|
const ellapsedTimeInDays = Math.trunc(ellapsedTimeInHours / 24);
|
||||||
|
if(ellapsedTimeInDays < 31) {
|
||||||
|
if(ellapsedTimeInDays <= 1) return ellapsedTimeInDays + " jour" ;
|
||||||
|
else return ellapsedTimeInDays + " jours" ;
|
||||||
|
}
|
||||||
|
// mois
|
||||||
|
const ellapsedTimeInMonths = Math.trunc(ellapsedTimeInDays / 31);
|
||||||
|
if(ellapsedTimeInMonths < 12) {
|
||||||
|
return ellapsedTimeInMonths + " mois" ;
|
||||||
|
}
|
||||||
|
// an
|
||||||
|
const ellapsedTimeInYears = Math.trunc(ellapsedTimeInMonths / 12);
|
||||||
|
if(ellapsedTimeInYears <= 1) return ellapsedTimeInYears + " an" ;
|
||||||
|
else return ellapsedTimeInYears + " ans" ;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,26 @@
|
||||||
<div *ngIf="from==='search' || from==='myPlaylists'" class="myContainer">
|
<div *ngIf="(from==='search' || from==='myPlaylists') && (imageExist)"
|
||||||
|
class="myContainer">
|
||||||
|
|
||||||
<span class="helper"></span>
|
<span class="helper"></span>
|
||||||
<img [src]="'assets/pub/'+ad.images[idxImage].url"
|
<img [src]="image.base64"
|
||||||
[alt]="ad.title"
|
[alt]="image.description"
|
||||||
(click)="onClick()"
|
(click)="onClick()"
|
||||||
id="imgFromSearchOrMyPlaylists">
|
id="imgFromSearchOrMyPlaylists">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- --------------------------------------------------------------------- -->
|
<!-- --------------------------------------------------------------------- -->
|
||||||
|
|
||||||
<img *ngIf="from === 'watchingLeft'"
|
<img *ngIf="from === 'watchingLeft' && (imageExist)"
|
||||||
[src]="'assets/pub/'+ad.images[idxImage].url"
|
[src]="image.base64"
|
||||||
[alt]="ad.title"
|
[alt]="image.description"
|
||||||
(click)="onClick()"
|
(click)="onClick()"
|
||||||
id="imgFromWatchingLeft">
|
id="imgFromWatchingLeft">
|
||||||
|
|
||||||
<!-- --------------------------------------------------------------------- -->
|
<!-- --------------------------------------------------------------------- -->
|
||||||
|
|
||||||
<img *ngIf="from === 'watchingRight'"
|
<img *ngIf="from === 'watchingRight' && (imageExist)"
|
||||||
[src]="'assets/pub/'+ad.images[idxImage].url"
|
[src]="image.base64"
|
||||||
[alt]="ad.title"
|
[alt]="image.description"
|
||||||
(click)="onClick()"
|
(click)="onClick()"
|
||||||
id="imgFromWatchingRight">
|
id="imgFromWatchingRight">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
|
||||||
import {Advert} from "../../../../utils/interfaces/advert";
|
|
||||||
import {Router} from "@angular/router";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -9,26 +7,32 @@ import {Router} from "@angular/router";
|
||||||
templateUrl: './advert.component.html',
|
templateUrl: './advert.component.html',
|
||||||
styleUrls: ['./advert.component.scss']
|
styleUrls: ['./advert.component.scss']
|
||||||
})
|
})
|
||||||
export class AdvertComponent implements OnInit
|
export class AdvertComponent implements OnChanges
|
||||||
{
|
{
|
||||||
@Input() ad: any;
|
@Input() ad: any;
|
||||||
@Input() from: string = "search";
|
@Input() from: string = "search";
|
||||||
idxImage: number = 0;
|
image: any;
|
||||||
|
imageExist: boolean = false;
|
||||||
|
|
||||||
constructor(private router: Router) { }
|
|
||||||
|
|
||||||
ngOnInit(): void
|
constructor() { }
|
||||||
|
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges): void
|
||||||
|
{
|
||||||
|
if((this.ad !== null) && (this.ad !== undefined))
|
||||||
{
|
{
|
||||||
const nbImages = this.ad.images.length;
|
const nbImages = this.ad.images.length;
|
||||||
if(nbImages === 0) this.ad.images.push({url: "img pub"});
|
const indexImage = Math.floor(Math.random() * nbImages);
|
||||||
this.idxImage = Math.floor(Math.random() * nbImages);
|
this.image = this.ad.images[indexImage];
|
||||||
|
this.imageExist = true;
|
||||||
if(this.ad.title === "") this.ad.title = "--- pub ---" ;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onClick(): void
|
onClick(): void
|
||||||
{
|
{
|
||||||
document.location.href = this.ad.url;
|
if(this.ad.url !== "") document.location.href = this.ad.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export class NavbarUserComponent
|
||||||
|
|
||||||
onDeconnexionCallback(retour: any): void
|
onDeconnexionCallback(retour: any): void
|
||||||
{
|
{
|
||||||
console.log(retour);
|
if(retour.status !== "success") console.log(retour);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@
|
||||||
<mat-divider></mat-divider><!------------------------------------------------------------------------------------------------------------->
|
<mat-divider></mat-divider><!------------------------------------------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
|
||||||
|
<span *ngIf="hasError" class="mat-error"> {{errorMessage}} </span>
|
||||||
<mat-dialog-actions style="justify-content: flex-end;">
|
<mat-dialog-actions style="justify-content: flex-end;">
|
||||||
<button mat-button mat-dialog-close (click)="onAnnuler()">Annuler</button>
|
<button mat-button (click)="onAnnuler()">Annuler</button>
|
||||||
<button mat-button mat-dialog-close="success" cdkFocusInitial (click)="onValider()">Valider</button>
|
<button mat-button cdkFocusInitial (click)="onValider()">Valider</button>
|
||||||
</mat-dialog-actions>
|
</mat-dialog-actions>
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
||||||
|
|
||||||
goToCreatePlaylist = false;
|
goToCreatePlaylist = false;
|
||||||
newPlaylistName = "";
|
newPlaylistName = "";
|
||||||
|
hasError: boolean = false;
|
||||||
|
tabNomPlaylist: string[] = [];
|
||||||
|
errorMessage: string = "" ;
|
||||||
|
|
||||||
|
|
||||||
constructor( public dialogRef: MatDialogRef<PopupAddVideoToPlaylistsComponent>,
|
constructor( public dialogRef: MatDialogRef<PopupAddVideoToPlaylistsComponent>,
|
||||||
|
|
@ -34,37 +37,44 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
||||||
this.source = this.data.source;
|
this.source = this.data.source;
|
||||||
this.interest = this.data.interest;
|
this.interest = this.data.interest;
|
||||||
|
|
||||||
console.log("_id: " + this._idVideo);
|
|
||||||
console.log("videoId: " + this.videoId);
|
|
||||||
console.log("source: " + this.source);
|
|
||||||
console.log("interest: " + this.interest);
|
|
||||||
|
|
||||||
for(let playlist of this.data.playlists)
|
for(let playlist of this.data.playlists)
|
||||||
{
|
{
|
||||||
if(playlist.videoIds.includes(this._idVideo)) playlist["isSelected"] = true;
|
if(playlist.videoIds.includes(this._idVideo)) playlist["isSelected"] = true;
|
||||||
else playlist["isSelected"] = false;
|
else playlist["isSelected"] = false;
|
||||||
this.tabPlaylistAndBool.push(playlist);
|
this.tabPlaylistAndBool.push(playlist);
|
||||||
|
this.tabNomPlaylist.push(playlist.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onValider(): void
|
onValider(): void
|
||||||
|
{
|
||||||
|
this.checkError();
|
||||||
|
if(!this.hasError)
|
||||||
{
|
{
|
||||||
// --- Existing playlists ---
|
// --- Existing playlists ---
|
||||||
let listeDesPlaylists = "" ;
|
let listeDesPlaylistsSelected = "" ;
|
||||||
|
let listeDesPlaylistsNotSelected = "" ;
|
||||||
for(let playlist of this.tabPlaylistAndBool)
|
for(let playlist of this.tabPlaylistAndBool)
|
||||||
{
|
{
|
||||||
if(playlist.isSelected) listeDesPlaylists += playlist.id + "," ;
|
if(playlist.isSelected) listeDesPlaylistsSelected += playlist.id + "," ;
|
||||||
|
else listeDesPlaylistsNotSelected += playlist.id + "," ;
|
||||||
}
|
}
|
||||||
if(listeDesPlaylists.endsWith(",")) listeDesPlaylists = listeDesPlaylists.slice(0, listeDesPlaylists.length-1);
|
if(listeDesPlaylistsSelected.endsWith(",")) listeDesPlaylistsSelected = listeDesPlaylistsSelected.slice(0, listeDesPlaylistsSelected.length-1);
|
||||||
|
if(listeDesPlaylistsNotSelected.endsWith(",")) listeDesPlaylistsNotSelected = listeDesPlaylistsNotSelected.slice(0, listeDesPlaylistsNotSelected.length-1);
|
||||||
|
|
||||||
console.log(listeDesPlaylists);
|
if(listeDesPlaylistsSelected !== "")
|
||||||
if(listeDesPlaylists !== "")
|
|
||||||
{
|
{
|
||||||
const data1 = { videoId: this._idVideo };
|
const data1 = { videoId: { id: this._idVideo, action: "add" } };
|
||||||
this.messageService
|
this.messageService
|
||||||
.put( "playlist/update/"+listeDesPlaylists, data1)
|
.put( "playlist/update/"+listeDesPlaylistsSelected, data1)
|
||||||
|
.subscribe( ret => this.callbackForExistingPlaylists(ret), err => this.callbackForExistingPlaylists(err));
|
||||||
|
}
|
||||||
|
if(listeDesPlaylistsNotSelected !== "")
|
||||||
|
{
|
||||||
|
const data2 = { videoId: { id: this._idVideo, action: "delete" } };
|
||||||
|
this.messageService
|
||||||
|
.put( "playlist/update/"+listeDesPlaylistsNotSelected, data2)
|
||||||
.subscribe( ret => this.callbackForExistingPlaylists(ret), err => this.callbackForExistingPlaylists(err));
|
.subscribe( ret => this.callbackForExistingPlaylists(ret), err => this.callbackForExistingPlaylists(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,36 +82,33 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
||||||
// --- New playlists ---
|
// --- New playlists ---
|
||||||
if(this.goToCreatePlaylist)
|
if(this.goToCreatePlaylist)
|
||||||
{
|
{
|
||||||
const data2 = {
|
const data3 = {
|
||||||
name: this.newPlaylistName,
|
name: this.newPlaylistName,
|
||||||
video: {videoId: this.videoId, interest: this.interest, source: this.source}
|
video: {videoId: this.videoId, interest: this.interest, source: this.source}
|
||||||
};
|
};
|
||||||
this.messageService
|
this.messageService
|
||||||
.post("playlist/create", data2)
|
.post("playlist/create", data3)
|
||||||
.subscribe( ret => this.callbackForNewPlaylist(ret), err => this.callbackForNewPlaylist(err));
|
.subscribe( ret => this.callbackForNewPlaylist(ret), err => this.callbackForNewPlaylist(err));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
// --- Finalement ---
|
||||||
|
this.dialogRef.close("success");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
callbackForExistingPlaylists(retour: any): void
|
callbackForExistingPlaylists(retour: any): void
|
||||||
{
|
{
|
||||||
console.log("onValiderCallback");
|
|
||||||
console.log(retour);
|
|
||||||
|
|
||||||
if(retour.status !== "success") {
|
if(retour.status !== "success") {
|
||||||
//console.log(retour);
|
console.log(retour);
|
||||||
this.dialogRef.close(null);
|
this.dialogRef.close(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
callbackForNewPlaylist(retour: any): void
|
callbackForNewPlaylist(retour: any): void
|
||||||
{
|
{
|
||||||
console.log("callbackForNewPlaylist");
|
|
||||||
console.log(retour);
|
|
||||||
|
|
||||||
if(retour.status !== "success") {
|
if(retour.status !== "success") {
|
||||||
console.log(retour);
|
console.log(retour);
|
||||||
this.dialogRef.close(null);
|
this.dialogRef.close(null);
|
||||||
|
|
@ -109,10 +116,26 @@ export class PopupAddVideoToPlaylistsComponent implements OnInit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onAnnuler(): void
|
onAnnuler(): void
|
||||||
{
|
{
|
||||||
this.dialogRef.close("annulation");
|
this.dialogRef.close("annulation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
checkError(): void
|
||||||
|
{
|
||||||
|
if(this.goToCreatePlaylist && (this.newPlaylistName === "")) {
|
||||||
|
this.errorMessage = "Le nom ne peut pas être vide" ;
|
||||||
|
this.hasError = true;
|
||||||
|
}
|
||||||
|
else if(this.goToCreatePlaylist && this.tabNomPlaylist.includes(this.newPlaylistName)){
|
||||||
|
this.errorMessage = "Ce nom est déjà utilisé" ;
|
||||||
|
this.hasError = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.hasError = false;
|
||||||
|
this.errorMessage = "" ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import {MatDialog} from "@angular/material/dialog";
|
||||||
import {PopupAddVideoToPlaylistsComponent} from "../../components/popup-add-video-to-playlists/popup-add-video-to-playlists.component";
|
import {PopupAddVideoToPlaylistsComponent} from "../../components/popup-add-video-to-playlists/popup-add-video-to-playlists.component";
|
||||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||||
import {FictitiousVideosService} from "../../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
|
import {FictitiousVideosService} from "../../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
|
||||||
import {HttpParams} from "@angular/common/http";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -40,11 +39,8 @@ export class AddVideoToPlaylistsService
|
||||||
|
|
||||||
private afterCreatingVideo(retour: any): void
|
private afterCreatingVideo(retour: any): void
|
||||||
{
|
{
|
||||||
console.log("afterCreatingVideo");
|
|
||||||
console.log(retour);
|
|
||||||
|
|
||||||
if(retour.status !== "success") {
|
if(retour.status !== "success") {
|
||||||
//console.log(retour);
|
console.log(retour);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this._idVideo = retour.data.id;
|
this._idVideo = retour.data.id;
|
||||||
|
|
@ -58,11 +54,8 @@ export class AddVideoToPlaylistsService
|
||||||
|
|
||||||
private afterReceivingPlaylists(retour: any): void
|
private afterReceivingPlaylists(retour: any): void
|
||||||
{
|
{
|
||||||
console.log("afterReceivingPlaylists");
|
|
||||||
console.log(retour);
|
|
||||||
|
|
||||||
if(retour.status !== "success") {
|
if(retour.status !== "success") {
|
||||||
//console.log(retour);
|
console.log(retour);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
import { TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { UserHistoryService } from './userHistory.service';
|
|
||||||
|
|
||||||
describe('HistoriqueService', () => {
|
|
||||||
let service: UserHistoryService;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({});
|
|
||||||
service = TestBed.inject(UserHistoryService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(service).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
import { Injectable } from '@angular/core';
|
|
||||||
import {VideoDB} from "../../../../utils/interfaces/video";
|
|
||||||
import {MessageService} from "../../../../utils/services/message/message.service";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class UserHistoryService
|
|
||||||
{
|
|
||||||
private tabVideoUrlClicked: string[] = [];
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private messageService: MessageService) { }
|
|
||||||
|
|
||||||
|
|
||||||
public addVideoToHistoque(video: VideoDB): void
|
|
||||||
{
|
|
||||||
if (!this.tabVideoUrlClicked.includes(video.videoId))
|
|
||||||
{
|
|
||||||
this.tabVideoUrlClicked.push(video.videoId);
|
|
||||||
video.watchedDates.push(new Date());
|
|
||||||
|
|
||||||
// --- VRAI CODE ---
|
|
||||||
/*
|
|
||||||
this.messageService
|
|
||||||
.sendMessage("user/add/watchedVideo", {watchedVideo: watchedVideo0})
|
|
||||||
.subscribe(retour => {});
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public clearTabVideoUrlClicked()
|
|
||||||
{
|
|
||||||
this.tabVideoUrlClicked = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<!-- Search bar -->
|
<!-- Search bar -->
|
||||||
<div class="input-group" style="width: 100%; margin: 0 auto;">
|
<div class="input-group" style="width: 100%; margin: 0 auto;">
|
||||||
<div class="form-outline" style="width: 100%; margin: 0 auto;">
|
<div class="form-outline" style="width: 100%; margin: 0 auto;">
|
||||||
<input type="search" placeholder="Rechercher..." class="inputSearchBar"/>
|
<input type="search" placeholder="Rechercher..." class="inputSearchBar" (keydown)="onEnterOnSearchBar($event)"/>
|
||||||
<button mat-icon-button (click)="onSearch()">
|
<button mat-icon-button (click)="onSearch()">
|
||||||
<mat-icon>search</mat-icon>
|
<mat-icon>search</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,12 @@ export class PageWatchingVideoComponent implements OnInit
|
||||||
views: 0,
|
views: 0,
|
||||||
publishedAt: null,
|
publishedAt: null,
|
||||||
description: "",
|
description: "",
|
||||||
source: ""
|
source: "",
|
||||||
|
interest: ""
|
||||||
};
|
};
|
||||||
search: string = "";
|
search: string = "";
|
||||||
ad1: any = { title: "", url: "", images: [] };
|
ad1: any;
|
||||||
ad2: any = { title: "", url: "", images: [] };
|
ad2: any;
|
||||||
from: string = "";
|
from: string = "";
|
||||||
|
|
||||||
playlist: PlaylistDB;
|
playlist: PlaylistDB;
|
||||||
|
|
@ -55,7 +56,8 @@ export class PageWatchingVideoComponent implements OnInit
|
||||||
public themeService: ThemeService,
|
public themeService: ThemeService,
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private _sanitizer: DomSanitizer ) { }
|
private _sanitizer: DomSanitizer,
|
||||||
|
private addVideoToPlaylistsService: AddVideoToPlaylistsService ) { }
|
||||||
|
|
||||||
|
|
||||||
ngOnInit(): void
|
ngOnInit(): void
|
||||||
|
|
@ -139,7 +141,7 @@ export class PageWatchingVideoComponent implements OnInit
|
||||||
|
|
||||||
onAddToPlaylist(): void
|
onAddToPlaylist(): void
|
||||||
{
|
{
|
||||||
//this.addVideoToPlaylistsService.run(this.video);
|
this.addVideoToPlaylistsService.run(this.video.videoId, this.video.source, this.video.interest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -167,4 +169,10 @@ export class PageWatchingVideoComponent implements OnInit
|
||||||
else return "videoCell" ;
|
else return "videoCell" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onEnterOnSearchBar(event)
|
||||||
|
{
|
||||||
|
if(event.key === 'Enter') this.onSearch();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue