|
|
|
@ -4,12 +4,10 @@ import { Pin } from '../../model/Pin';
|
|
|
|
|
import { PinService } from '../../services/pin/pin.service';
|
|
|
|
|
import { RouterModule } from '@angular/router';
|
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
import { AuthService } from '../../services/auth/auth.service';
|
|
|
|
|
import { UserService } from '../../services/user/user.service';
|
|
|
|
|
import { ImageService } from '../../services/image/image.service';
|
|
|
|
|
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
import { Renderer2 } from '@angular/core';
|
|
|
|
|
import { CookiesService } from '../../services/cookies/cookies.service';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@ -41,18 +39,14 @@ export class PinDetailComponent {
|
|
|
|
|
constructor(
|
|
|
|
|
private pinService: PinService,
|
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
|
private authService: AuthService,
|
|
|
|
|
private userService: UserService,
|
|
|
|
|
private imageService: ImageService,
|
|
|
|
|
private sanitizer: DomSanitizer,
|
|
|
|
|
private router: Router,
|
|
|
|
|
private renderer: Renderer2,
|
|
|
|
|
private cookiesService: CookiesService
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
|
// this.renderer.addClass(document.body, 'no-scroll-body');
|
|
|
|
|
|
|
|
|
|
const pinId = this.route.snapshot.paramMap.get('id');
|
|
|
|
|
this.username_session = this.cookiesService.getUsername() || '';
|
|
|
|
|
|
|
|
|
@ -87,7 +81,7 @@ export class PinDetailComponent {
|
|
|
|
|
loadUsername(userId: string) {
|
|
|
|
|
this.userService.getUserById(userId).subscribe({
|
|
|
|
|
next: (user) => {
|
|
|
|
|
this.username = user.username; // ou user.name selon ton backend
|
|
|
|
|
this.username = user.username;
|
|
|
|
|
},
|
|
|
|
|
error: (err) => {
|
|
|
|
|
console.error('Erreur lors de la récupération du pseudo :', err);
|
|
|
|
@ -121,10 +115,6 @@ export class PinDetailComponent {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// toggleDescription(): void {
|
|
|
|
|
// this.expandedDescription = !this.expandedDescription;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
ngAfterViewInit(): void {
|
|
|
|
|
this.checkIfDescriptionIsTruncated();
|
|
|
|
|
}
|
|
|
|
@ -153,10 +143,6 @@ export class PinDetailComponent {
|
|
|
|
|
this.currentIndex = (this.currentIndex + 1) % this.imageUrls.length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
|
|
|
|
// this.renderer.removeClass(document.body, 'no-scroll-body');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goBack() {
|
|
|
|
|
this.router.navigate(['/map'], { queryParams: { pin: this.pin.id } });
|
|
|
|
|
}
|
|
|
|
|