Skip to content

Commit

Permalink
Added routes for property-related pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan923 committed Jan 29, 2024
1 parent bcdf839 commit bedfe9d
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 9 deletions.
14 changes: 14 additions & 0 deletions frontend/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {map} from "rxjs";
import {AppComponent} from "./app.component";
import AuthenticationComponent from "./authentication/authentication.component";
import {HomeComponent} from "./home/home.component";
import {ListPropertiesComponent} from "./properties/list-properties/list-properties.component";
import {NewPropertyComponent} from "./properties/new-property/new-property.component";

export const routes: Routes = [
{
Expand All @@ -25,4 +27,16 @@ export const routes: Routes = [
() => inject(AuthenticationService).isAuthenticated.pipe(map((isAuth) => !isAuth)),
],
},
{
path: "properties",
component: ListPropertiesComponent,
canActivate: [() => inject(AuthenticationService).isAuthenticated],
children: [
{
path: "new",
component: NewPropertyComponent,
canActivate: [() => inject(AuthenticationService).isAuthenticated],
},
],
},
]
13 changes: 8 additions & 5 deletions frontend/src/app/home/home.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<div class="container-fluid pt-5">
<div class="row centered-container">
<div class="col-sm img-btn-card mrc-1">
<a [routerLink]="['/properties']" class="col-sm img-btn-card mrc-1">
<img [src]="'assets/list-offers-icon.png'" class="img-fluid m-3" width="112" height="112" alt="show-properties-icon">
</div>
<div class="col-sm img-btn-card">
<img [src]="'assets/add-announce-icon.png'" class="img-fluid m-3" width="112" height="112" alt="Add Property">
</div>
</a>
<a [routerLink]="['/properties/new']" class="col-sm img-btn-card mrc-1">
<img [src]="'ass ets/my-properties-icon.png'" class="img-fluid m-3" width="112" height="112" alt="my-properties-icon">
</a>
<a [routerLink]="['/properties/new']" class="col-sm img-btn-card">
<img [src]="'assets/add-announce-icon.png'" class="img-fluid m-3" width="112" height="112" alt="add-property-icon">
</a>
</div>
</div>
8 changes: 4 additions & 4 deletions frontend/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Component } from '@angular/core';
import {NgOptimizedImage} from "@angular/common";
import {Router, RouterLink, RouterModule} from "@angular/router";

@Component({
selector: 'app-home',
standalone: true,
imports: [
NgOptimizedImage
NgOptimizedImage,
RouterModule
],
templateUrl: './home.component.html',
styleUrl: './home.component.css'
})
export class HomeComponent {

}
export class HomeComponent {}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>list-properties works!</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ListPropertiesComponent } from './list-properties.component';

describe('ListPropertiesComponent', () => {
let component: ListPropertiesComponent;
let fixture: ComponentFixture<ListPropertiesComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ListPropertiesComponent]
})
.compileComponents();

fixture = TestBed.createComponent(ListPropertiesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';

@Component({
selector: 'list-properties-component',
standalone: true,
imports: [],
templateUrl: './list-properties.component.html',
styleUrl: './list-properties.component.css'
})
export class ListPropertiesComponent {

}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>new-property works!</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { NewPropertyComponent } from './new-property.component';

describe('NewPropertyComponent', () => {
let component: NewPropertyComponent;
let fixture: ComponentFixture<NewPropertyComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [NewPropertyComponent]
})
.compileComponents();

fixture = TestBed.createComponent(NewPropertyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
12 changes: 12 additions & 0 deletions frontend/src/app/properties/new-property/new-property.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-new-property',
standalone: true,
imports: [],
templateUrl: './new-property.component.html',
styleUrl: './new-property.component.css'
})
export class NewPropertyComponent {

}

0 comments on commit bedfe9d

Please sign in to comment.