be5f5775ef
- ng update @angular/core@20 @angular/cli@20 @angular/material@20 @angular-eslint@20 @angular/google-maps@20 - Remove ng-chartist (abandoned, incompatible with Angular 20): replace <x-chartist> with <app-bars-chart> in dropzones-bar and jumps-by-month - Migrate all constructor injection to inject() function (ng generate @angular/core:inject, 67 files) - TypeScript 5.5 → 5.9.3 - DOCUMENT import moved from @angular/common to @angular/core (automatic migration) - tsconfig moduleResolution updated to "bundler"
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { Component, OnDestroy, Input, inject } from '@angular/core';
|
|
import { DecimalPipe } from '@angular/common';
|
|
import { Router, RouterLink } from '@angular/router';
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { MatCardModule } from '@angular/material/card';
|
|
import { MatDividerModule } from '@angular/material/divider';
|
|
import { Observable, Subscription } from 'rxjs';
|
|
|
|
import { JumpMetaComponent } from './jump-meta.component';
|
|
import { Jump } from '@models';
|
|
import { JumpsService } from '@services';
|
|
|
|
@Component({
|
|
selector: 'app-jump-preview',
|
|
imports: [DecimalPipe, RouterLink, MatDividerModule, MatButtonModule, MatCardModule, JumpMetaComponent],
|
|
styleUrl: './jump-preview.component.scss',
|
|
templateUrl: './jump-preview.component.html',
|
|
})
|
|
export class JumpPreviewComponent implements OnDestroy {
|
|
private router = inject(Router);
|
|
private jumpsService = inject(JumpsService);
|
|
|
|
@Input() jump!: Jump;
|
|
@Input() isUser!: boolean;
|
|
@Input() showMeta!: boolean;
|
|
private _jump: Subscription = new Subscription();
|
|
isDeleting = false;
|
|
|
|
ngOnDestroy() {
|
|
this._jump.unsubscribe();
|
|
}
|
|
|
|
deleteJump() {
|
|
this.isDeleting = true;
|
|
const jump$: Observable<boolean> = this.jumpsService.destroy(this.jump.slug);
|
|
this._jump = jump$.subscribe({
|
|
next: () => {
|
|
this.router.navigateByUrl('/');
|
|
},
|
|
});
|
|
}
|
|
}
|