feat: Side menu dinámico, login social y traducciones hero

- app.component: menú lateral con roles de usuario, ChangeDetectorRef
  para re-render tras login, integración OneSignal al iniciar sesión
- auth/login: botones Google y Apple con estilos, navegación corregida
- auth/register y forgot: mejoras de UX y navegación
- landing: sombra en botones del footer
- i18n: claves hero (select, bank, bank_account, fee, required) en es/en

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 08:18:12 -06:00
parent 0efe318db3
commit db0d0001fa
12 changed files with 314 additions and 241 deletions

View File

@@ -4,85 +4,93 @@ import { AuthService } from 'src/app/services/auth.service';
import { NgForm } from '@angular/forms';
import { AlertService } from 'src/app/services/alert.service';
import { TranslateService } from '@ngx-translate/core';
import { FirebaseAuthService } from 'src/app/services/firebase-auth.service';
import { Browser } from '@capacitor/browser';
@Component({
selector: 'app-register',
templateUrl: './register.page.html',
styleUrls: ['./register.page.scss'],
standalone: false
})
export class RegisterPage implements OnInit {
loading: any = null;
loading: HTMLIonLoadingElement | null = null;
terms = false;
constructor(
private authService: AuthService,
private firebaseAuthService: FirebaseAuthService,
private translateService: TranslateService,
private navCtrl: NavController,
private loadingCtrl: LoadingController,
private alertService: AlertService
) { }
ngOnInit() {
}
// Dismiss Register Modal
ngOnInit() { }
dismissRegister() {
this.navCtrl.navigateRoot('/landing');
}
// On Login button tap, dismiss Register modal and open login Modal
loginModal() {
this.navCtrl.navigateForward('/login');
}
updateChecked () {
if (this.terms == true) {
this.terms = false;
console.log(this.terms);
} else {
this.terms = true;
console.log(this.terms);
}
updateChecked() {
this.terms = !this.terms;
}
register(form: NgForm) {
if (this.terms == true) {
if (form.value.name && form.value.email && form.value.phone && form.value.password && form.value.password1) {
if (form.value.password == form.value.password1) {
this.loadingCtrl.create().then((overlay) => {
this.loading = overlay;
this.loading.present();
});
this.authService.register(form.value.name, form.value.email, form.value.phone, form.value.password).subscribe(
data => {
this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.signup'));
},
error => {
if (JSON.stringify(error['status']) == '422') {
this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.signup_error'));
}
else {
this.loading.dismiss();
console.log(error);
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['message']);
}
},
() => {
}
);
} else {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_1'));
}
} else {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_2'));
}
} else {
async register(form: NgForm) {
if (!this.terms) {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_3'));
return;
}
const { name, email, phone, password, password1 } = form.value;
if (!name || !email || !phone || !password || !password1) {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_2'));
return;
}
if (password !== password1) {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error_1'));
return;
}
this.loading = await this.loadingCtrl.create();
await this.loading.present();
try {
// Firebase crea la cuenta con email + password
const idToken = await this.firebaseAuthService.registerWithEmail(email, password);
// Backend crea el perfil y devuelve el token de la app
this.authService.registerWithFirebase(idToken, name, phone, email).subscribe(
(data: any) => {},
(error: any) => {
if (this.loading) this.loading.dismiss();
if (error['status'] === 422) {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error'));
} else {
this.alertService.presentToast(this.translateService.instant('alerts.error') + error['message']);
}
},
() => {
if (this.loading) this.loading.dismiss();
this.alertService.presentToast(this.translateService.instant('alerts.signup'));
this.navCtrl.navigateRoot('/dashboard');
}
);
} catch (e: any) {
if (this.loading) this.loading.dismiss();
if (e.code === 'auth/email-already-in-use') {
this.alertService.presentToast(this.translateService.instant('alerts.signup_error'));
} else {
this.alertService.presentToast(this.translateService.instant('alerts.error') + e.message);
}
}
}
async openTerms() {