add initial Angular components, services, and routing setup

This commit is contained in:
Vincent Guillet
2025-09-24 11:31:28 +02:00
parent dfb4ac302a
commit 18f0364e26
64 changed files with 15879 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
.home-container {
max-width: 800px;
margin: 0 auto;
padding: 2rem 1rem;
text-align: center;
}
.home-actions {
margin-top: 2rem;
display: flex;
justify-content: center;
gap: 1rem;
}

View File

@@ -0,0 +1,13 @@
<div class="home-container">
@if (getUser(); as user) {
<h1>Welcome, {{ user.firstName }}!</h1>
<p>What would you like to do today?</p>
} @else {
<h1>Welcome to the demo</h1>
<p>Create an account or sign in to get started.</p>
<div class="home-actions">
<button mat-flat-button [routerLink]="'/login'">Login</button>
<button mat-raised-button [routerLink]="'/register'">Sign Up</button>
</div>
}
</div>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomeComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,23 @@
import {Component, inject} from '@angular/core';
import {MatButton} from '@angular/material/button';
import {AuthService} from '../../services/auth/auth.service';
import {RouterLink} from '@angular/router';
@Component({
selector: 'app-home',
standalone: true,
imports: [
MatButton,
RouterLink
],
templateUrl: './home.component.html',
styleUrl: './home.component.css'
})
export class HomeComponent {
protected readonly authService: AuthService = inject(AuthService);
getUser() {
return this.authService.user();
}
}