import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { AppDragDropService } from 'src/app/shared/drag/app-drag-drop.service';
import { SidebarGroup } from 'src/app/shared/server-services/query-records/sidebar-records';

@Component({
  selector: 'app-sidebar-group-drag-preview',
  templateUrl: './sidebar-group-drag-preview.component.html',
  styleUrls: ['./sidebar-group-drag-preview.component.scss'],
})
export class SidebarGroupDragPreviewComponent implements OnInit {
  public data: SidebarGroup;
  public name: string;
  public loaded: boolean = false;

  constructor(
    private appDragDropService: AppDragDropService,
    private changeDetectionRef: ChangeDetectorRef
  ) {}

  ngOnInit(): void {
    this.data = this.appDragDropService.getDraggedComponent().previewData;
    this.name = this.data.name;
    this.loaded = true;
    this.changeDetectionRef.detectChanges();
  }
}
