5400294d45
- ng update @angular/core@19 @angular/cli@19 @angular/material@19 @angular-eslint/schematics@19 - Migration: remove standalone:true (now default in v19) from 60 components - Migration: zone.js 0.14 → 0.15 - Fix pre-existing build budget error: raise initial bundle limit to 5mb (app ships large static JSON assets)
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { Component, OnDestroy, Input } 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 {
|
|
@Input() jump!: Jump;
|
|
@Input() isUser!: boolean;
|
|
@Input() showMeta!: boolean;
|
|
private _jump: Subscription = new Subscription();
|
|
isDeleting = false;
|
|
|
|
constructor(
|
|
private router: Router,
|
|
private jumpsService: JumpsService,
|
|
) {}
|
|
|
|
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('/');
|
|
},
|
|
});
|
|
}
|
|
}
|