Spaces:
Running
Running
File size: 1,627 Bytes
a828e09 07cf142 292ac14 07cf142 292ac14 9c5dc7b a828e09 292ac14 a828e09 9c5dc7b 4630504 eef9fb0 a828e09 292ac14 9c5dc7b a828e09 9c5dc7b 292ac14 9c5dc7b a828e09 9c5dc7b 292ac14 9c5dc7b a828e09 9c5dc7b 07cf142 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
import { Component, signal, computed } from '@angular/core';
import { AuthService } from './auth/auth.service';
import { AuthUiService } from './auth/auth-ui.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-root',
templateUrl: './app.html',
standalone: false,
styleUrls: ['./app.scss']
})
export class App {
protected readonly title = signal('Pytrade');
isShowDropDown = false;
// Keep signup modal local if you want
signupOpen = false;
constructor(public auth: AuthService, public authUi: AuthUiService, private router: Router) {}
// Display name for the dropdown
displayName = computed(() => {
const u = this.auth.user();
return u?.displayName || u?.email || 'Account';
});
// First letter for avatar
avatarInitial = computed(() => {
const n = this.displayName();
return (n?.trim()?.charAt(0) || '').toUpperCase();
});
// Hover handlers
showDropDown() { this.isShowDropDown = true; }
hideDropDown() { this.isShowDropDown = false; }
openSignup() {
this.signupOpen = true;
this.isShowDropDown = false;
}
openSignin() {
this.authUi.openSignin();
this.isShowDropDown = false;
}
closeSignup() { this.signupOpen = false; }
closeSignin() { this.authUi.closeSignin(); }
handleSignup(payload: any) {
console.log('Signup payload', payload);
this.signupOpen = false;
}
handleSignin(payload: any) {
console.log('Signin payload', payload);
this.authUi.closeSignin();
}
logout() {
this.auth.logout();
this.isShowDropDown = false;
this.router.navigate(['/']);
}
}
|