1import { Component, Input } from '@angular/core'; 2import { MatButtonModule } from '@angular/material/button'; 3import { MatIconModule } from '@angular/material/icon'; 4import { MatSnackBar } from '@angular/material/snack-bar'; 5import { finalize } from 'rxjs'; 6 7import { MotionGolden } from '../golden'; 8import { GoldensService } from '../goldens.service'; 9 10@Component({ 11 selector: 'app-motion-golden', 12 standalone: true, 13 imports: [MatIconModule, MatButtonModule], 14 templateUrl: './motion-golden.component.html', 15 styleUrl: './motion-golden.component.scss', 16}) 17export class MotionGoldenComponent { 18 constructor( 19 private goldenService: GoldensService, 20 private _snackBar: MatSnackBar, 21 ) {} 22 23 @Input() golden!: MotionGolden; 24 25 updateGolden(): void { 26 this.goldenService 27 .updateGolden(this.golden) 28 .pipe(finalize(() => {})) 29 .subscribe((_) => this._snackBar.open('updated')); 30 } 31} 32