import { Component, OnInit, Optional } from '@angular/core';
import { DetailsFormBase } from '@objects-view/details-form-base';
import { IUserProfileModel } from '@fleio-api/profile/model/user-profile.model';
import { ConfigService } from '@shared/config/config.service';
import { PanelLayoutComponent } from '@shared/layout/panel-layout/panel-layout.component';
import { ThemingService } from '@shared/ui/theming/theming.service';
import { LanguageService } from '@shared/language/language.service';

@Component({
  selector: 'app-user-profile-details-panel',
  templateUrl: './user-profile-details-panel.component.html',
  styleUrls: ['./user-profile-details-panel.component.scss']
})
export class UserProfileDetailsPanelComponent extends DetailsFormBase<IUserProfileModel> implements OnInit {
  gravatarOpts = {
    width: '50px',
    marginRight: '15px',
    verticalAlign: 'middle'
  } as any;

  constructor(
    public config: ConfigService,
    public themingService: ThemingService,
    private languageService: LanguageService,
    @Optional() public panelLayout?: PanelLayoutComponent
  ) {
    super();
  }

  ngOnInit(): void {
    if (this.languageService.langDirection === 'rtl') {
      this.gravatarOpts = {
        width: '50px',
        marginLeft: '15px',
        verticalAlign: 'middle'
      };
    }
  }

}
