Forked commit
This commit is contained in:
commit
a2da0b8600
61 changed files with 29068 additions and 0 deletions
16
.browserslistrc
Normal file
16
.browserslistrc
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||||
|
# For additional information regarding the format and rule options, please see:
|
||||||
|
# https://github.com/browserslist/browserslist#queries
|
||||||
|
|
||||||
|
# For the full list of supported browsers by the Angular framework, please see:
|
||||||
|
# https://angular.io/guide/browser-support
|
||||||
|
|
||||||
|
# You can see what browsers were selected by your queries by running:
|
||||||
|
# npx browserslist
|
||||||
|
|
||||||
|
last 1 Chrome version
|
||||||
|
last 1 Firefox version
|
||||||
|
last 2 Edge major versions
|
||||||
|
last 2 Safari major versions
|
||||||
|
last 2 iOS major versions
|
||||||
|
Firefox ESR
|
16
.editorconfig
Normal file
16
.editorconfig
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# 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
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
46
.gitignore
vendored
Normal file
46
.gitignore
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/out-tsc
|
||||||
|
# Only exists if Bazel was run
|
||||||
|
/bazel-out
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
|
||||||
|
# profiling files
|
||||||
|
chrome-profiler-events*.json
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
/.idea
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# IDE - VSCode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
|
# misc
|
||||||
|
/.angular/cache
|
||||||
|
/.sass-cache
|
||||||
|
/connect.lock
|
||||||
|
/coverage
|
||||||
|
/libpeerconnection.log
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
|
||||||
|
# System Files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
29
README.md
Normal file
29
README.md
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# LaBellePlante
|
||||||
|
|
||||||
|
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.0.3.
|
||||||
|
|
||||||
|
## Development server
|
||||||
|
|
||||||
|
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||||
|
|
||||||
|
Run `npm run api` for the api server. Reach to `http://localhost:3000/`
|
||||||
|
|
||||||
|
## 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.io/cli) page.
|
113
angular.json
Normal file
113
angular.json
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"la-belle-plante": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {
|
||||||
|
"@schematics/angular:component": {
|
||||||
|
"style": "scss"
|
||||||
|
},
|
||||||
|
"@schematics/angular:application": {
|
||||||
|
"strict": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"prefix": "app",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/la-belle-plante",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "tsconfig.app.json",
|
||||||
|
"inlineStyleLanguage": "scss",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": [
|
||||||
|
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "500kb",
|
||||||
|
"maximumError": "1mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "2kb",
|
||||||
|
"maximumError": "4kb"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"buildOptimizer": false,
|
||||||
|
"optimization": false,
|
||||||
|
"vendorChunk": true,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"namedChunks": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production"
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "la-belle-plante:build:production"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"browserTarget": "la-belle-plante:build:development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development"
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "la-belle-plante:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"main": "src/test.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "tsconfig.spec.json",
|
||||||
|
"karmaConfig": "karma.conf.js",
|
||||||
|
"inlineStyleLanguage": "scss",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultProject": "la-belle-plante"
|
||||||
|
}
|
44
karma.conf.js
Normal file
44
karma.conf.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// Karma configuration file, see link for more information
|
||||||
|
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||||
|
|
||||||
|
module.exports = function (config) {
|
||||||
|
config.set({
|
||||||
|
basePath: '',
|
||||||
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
|
plugins: [
|
||||||
|
require('karma-jasmine'),
|
||||||
|
require('karma-chrome-launcher'),
|
||||||
|
require('karma-jasmine-html-reporter'),
|
||||||
|
require('karma-coverage'),
|
||||||
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
|
],
|
||||||
|
client: {
|
||||||
|
jasmine: {
|
||||||
|
// you can add configuration options for Jasmine here
|
||||||
|
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||||
|
// for example, you can disable the random execution with `random: false`
|
||||||
|
// or set a specific seed with `seed: 4321`
|
||||||
|
},
|
||||||
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
|
},
|
||||||
|
jasmineHtmlReporter: {
|
||||||
|
suppressAll: true // removes the duplicated traces
|
||||||
|
},
|
||||||
|
coverageReporter: {
|
||||||
|
dir: require('path').join(__dirname, './coverage/la-belle-plante'),
|
||||||
|
subdir: '.',
|
||||||
|
reporters: [
|
||||||
|
{ type: 'html' },
|
||||||
|
{ type: 'text-summary' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
reporters: ['progress', 'kjhtml'],
|
||||||
|
port: 9876,
|
||||||
|
colors: true,
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
autoWatch: true,
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
singleRun: false,
|
||||||
|
restartOnFileChange: true
|
||||||
|
});
|
||||||
|
};
|
22090
package-lock.json
generated
Normal file
22090
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
43
package.json
Normal file
43
package.json
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
"name": "la-belle-plante",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"ng": "ng",
|
||||||
|
"start": "ng serve",
|
||||||
|
"build": "ng build",
|
||||||
|
"watch": "ng build --watch --configuration development",
|
||||||
|
"test": "ng test",
|
||||||
|
"api": "json-server db.json"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@angular/animations": "~13.0.0",
|
||||||
|
"@angular/common": "~13.0.0",
|
||||||
|
"@angular/compiler": "~13.0.0",
|
||||||
|
"@angular/core": "~13.0.0",
|
||||||
|
"@angular/forms": "~13.0.0",
|
||||||
|
"@angular/platform-browser": "~13.0.0",
|
||||||
|
"@angular/platform-browser-dynamic": "~13.0.0",
|
||||||
|
"@angular/router": "~13.0.0",
|
||||||
|
"bootstrap": "^5.1.3",
|
||||||
|
"rxjs": "~7.4.0",
|
||||||
|
"tslib": "^2.3.0",
|
||||||
|
"underscore": "^1.13.1",
|
||||||
|
"zone.js": "~0.11.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@angular-devkit/build-angular": "~13.0.3",
|
||||||
|
"@angular/cli": "~13.0.3",
|
||||||
|
"@angular/compiler-cli": "~13.0.0",
|
||||||
|
"@types/jasmine": "~3.10.0",
|
||||||
|
"@types/node": "^12.11.1",
|
||||||
|
"@types/underscore": "^1.11.4",
|
||||||
|
"jasmine-core": "~3.10.0",
|
||||||
|
"karma": "~6.3.0",
|
||||||
|
"karma-chrome-launcher": "~3.1.0",
|
||||||
|
"karma-coverage": "~2.0.3",
|
||||||
|
"karma-jasmine": "~4.0.0",
|
||||||
|
"karma-jasmine-html-reporter": "~1.7.0",
|
||||||
|
"typescript": "~4.4.3"
|
||||||
|
}
|
||||||
|
}
|
18
src/app/app-routing.module.ts
Normal file
18
src/app/app-routing.module.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
import { PageAccueilComponent } from './pages/page-accueil/page-accueil.component';
|
||||||
|
import { PageDetailsComponent } from './pages/page-details/page-details.component';
|
||||||
|
import { PageNotFoundComponent } from './pages/page-not-found/page-not-found.component';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
||||||
|
{ path: 'home', component: PageAccueilComponent },
|
||||||
|
{ path: 'details', component: PageDetailsComponent },
|
||||||
|
{ path: '**', component: PageNotFoundComponent }
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forRoot(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class AppRoutingModule { }
|
2
src/app/app.component.html
Normal file
2
src/app/app.component.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<app-nav-bar></app-nav-bar>
|
||||||
|
<router-outlet></router-outlet>
|
0
src/app/app.component.scss
Normal file
0
src/app/app.component.scss
Normal file
35
src/app/app.component.spec.ts
Normal file
35
src/app/app.component.spec.ts
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
describe('AppComponent', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
RouterTestingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
}).compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create the app', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should have as title 'la-belle-plante'`, () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app.title).toEqual('la-belle-plante');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render title', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const compiled = fixture.nativeElement as HTMLElement;
|
||||||
|
expect(compiled.querySelector('.content span')?.textContent).toContain('la-belle-plante app is running!');
|
||||||
|
});
|
||||||
|
});
|
10
src/app/app.component.ts
Normal file
10
src/app/app.component.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-root',
|
||||||
|
templateUrl: './app.component.html',
|
||||||
|
styleUrls: ['./app.component.scss']
|
||||||
|
})
|
||||||
|
export class AppComponent {
|
||||||
|
title = 'la-belle-plante';
|
||||||
|
}
|
36
src/app/app.module.ts
Normal file
36
src/app/app.module.ts
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { NavBarComponent } from './components/nav-bar/nav-bar.component';
|
||||||
|
import { PageAccueilComponent } from './pages/page-accueil/page-accueil.component';
|
||||||
|
import { PageDetailsComponent } from './pages/page-details/page-details.component';
|
||||||
|
import { PageNotFoundComponent } from './pages/page-not-found/page-not-found.component';
|
||||||
|
import { FilterSideBarComponent } from './components/filter-side-bar/filter-side-bar.component';
|
||||||
|
import { CardPlanteComponent } from './components/card-plante/card-plante.component';
|
||||||
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
|
import { IconComponent } from './components/icon/icon.component';
|
||||||
|
import { AvisBarComponent } from './components/avis-bar/avis-bar.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
NavBarComponent,
|
||||||
|
PageAccueilComponent,
|
||||||
|
PageDetailsComponent,
|
||||||
|
PageNotFoundComponent,
|
||||||
|
FilterSideBarComponent,
|
||||||
|
CardPlanteComponent,
|
||||||
|
IconComponent,
|
||||||
|
AvisBarComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
AppRoutingModule,
|
||||||
|
HttpClientModule
|
||||||
|
],
|
||||||
|
providers: [],
|
||||||
|
bootstrap: [AppComponent]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
9
src/app/components/avis-bar/avis-bar.component.html
Normal file
9
src/app/components/avis-bar/avis-bar.component.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<div (mouseleave)="onMouseLeave()">
|
||||||
|
<app-icon *ngFor="let star of starStates; let starIndex = index"
|
||||||
|
[iconName]="star.stateHoverUser ? 'star-fill' : 'star'"
|
||||||
|
[iconSize]="1.2"
|
||||||
|
[iconColor]="'#ffbf00'"
|
||||||
|
(mouseover)="onMouseOver(starIndex)"
|
||||||
|
(click)="onClickStar(starIndex)"
|
||||||
|
></app-icon>
|
||||||
|
</div>
|
0
src/app/components/avis-bar/avis-bar.component.scss
Normal file
0
src/app/components/avis-bar/avis-bar.component.scss
Normal file
25
src/app/components/avis-bar/avis-bar.component.spec.ts
Normal file
25
src/app/components/avis-bar/avis-bar.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { AvisBarComponent } from './avis-bar.component';
|
||||||
|
|
||||||
|
describe('AvisBarComponent', () => {
|
||||||
|
let component: AvisBarComponent;
|
||||||
|
let fixture: ComponentFixture<AvisBarComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ AvisBarComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(AvisBarComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
62
src/app/components/avis-bar/avis-bar.component.ts
Normal file
62
src/app/components/avis-bar/avis-bar.component.ts
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-avis-bar',
|
||||||
|
templateUrl: './avis-bar.component.html',
|
||||||
|
styleUrls: ['./avis-bar.component.scss']
|
||||||
|
})
|
||||||
|
export class AvisBarComponent implements OnInit {
|
||||||
|
starStates: {stateSelectedUser : boolean, stateHoverUser : boolean}[];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.starStates = [];
|
||||||
|
|
||||||
|
for (let index = 0; index < 5; index++) {
|
||||||
|
this.starStates.push(
|
||||||
|
{
|
||||||
|
stateSelectedUser : false,
|
||||||
|
stateHoverUser : false
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
onMouseOver(index: number) {
|
||||||
|
console.log("star over", index);
|
||||||
|
for (let i = 0; i < this.starStates.length ; i++) {
|
||||||
|
if(i <= index) {
|
||||||
|
this.starStates[i].stateHoverUser = true;
|
||||||
|
} else {
|
||||||
|
this.starStates[i].stateHoverUser = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMouseLeave() {
|
||||||
|
// this.starState = ['star', 'star', 'star', 'star', 'star'];
|
||||||
|
const tempTab = [];
|
||||||
|
for (let index = 0; index < this.starStates.length; index++) {
|
||||||
|
tempTab.push(
|
||||||
|
{
|
||||||
|
stateSelectedUser : this.starStates[index].stateSelectedUser,
|
||||||
|
stateHoverUser : this.starStates[index].stateSelectedUser
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.starStates = [...tempTab];
|
||||||
|
}
|
||||||
|
|
||||||
|
onClickStar(starIndex: number) {
|
||||||
|
for (let i = 0; i < this.starStates.length ; i++) {
|
||||||
|
if(i <= starIndex) {
|
||||||
|
this.starStates[i].stateSelectedUser = true;
|
||||||
|
} else {
|
||||||
|
this.starStates[i].stateSelectedUser = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
20
src/app/components/card-plante/card-plante.component.html
Normal file
20
src/app/components/card-plante/card-plante.component.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<div class="plant card mb-4" style="width: 14rem;">
|
||||||
|
<app-icon class="like"
|
||||||
|
[iconName]="'heart'"
|
||||||
|
[iconColor]="'#e35d6a'"
|
||||||
|
(click)="onClickLike()"></app-icon>
|
||||||
|
<img src="{{plant.product_url_picture}}" class="card-img-top" alt="Image de {{ plant.product_name }}">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="card-title">{{ plant.product_name }}</h6>
|
||||||
|
<div class="card-content">
|
||||||
|
<app-avis-bar></app-avis-bar>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex flex-row align-items-end justify-content-between">
|
||||||
|
<div class="card-content">
|
||||||
|
{{ plant.product_unitprice_ati }} €
|
||||||
|
</div>
|
||||||
|
<a href="#" class="btn btn-success">Pour moi !</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
14
src/app/components/card-plante/card-plante.component.scss
Normal file
14
src/app/components/card-plante/card-plante.component.scss
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
.plant {
|
||||||
|
min-height: 22rem;
|
||||||
|
.card-body {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.like {
|
||||||
|
position: absolute;
|
||||||
|
right: 0.7rem;
|
||||||
|
top: 0.5rem;
|
||||||
|
}
|
25
src/app/components/card-plante/card-plante.component.spec.ts
Normal file
25
src/app/components/card-plante/card-plante.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CardPlanteComponent } from './card-plante.component';
|
||||||
|
|
||||||
|
describe('CardPlanteComponent', () => {
|
||||||
|
let component: CardPlanteComponent;
|
||||||
|
let fixture: ComponentFixture<CardPlanteComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ CardPlanteComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CardPlanteComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
22
src/app/components/card-plante/card-plante.component.ts
Normal file
22
src/app/components/card-plante/card-plante.component.ts
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-card-plante',
|
||||||
|
templateUrl: './card-plante.component.html',
|
||||||
|
styleUrls: ['./card-plante.component.scss']
|
||||||
|
})
|
||||||
|
export class CardPlanteComponent implements OnInit {
|
||||||
|
@Input() plant: any;
|
||||||
|
@Output() clickLike = new EventEmitter();
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
onClickLike() {
|
||||||
|
console.log('click');
|
||||||
|
this.clickLike.emit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<div class="custom-side-bar flex-shrink-0 bg-white border-end">
|
||||||
|
<div class="p-3">
|
||||||
|
<span class="fs-5 fw-semibold">Filtres</span>
|
||||||
|
</div>
|
||||||
|
<ul class="list-unstyled ps-0 border-top">
|
||||||
|
<div class="p-3">
|
||||||
|
<p class="mb-1 fs-5 fw-semibold">Catégories</p>
|
||||||
|
<div
|
||||||
|
*ngFor="let category of listCategories; let indexCat = index"
|
||||||
|
class="form-check">
|
||||||
|
|
||||||
|
<input
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
value="testcategory"
|
||||||
|
id="checkBoxCategory{{indexCat}}">
|
||||||
|
|
||||||
|
<label class="form-check-label" for="checkBoxCategory{{indexCat}}">
|
||||||
|
{{ category }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="listCategories.length == 0 ">
|
||||||
|
Aucune catégorie disponible
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
</div>
|
|
@ -0,0 +1,5 @@
|
||||||
|
.custom-side-bar {
|
||||||
|
min-height: calc(100vh - 54px);
|
||||||
|
width: 280px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { FilterSideBarComponent } from './filter-side-bar.component';
|
||||||
|
|
||||||
|
describe('FilterSideBarComponent', () => {
|
||||||
|
let component: FilterSideBarComponent;
|
||||||
|
let fixture: ComponentFixture<FilterSideBarComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ FilterSideBarComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(FilterSideBarComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-filter-side-bar',
|
||||||
|
templateUrl: './filter-side-bar.component.html',
|
||||||
|
styleUrls: ['./filter-side-bar.component.scss']
|
||||||
|
})
|
||||||
|
export class FilterSideBarComponent implements OnInit {
|
||||||
|
@Input() listCategories: string[];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.listCategories = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
2
src/app/components/icon/icon.component.html
Normal file
2
src/app/components/icon/icon.component.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<i class="bi-{{iconName}}"
|
||||||
|
[ngStyle]="{'font-size.rem': iconSize, 'color': iconColor}"></i>
|
3
src/app/components/icon/icon.component.scss
Normal file
3
src/app/components/icon/icon.component.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
i {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
25
src/app/components/icon/icon.component.spec.ts
Normal file
25
src/app/components/icon/icon.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { IconComponent } from './icon.component';
|
||||||
|
|
||||||
|
describe('IconComponent', () => {
|
||||||
|
let component: IconComponent;
|
||||||
|
let fixture: ComponentFixture<IconComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ IconComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(IconComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
17
src/app/components/icon/icon.component.ts
Normal file
17
src/app/components/icon/icon.component.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-icon',
|
||||||
|
templateUrl: './icon.component.html',
|
||||||
|
styleUrls: ['./icon.component.scss']
|
||||||
|
})
|
||||||
|
export class IconComponent implements OnInit {
|
||||||
|
@Input() iconName!: string;
|
||||||
|
@Input() iconSize!: number;
|
||||||
|
@Input() iconColor!: string;
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
src/app/components/nav-bar/nav-bar.component.html
Normal file
26
src/app/components/nav-bar/nav-bar.component.html
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light shadow ">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="#">🪴 La Belle Plante</a>
|
||||||
|
<button class="navbar-toggler"
|
||||||
|
type="button"
|
||||||
|
data-bs-toggle="collapse"
|
||||||
|
data-bs-target="#navbarNavAltMarkup"
|
||||||
|
aria-controls="navbarNavAltMarkup"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
||||||
|
<div class="navbar-nav">
|
||||||
|
<a routerLink="home" routerLinkActive="active-custom" class="nav-link">Accueil</a>
|
||||||
|
<a routerLink="details" routerLinkActive="active-custom" class="nav-link">Details</a>
|
||||||
|
<a class="nav-link">Panier</a>
|
||||||
|
<a class="nav-link disabled">Plus d'option bientôt</a>
|
||||||
|
<a class="nav-link disabled" *ngIf="likeCounter == 0"> Pas de plante likée</a>
|
||||||
|
<a class="nav-link disabled" *ngIf="likeCounter == 1">Plante likée : {{ likeCounter }}</a>
|
||||||
|
<a class="nav-link disabled" *ngIf="likeCounter > 1">Plantes likées : {{ likeCounter }}</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
3
src/app/components/nav-bar/nav-bar.component.scss
Normal file
3
src/app/components/nav-bar/nav-bar.component.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.active-custom {
|
||||||
|
color: green !important;
|
||||||
|
}
|
25
src/app/components/nav-bar/nav-bar.component.spec.ts
Normal file
25
src/app/components/nav-bar/nav-bar.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { NavBarComponent } from './nav-bar.component';
|
||||||
|
|
||||||
|
describe('NavBarComponent', () => {
|
||||||
|
let component: NavBarComponent;
|
||||||
|
let fixture: ComponentFixture<NavBarComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ NavBarComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(NavBarComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
31
src/app/components/nav-bar/nav-bar.component.ts
Normal file
31
src/app/components/nav-bar/nav-bar.component.ts
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
import { PlantouneService } from 'src/app/services/plantoune.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-nav-bar',
|
||||||
|
templateUrl: './nav-bar.component.html',
|
||||||
|
styleUrls: ['./nav-bar.component.scss']
|
||||||
|
})
|
||||||
|
export class NavBarComponent implements OnInit, OnDestroy {
|
||||||
|
likeCounter: number;
|
||||||
|
subPlantLiked!: Subscription;
|
||||||
|
|
||||||
|
constructor(private plantouneService: PlantouneService) {
|
||||||
|
this.likeCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.subPlantLiked = this.plantouneService.plantLiked$.subscribe(
|
||||||
|
() => {
|
||||||
|
console.log('Get new event from Subject');
|
||||||
|
this.likeCounter ++;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.subPlantLiked.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
src/app/pages/page-accueil/page-accueil.component.html
Normal file
26
src/app/pages/page-accueil/page-accueil.component.html
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<div class="d-flex align-items-stretch">
|
||||||
|
<app-filter-side-bar [listCategories]="listCategoriesFilter"></app-filter-side-bar>
|
||||||
|
|
||||||
|
<div class="custom-main container p-3">
|
||||||
|
<input class="form-control"
|
||||||
|
type="text"
|
||||||
|
placeholder="Recherche ta belle plante"
|
||||||
|
aria-label="Input Recherche ta belle plante">
|
||||||
|
|
||||||
|
<div class="py-3">
|
||||||
|
Trier par :
|
||||||
|
<button class="btn btn-outline-success btn-sm me-2">Prix</button>
|
||||||
|
<button class="btn btn-outline-success btn-sm me-2">Ordre Alpha</button>
|
||||||
|
<button class="btn btn-outline-success btn-sm me-2">Avis</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col" *ngFor="let product of listData">
|
||||||
|
<app-card-plante [plant]="product"
|
||||||
|
(clickLike)="onEventLike()">
|
||||||
|
</app-card-plante>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
0
src/app/pages/page-accueil/page-accueil.component.scss
Normal file
0
src/app/pages/page-accueil/page-accueil.component.scss
Normal file
25
src/app/pages/page-accueil/page-accueil.component.spec.ts
Normal file
25
src/app/pages/page-accueil/page-accueil.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { PageAccueilComponent } from './page-accueil.component';
|
||||||
|
|
||||||
|
describe('PageAccueilComponent', () => {
|
||||||
|
let component: PageAccueilComponent;
|
||||||
|
let fixture: ComponentFixture<PageAccueilComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ PageAccueilComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(PageAccueilComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
65
src/app/pages/page-accueil/page-accueil.component.ts
Normal file
65
src/app/pages/page-accueil/page-accueil.component.ts
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { PlantouneService } from 'src/app/services/plantoune.service';
|
||||||
|
import * as _ from 'underscore';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-page-accueil',
|
||||||
|
templateUrl: './page-accueil.component.html',
|
||||||
|
styleUrls: ['./page-accueil.component.scss']
|
||||||
|
})
|
||||||
|
export class PageAccueilComponent implements OnInit {
|
||||||
|
public listData: any[];
|
||||||
|
public listCategoriesFilter: string[];
|
||||||
|
|
||||||
|
constructor(private plantouneService: PlantouneService) {
|
||||||
|
this.listData = [];
|
||||||
|
this.listCategoriesFilter = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* equivalent de la ligne du dessus
|
||||||
|
*
|
||||||
|
* plantouneService;
|
||||||
|
*
|
||||||
|
* constructor(plantouneService: PlantouneService) {
|
||||||
|
* this.plantouneService = plantouneService;
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
this.plantouneService.getData().subscribe(
|
||||||
|
(listPlant: any[]) => {
|
||||||
|
console.log(listPlant);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Technique avec Underscore JS pour recupérer les catégories uniques de nos plantes
|
||||||
|
*/
|
||||||
|
const listAllCategories = listPlant.map(product => product.product_breadcrumb_label);
|
||||||
|
console.log(listAllCategories);
|
||||||
|
|
||||||
|
const listUniqCategories = _.uniq(listAllCategories)
|
||||||
|
console.log(listUniqCategories);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Technique native JS pour recupérer les catégories uniques de nos plantes
|
||||||
|
*/
|
||||||
|
|
||||||
|
const listUniqJsCategories = [...new Set(listAllCategories)];
|
||||||
|
console.log(listUniqJsCategories);
|
||||||
|
|
||||||
|
this.listCategoriesFilter = listUniqJsCategories;
|
||||||
|
this.listData = listPlant;
|
||||||
|
this.listData.length = 9;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
onEventLike() {
|
||||||
|
this.plantouneService.plantLiked$.next('')
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
1
src/app/pages/page-details/page-details.component.html
Normal file
1
src/app/pages/page-details/page-details.component.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<p>page-details works!</p>
|
0
src/app/pages/page-details/page-details.component.scss
Normal file
0
src/app/pages/page-details/page-details.component.scss
Normal file
25
src/app/pages/page-details/page-details.component.spec.ts
Normal file
25
src/app/pages/page-details/page-details.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { PageDetailsComponent } from './page-details.component';
|
||||||
|
|
||||||
|
describe('PageDetailsComponent', () => {
|
||||||
|
let component: PageDetailsComponent;
|
||||||
|
let fixture: ComponentFixture<PageDetailsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ PageDetailsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(PageDetailsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
15
src/app/pages/page-details/page-details.component.ts
Normal file
15
src/app/pages/page-details/page-details.component.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-page-details',
|
||||||
|
templateUrl: './page-details.component.html',
|
||||||
|
styleUrls: ['./page-details.component.scss']
|
||||||
|
})
|
||||||
|
export class PageDetailsComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<p>page-not-found works!</p>
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { PageNotFoundComponent } from './page-not-found.component';
|
||||||
|
|
||||||
|
describe('PageNotFoundComponent', () => {
|
||||||
|
let component: PageNotFoundComponent;
|
||||||
|
let fixture: ComponentFixture<PageNotFoundComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ PageNotFoundComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(PageNotFoundComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
15
src/app/pages/page-not-found/page-not-found.component.ts
Normal file
15
src/app/pages/page-not-found/page-not-found.component.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-page-not-found',
|
||||||
|
templateUrl: './page-not-found.component.html',
|
||||||
|
styleUrls: ['./page-not-found.component.scss']
|
||||||
|
})
|
||||||
|
export class PageNotFoundComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
src/app/services/plantoune.service.spec.ts
Normal file
16
src/app/services/plantoune.service.spec.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { PlantouneService } from './plantoune.service';
|
||||||
|
|
||||||
|
describe('PlantouneService', () => {
|
||||||
|
let service: PlantouneService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(PlantouneService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
16
src/app/services/plantoune.service.ts
Normal file
16
src/app/services/plantoune.service.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Observable, Subject } from 'rxjs';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class PlantouneService {
|
||||||
|
plantLiked$ = new Subject<any>();
|
||||||
|
|
||||||
|
constructor(private httpClient: HttpClient) { }
|
||||||
|
|
||||||
|
getData(): Observable<any[]> {
|
||||||
|
return this.httpClient.get<any[]>('http://localhost:3000/list_products');
|
||||||
|
}
|
||||||
|
}
|
0
src/assets/.gitkeep
Normal file
0
src/assets/.gitkeep
Normal file
3
src/environments/environment.prod.ts
Normal file
3
src/environments/environment.prod.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export const environment = {
|
||||||
|
production: true
|
||||||
|
};
|
16
src/environments/environment.ts
Normal file
16
src/environments/environment.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// This file can be replaced during build by using the `fileReplacements` array.
|
||||||
|
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
|
||||||
|
// The list of file replacements can be found in `angular.json`.
|
||||||
|
|
||||||
|
export const environment = {
|
||||||
|
production: false
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For easier debugging in development mode, you can import the following file
|
||||||
|
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||||
|
*
|
||||||
|
* This import should be commented out in production mode because it will have a negative impact
|
||||||
|
* on performance if an error is thrown.
|
||||||
|
*/
|
||||||
|
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
BIN
src/favicon.ico
Normal file
BIN
src/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 948 B |
14
src/index.html
Normal file
14
src/index.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>LaBellePlante</title>
|
||||||
|
<base href="/">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<app-root></app-root>
|
||||||
|
</body>
|
||||||
|
</html>
|
12
src/main.ts
Normal file
12
src/main.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { enableProdMode } from '@angular/core';
|
||||||
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
|
import { AppModule } from './app/app.module';
|
||||||
|
import { environment } from './environments/environment';
|
||||||
|
|
||||||
|
if (environment.production) {
|
||||||
|
enableProdMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||||
|
.catch(err => console.error(err));
|
53
src/polyfills.ts
Normal file
53
src/polyfills.ts
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||||
|
* You can add your own extra polyfills to this file.
|
||||||
|
*
|
||||||
|
* This file is divided into 2 sections:
|
||||||
|
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||||
|
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||||
|
* file.
|
||||||
|
*
|
||||||
|
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||||
|
* automatically update themselves. This includes recent versions of Safari, Chrome (including
|
||||||
|
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
|
||||||
|
*
|
||||||
|
* Learn more in https://angular.io/guide/browser-support
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* BROWSER POLYFILLS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||||
|
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||||
|
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||||
|
* will put import in the top of bundle, so user need to create a separate file
|
||||||
|
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||||
|
* into that file, and then add the following code before importing zone.js.
|
||||||
|
* import './zone-flags';
|
||||||
|
*
|
||||||
|
* The flags allowed in zone-flags.ts are listed here.
|
||||||
|
*
|
||||||
|
* The following flags will work for all browsers.
|
||||||
|
*
|
||||||
|
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||||
|
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||||
|
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||||
|
*
|
||||||
|
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||||
|
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||||
|
*
|
||||||
|
* (window as any).__Zone_enable_cross_context_check = true;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Zone JS is required by default for Angular itself.
|
||||||
|
*/
|
||||||
|
import 'zone.js'; // Included with Angular CLI.
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* APPLICATION IMPORTS
|
||||||
|
*/
|
3
src/styles.scss
Normal file
3
src/styles.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
/* You can add global styles to this file, and also import other style files */
|
||||||
|
@import '~bootstrap/scss/bootstrap.scss';
|
||||||
|
// le tilde agit comme un raccourci vers le node_modules
|
26
src/test.ts
Normal file
26
src/test.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||||
|
|
||||||
|
import 'zone.js/testing';
|
||||||
|
import { getTestBed } from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting
|
||||||
|
} from '@angular/platform-browser-dynamic/testing';
|
||||||
|
|
||||||
|
declare const require: {
|
||||||
|
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||||
|
keys(): string[];
|
||||||
|
<T>(id: string): T;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// First, initialize the Angular testing environment.
|
||||||
|
getTestBed().initTestEnvironment(
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Then we find all the tests.
|
||||||
|
const context = require.context('./', true, /\.spec\.ts$/);
|
||||||
|
// And load the modules.
|
||||||
|
context.keys().map(context);
|
15
tsconfig.app.json
Normal file
15
tsconfig.app.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/app",
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/main.ts",
|
||||||
|
"src/polyfills.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
32
tsconfig.json
Normal file
32
tsconfig.json
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "./",
|
||||||
|
"outDir": "./dist/out-tsc",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"declaration": false,
|
||||||
|
"downlevelIteration": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"importHelpers": true,
|
||||||
|
"target": "es2017",
|
||||||
|
"module": "es2020",
|
||||||
|
"lib": [
|
||||||
|
"es2020",
|
||||||
|
"dom"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"strictInputAccessModifiers": true,
|
||||||
|
"strictTemplates": true
|
||||||
|
}
|
||||||
|
}
|
18
tsconfig.spec.json
Normal file
18
tsconfig.spec.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/spec",
|
||||||
|
"types": [
|
||||||
|
"jasmine"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/test.ts",
|
||||||
|
"src/polyfills.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue