ez claps
This commit is contained in:
17
.editorconfig
Normal file
17
.editorconfig
Normal file
@ -0,0 +1,17 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
ij_typescript_use_double_quotes = false
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
|
||||
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# Node
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
.idea/
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Homes
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.11.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
99
angular.json
Normal file
99
angular.json
Normal file
@ -0,0 +1,99 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"homes": {
|
||||
"projectType": "application",
|
||||
"schematics": {},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:application",
|
||||
"options": {
|
||||
"outputPath": "dist/homes",
|
||||
"index": "src/index.html",
|
||||
"browser": "src/main.ts",
|
||||
"polyfills": [
|
||||
"zone.js",
|
||||
"@angular/localize/init"
|
||||
],
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "public"
|
||||
}
|
||||
],
|
||||
"styles": [
|
||||
"node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||
"src/styles.css"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kB",
|
||||
"maximumError": "1MB"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kB",
|
||||
"maximumError": "4kB"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"optimization": false,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "homes:build:production"
|
||||
},
|
||||
"development": {
|
||||
"buildTarget": "homes:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n"
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"polyfills": [
|
||||
"zone.js",
|
||||
"zone.js/testing",
|
||||
"@angular/localize/init"
|
||||
],
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "public"
|
||||
}
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.css"
|
||||
],
|
||||
"scripts": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
14172
package-lock.json
generated
Normal file
14172
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
42
package.json
Normal file
42
package.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "homes",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^18.2.0",
|
||||
"@angular/common": "^18.2.0",
|
||||
"@angular/compiler": "^18.2.0",
|
||||
"@angular/core": "^18.2.0",
|
||||
"@angular/forms": "^18.2.0",
|
||||
"@angular/platform-browser": "^18.2.0",
|
||||
"@angular/platform-browser-dynamic": "^18.2.0",
|
||||
"@angular/router": "^18.2.0",
|
||||
"@ng-bootstrap/ng-bootstrap": "^17.0.1",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"bootstrap": "^5.3.2",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0",
|
||||
"zone.js": "~0.14.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^18.2.11",
|
||||
"@angular/cli": "^18.2.11",
|
||||
"@angular/compiler-cli": "^18.2.0",
|
||||
"@angular/localize": "^18.2.0",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"jasmine-core": "~5.2.0",
|
||||
"karma": "~6.4.0",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
"karma-coverage": "~2.2.0",
|
||||
"karma-jasmine": "~5.1.0",
|
||||
"karma-jasmine-html-reporter": "~2.1.0",
|
||||
"typescript": "~5.5.2"
|
||||
}
|
||||
}
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
0
src/app/app.component.css
Normal file
0
src/app/app.component.css
Normal file
9
src/app/app.component.html
Normal file
9
src/app/app.component.html
Normal file
@ -0,0 +1,9 @@
|
||||
<div class="container">
|
||||
<div class="text-center my-4">
|
||||
<a [routerLink]="['/']" class="display-4 text-decoration-none fw-bold text-primary hover:text-decoration-underline">
|
||||
Homes
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
29
src/app/app.component.spec.ts
Normal file
29
src/app/app.component.spec.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [AppComponent],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have the 'homes' title`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('homes');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, homes');
|
||||
});
|
||||
});
|
14
src/app/app.component.ts
Normal file
14
src/app/app.component.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {RouterLink, RouterOutlet} from '@angular/router';
|
||||
import {HomeComponent} from './home/home.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
standalone: true,
|
||||
imports: [RouterOutlet, HomeComponent, RouterLink],
|
||||
templateUrl: './app.component.html',
|
||||
styleUrl: './app.component.css'
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'homes';
|
||||
}
|
8
src/app/app.config.ts
Normal file
8
src/app/app.config.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { routes } from './app.routes';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)]
|
||||
};
|
17
src/app/app.routes.ts
Normal file
17
src/app/app.routes.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import {HomeComponent} from './home/home.component';
|
||||
import {DetailsComponent} from './details/details.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: HomeComponent,
|
||||
title: 'Home page',
|
||||
},
|
||||
|
||||
{
|
||||
path: 'details/:id',
|
||||
component: DetailsComponent,
|
||||
title: 'Home Details',
|
||||
},
|
||||
];
|
0
src/app/details/details.component.css
Normal file
0
src/app/details/details.component.css
Normal file
92
src/app/details/details.component.html
Normal file
92
src/app/details/details.component.html
Normal file
@ -0,0 +1,92 @@
|
||||
<article class="container my-5">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<img
|
||||
class="img-fluid rounded shadow mb-4"
|
||||
style="width: 100%; height: 385px; object-fit: cover;"
|
||||
[src]="housingLocation?.photo"
|
||||
alt="Exterior photo of {{ housingLocation?.name }}"
|
||||
crossorigin
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<section class="mb-4">
|
||||
<h2 class="display-5 fw-bold text-primary mb-3">{{ housingLocation?.name }}</h2>
|
||||
<p class="fs-4 text-secondary">{{ housingLocation?.city }}, {{ housingLocation?.state }}</p>
|
||||
</section>
|
||||
|
||||
<section class="bg-light p-4 rounded shadow-sm">
|
||||
<h2 class="h4 mb-4 border-bottom pb-2">About this housing location</h2>
|
||||
<ul class="list-unstyled">
|
||||
<li class="mb-3 d-flex align-items-center">
|
||||
<i class="bi bi-building me-2"></i>
|
||||
<span class="fs-5">Units available: <strong>{{ housingLocation?.availableUnits }}</strong></span>
|
||||
</li>
|
||||
<li class="mb-3 d-flex align-items-center">
|
||||
<i class="bi bi-wifi me-2"></i>
|
||||
<span class="fs-5">WiFi:
|
||||
<strong>{{ housingLocation?.wifi ? 'Yes' : 'No' }}</strong>
|
||||
</span>
|
||||
</li>
|
||||
<li class="mb-3 d-flex align-items-center">
|
||||
<i class="bi bi-water me-2"></i>
|
||||
<span class="fs-5">Laundry:
|
||||
<strong>{{ housingLocation?.laundry ? 'Yes' : 'No' }}</strong>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="mt-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="bg-light p-4 rounded shadow-sm">
|
||||
<h2 class="h3 mb-4 text-primary border-bottom pb-2">Apply now</h2>
|
||||
|
||||
<form [formGroup]="applyForm" (submit)="submitApplication()" class="needs-validation">
|
||||
<div class="mb-3">
|
||||
<label for="first-name" class="form-label">First Name</label>
|
||||
<input
|
||||
id="first-name"
|
||||
type="text"
|
||||
class="form-control"
|
||||
formControlName="firstName"
|
||||
placeholder="Enter your first name"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="last-name" class="form-label">Last Name</label>
|
||||
<input
|
||||
id="last-name"
|
||||
type="text"
|
||||
class="form-control"
|
||||
formControlName="lastName"
|
||||
placeholder="Enter your last name"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input
|
||||
id="email"
|
||||
type="email"
|
||||
class="form-control"
|
||||
formControlName="email"
|
||||
placeholder="Enter your email"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary btn-lg">
|
||||
<i class="bi bi-send me-2"></i>Submit Application
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
23
src/app/details/details.component.spec.ts
Normal file
23
src/app/details/details.component.spec.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DetailsComponent } from './details.component';
|
||||
|
||||
describe('DetailsComponent', () => {
|
||||
let component: DetailsComponent;
|
||||
let fixture: ComponentFixture<DetailsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [DetailsComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(DetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
39
src/app/details/details.component.ts
Normal file
39
src/app/details/details.component.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {HousingService} from '../housing.service';
|
||||
import {HousingLocation} from '../housing-location';
|
||||
import {FormControl, FormGroup, ReactiveFormsModule} from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-details',
|
||||
standalone: true,
|
||||
imports: [
|
||||
ReactiveFormsModule
|
||||
],
|
||||
templateUrl: './details.component.html',
|
||||
styleUrl: './details.component.css'
|
||||
})
|
||||
export class DetailsComponent {
|
||||
route: ActivatedRoute = inject(ActivatedRoute);
|
||||
housingService = inject(HousingService);
|
||||
housingLocation: HousingLocation | undefined;
|
||||
|
||||
applyForm = new FormGroup({
|
||||
firstName: new FormControl(''),
|
||||
lastName: new FormControl(''),
|
||||
email: new FormControl(''),
|
||||
});
|
||||
|
||||
constructor() {
|
||||
const housingLocationId = Number(this.route.snapshot.params['id']);
|
||||
this.housingLocation = this.housingService.getHousingLocationById(housingLocationId);
|
||||
}
|
||||
|
||||
submitApplication() {
|
||||
this.housingService.submitApplication(
|
||||
this.applyForm.value.firstName ?? '',
|
||||
this.applyForm.value.lastName ?? '',
|
||||
this.applyForm.value.email ?? '',
|
||||
);
|
||||
}
|
||||
}
|
0
src/app/home/home.component.css
Normal file
0
src/app/home/home.component.css
Normal file
14
src/app/home/home.component.html
Normal file
14
src/app/home/home.component.html
Normal file
@ -0,0 +1,14 @@
|
||||
<section class="my-5">
|
||||
<form class="input-group">
|
||||
<input class="form-control" type="text" placeholder="Filter by city"/>
|
||||
<button class="btn btn-primary" type="button">Search</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<div class="row g-4">
|
||||
@for (housingLocation of housingLocationList; track housingLocation.id) {
|
||||
<div class="col-12 col-md-6 col-lg-4 col-xl-3">
|
||||
<app-housing-location [housingLocation]="housingLocation"></app-housing-location>
|
||||
</div>
|
||||
}
|
||||
</div>
|
23
src/app/home/home.component.spec.ts
Normal file
23
src/app/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();
|
||||
});
|
||||
});
|
22
src/app/home/home.component.ts
Normal file
22
src/app/home/home.component.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {HousingLocationComponent} from '../housing-location/housing-location.component';
|
||||
import {HousingLocation} from '../housing-location';
|
||||
import {HousingService} from '../housing.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
standalone: true,
|
||||
imports: [
|
||||
HousingLocationComponent
|
||||
],
|
||||
templateUrl: './home.component.html',
|
||||
styleUrl: './home.component.css'
|
||||
})
|
||||
export class HomeComponent {
|
||||
housingLocationList: HousingLocation[] = [];
|
||||
housingService: HousingService = inject(HousingService);
|
||||
|
||||
constructor() {
|
||||
this.housingLocationList = this.housingService.getAllHousingLocations();
|
||||
}
|
||||
}
|
10
src/app/housing-location.ts
Normal file
10
src/app/housing-location.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export interface HousingLocation {
|
||||
id: number;
|
||||
name: string;
|
||||
city: string;
|
||||
state: string;
|
||||
photo: string;
|
||||
availableUnits: number;
|
||||
wifi: boolean;
|
||||
laundry: boolean;
|
||||
}
|
16
src/app/housing-location/housing-location.component.html
Normal file
16
src/app/housing-location/housing-location.component.html
Normal file
@ -0,0 +1,16 @@
|
||||
<section class="card h-100">
|
||||
<div class="position-relative" style="height: 200px;">
|
||||
<img
|
||||
[src]="housingLocation.photo"
|
||||
class="card-img-top position-absolute w-100 h-100"
|
||||
style="object-fit: cover;"
|
||||
alt="Exterior photo of {{ housingLocation.name }}"
|
||||
crossorigin
|
||||
/>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h2 class="card-title">{{ housingLocation.name }}</h2>
|
||||
<p class="card-text">{{ housingLocation.city }}, {{ housingLocation.state }}</p>
|
||||
<a [routerLink]="['/details', housingLocation.id]">Learn More</a>
|
||||
</div>
|
||||
</section>
|
23
src/app/housing-location/housing-location.component.spec.ts
Normal file
23
src/app/housing-location/housing-location.component.spec.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HousingLocationComponent } from './housing-location.component';
|
||||
|
||||
describe('HousingLocationComponent', () => {
|
||||
let component: HousingLocationComponent;
|
||||
let fixture: ComponentFixture<HousingLocationComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [HousingLocationComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(HousingLocationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
16
src/app/housing-location/housing-location.component.ts
Normal file
16
src/app/housing-location/housing-location.component.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {HousingLocation} from '../housing-location';
|
||||
import {RouterLink} from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-housing-location',
|
||||
standalone: true,
|
||||
imports: [
|
||||
RouterLink
|
||||
],
|
||||
templateUrl: './housing-location.component.html',
|
||||
styleUrl: './housing-location.component.css'
|
||||
})
|
||||
export class HousingLocationComponent {
|
||||
@Input() housingLocation!: HousingLocation;
|
||||
}
|
112
src/app/housing.service.ts
Normal file
112
src/app/housing.service.ts
Normal file
@ -0,0 +1,112 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HousingLocation} from './housing-location';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class HousingService {
|
||||
readonly baseUrl = 'https://angular.dev/assets/images/tutorials/common';
|
||||
protected housingLocationList: HousingLocation[] = [{
|
||||
id: 0,
|
||||
name: 'Acme Fresh Start Housing',
|
||||
city: 'Chicago',
|
||||
state: 'IL',
|
||||
photo: `${this.baseUrl}/bernard-hermant-CLKGGwIBTaY-unsplash.jpg`,
|
||||
availableUnits: 4,
|
||||
wifi: true,
|
||||
laundry: true,
|
||||
}, {
|
||||
id: 1,
|
||||
name: 'A113 Transitional Housing',
|
||||
city: 'Santa Monica',
|
||||
state: 'CA',
|
||||
photo: `${this.baseUrl}/brandon-griggs-wR11KBaB86U-unsplash.jpg`,
|
||||
availableUnits: 0,
|
||||
wifi: false,
|
||||
laundry: true,
|
||||
}, {
|
||||
id: 2,
|
||||
name: 'Warm Beds Housing Support',
|
||||
city: 'Juneau',
|
||||
state: 'AK',
|
||||
photo: `${this.baseUrl}/i-do-nothing-but-love-lAyXdl1-Wmc-unsplash.jpg`,
|
||||
availableUnits: 1,
|
||||
wifi: false,
|
||||
laundry: false,
|
||||
}, {
|
||||
id: 3,
|
||||
name: 'Homesteady Housing',
|
||||
city: 'Chicago',
|
||||
state: 'IL',
|
||||
photo: `${this.baseUrl}/ian-macdonald-W8z6aiwfi1E-unsplash.jpg`,
|
||||
availableUnits: 1,
|
||||
wifi: true,
|
||||
laundry: false,
|
||||
}, {
|
||||
id: 4,
|
||||
name: 'Happy Homes Group',
|
||||
city: 'Gary',
|
||||
state: 'IN',
|
||||
photo: `${this.baseUrl}/krzysztof-hepner-978RAXoXnH4-unsplash.jpg`,
|
||||
availableUnits: 1,
|
||||
wifi: true,
|
||||
laundry: false,
|
||||
}, {
|
||||
id: 5,
|
||||
name: 'Hopeful Apartment Group',
|
||||
city: 'Oakland',
|
||||
state: 'CA',
|
||||
photo: `${this.baseUrl}/r-architecture-JvQ0Q5IkeMM-unsplash.jpg`,
|
||||
availableUnits: 2,
|
||||
wifi: true,
|
||||
laundry: true,
|
||||
}, {
|
||||
id: 6,
|
||||
name: 'Seriously Safe Towns',
|
||||
city: 'Oakland',
|
||||
state: 'CA',
|
||||
photo: `${this.baseUrl}/phil-hearing-IYfp2Ixe9nM-unsplash.jpg`,
|
||||
availableUnits: 5,
|
||||
wifi: true,
|
||||
laundry: true,
|
||||
}, {
|
||||
id: 7,
|
||||
name: 'Hopeful Housing Solutions',
|
||||
city: 'Oakland',
|
||||
state: 'CA',
|
||||
photo: `${this.baseUrl}/r-architecture-GGupkreKwxA-unsplash.jpg`,
|
||||
availableUnits: 2,
|
||||
wifi: true,
|
||||
laundry: true,
|
||||
}, {
|
||||
id: 8,
|
||||
name: 'Seriously Safe Towns',
|
||||
city: 'Oakland',
|
||||
state: 'CA',
|
||||
photo: `${this.baseUrl}/saru-robert-9rP3mxf8qWI-unsplash.jpg`,
|
||||
availableUnits: 10,
|
||||
wifi: false,
|
||||
laundry: false,
|
||||
}, {
|
||||
id: 9,
|
||||
name: 'Capital Safe Towns',
|
||||
city: 'Portland',
|
||||
state: 'OR',
|
||||
photo: `${this.baseUrl}/webaliser-_TPTXZd9mOo-unsplash.jpg`,
|
||||
availableUnits: 6,
|
||||
wifi: true,
|
||||
laundry: true,
|
||||
},];
|
||||
|
||||
getAllHousingLocations(): HousingLocation[] {
|
||||
return this.housingLocationList;
|
||||
}
|
||||
|
||||
getHousingLocationById(id: number): HousingLocation | undefined {
|
||||
return this.housingLocationList.find((housingLocation) => housingLocation.id === id);
|
||||
}
|
||||
|
||||
submitApplication(firstName: string, lastName: string, email: string) {
|
||||
console.log(`Homes application received: firstName: ${firstName}, lastName: ${lastName}, email: ${email}.`,);
|
||||
}
|
||||
}
|
13
src/index.html
Normal file
13
src/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Homes</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
8
src/main.ts
Normal file
8
src/main.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/// <reference types="@angular/localize" />
|
||||
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { appConfig } from './app/app.config';
|
||||
import { AppComponent } from './app/app.component';
|
||||
|
||||
bootstrapApplication(AppComponent, appConfig)
|
||||
.catch((err) => console.error(err));
|
1
src/styles.css
Normal file
1
src/styles.css
Normal file
@ -0,0 +1 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
17
tsconfig.app.json
Normal file
17
tsconfig.app.json
Normal file
@ -0,0 +1,17 @@
|
||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": [
|
||||
"@angular/localize"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/main.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
33
tsconfig.json
Normal file
33
tsconfig.json
Normal file
@ -0,0 +1,33 @@
|
||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/out-tsc",
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"skipLibCheck": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "bundler",
|
||||
"importHelpers": true,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"lib": [
|
||||
"ES2022",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
}
|
||||
}
|
16
tsconfig.spec.json
Normal file
16
tsconfig.spec.json
Normal file
@ -0,0 +1,16 @@
|
||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"@angular/localize"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user