import {AfterViewInit, Component, inject, CUSTOM_ELEMENTS_SCHEMA, ViewChild, ElementRef} from '@angular/core';
import {
  MAT_DIALOG_DATA,
  MatDialogActions,
  MatDialogClose,
  MatDialogContent,
  MatDialogTitle
} from '@angular/material/dialog';
import {Projects} from '../projects.component';
import {TranslatePipe} from '@ngx-translate/core';
import {MatIcon} from '@angular/material/icon';
import {MatChip, MatChipSet} from '@angular/material/chips';
import {MatButton} from '@angular/material/button';

@Component({
  selector: 'app-project-dialog',
  templateUrl: './project-dialog.component.html',
  styleUrl: './project-dialog.component.scss',
  imports: [
    MatDialogTitle,
    MatDialogContent,
    TranslatePipe,
    MatIcon,
    MatChip,
    MatChipSet,
    MatDialogActions,
    MatButton,
    MatDialogClose
  ],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ProjectDialogComponent implements AfterViewInit {
  project: Projects = inject(MAT_DIALOG_DATA);

  @ViewChild('dialogContent') dialogContent: ElementRef | undefined;

  ngAfterViewInit(): void {
    if (this.dialogContent) {
      this.dialogContent.nativeElement.scrollTop = 0;
    }
  }
}
