add initial Angular components, services, and routing setup
This commit is contained in:
13
client/src/app/pages/home/home.component.css
Normal file
13
client/src/app/pages/home/home.component.css
Normal 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;
|
||||
}
|
||||
13
client/src/app/pages/home/home.component.html
Normal file
13
client/src/app/pages/home/home.component.html
Normal 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>
|
||||
23
client/src/app/pages/home/home.component.spec.ts
Normal file
23
client/src/app/pages/home/home.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
23
client/src/app/pages/home/home.component.ts
Normal file
23
client/src/app/pages/home/home.component.ts
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user