mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
75 lines
2.1 KiB
TypeScript
75 lines
2.1 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { AnimationController, ModalController } from '@ionic/angular';
|
|
import { SearchPage } from 'src/app/pages/search/search.page';
|
|
import { MenuController } from '@ionic/angular';
|
|
import { ProfileComponent } from './profile/profile.component';
|
|
import { Router } from '@angular/router';
|
|
import { AuthService } from 'src/app/services/auth.service';
|
|
import { User } from 'src/app/models/user.model';
|
|
@Component({
|
|
selector: 'app-header-no-search',
|
|
templateUrl: './header-no-search.page.html',
|
|
styleUrls: ['./header-no-search.page.scss'],
|
|
})
|
|
export class HeaderNoSearchPage implements OnInit {
|
|
|
|
loggeduser: User;
|
|
|
|
constructor(private modalController: ModalController,
|
|
private menu: MenuController,
|
|
private animationController: AnimationController,
|
|
private router: Router,
|
|
authService: AuthService) {
|
|
|
|
this.loggeduser = authService.ValidatedUser;
|
|
}
|
|
|
|
ngOnInit() {
|
|
}
|
|
|
|
async openProfile() {
|
|
|
|
const enterAnimation = (baseEl: any) => {
|
|
const backdropAnimation = this.animationController.create()
|
|
.addElement(baseEl.querySelector('ion-backdrop')!)
|
|
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
|
|
|
|
const wrapperAnimation = this.animationController.create()
|
|
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
|
.keyframes([
|
|
{ offset: 0, opacity: '1', right: '-100%' },
|
|
{ offset: 1, opacity: '1', right: '0px' }
|
|
]);
|
|
|
|
return this.animationController.create()
|
|
.addElement(baseEl)
|
|
.easing('ease-out')
|
|
.duration(500)
|
|
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
}
|
|
|
|
const leaveAnimation = (baseEl: any) => {
|
|
return enterAnimation(baseEl).direction('reverse');
|
|
}
|
|
|
|
|
|
const modal = await this.modalController.create({
|
|
enterAnimation,
|
|
leaveAnimation,
|
|
component: ProfileComponent,
|
|
cssClass: 'model profile-modal',
|
|
componentProps: {
|
|
}
|
|
});
|
|
return await modal.present();
|
|
}
|
|
|
|
changeRoute(path){
|
|
this.router.navigateByUrl(path)
|
|
}
|
|
|
|
locationPathname(): string {
|
|
return window.location.pathname
|
|
}
|
|
}
|