diff --git a/package-lock.json b/package-lock.json index f89f351..0aabb3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "@angular/router": "^19.2.0", "bootstrap": "^5.3.3", "bootstrap-icons": "^1.11.3", + "file-saver": "^2.0.5", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" @@ -7737,6 +7738,12 @@ "node": ">=0.8.0" } }, + "node_modules/file-saver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", + "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==", + "license": "MIT" + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", diff --git a/package.json b/package.json index 6408a0c..9f33136 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@angular/router": "^19.2.0", "bootstrap": "^5.3.3", "bootstrap-icons": "^1.11.3", + "file-saver": "^2.0.5", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index f185c47..53c95df 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,16 +1,17 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import { HomeComponent } from './home/home.component'; -import { ContactComponent } from './contact/contact.component'; -import { SymptomeComponent } from './symptome/symptome.component'; -import { BlogComponent } from './blog/blog.component'; + +import { HomeComponent } from './component/home/home.component'; +import { SymptomsComponent } from './component/symptoms/symptoms.component'; +import { BlogsComponent } from './component/blogs/blogs.component'; +import { ContactComponent } from './component/contact/contact.component'; const routes: Routes = [ { path: '', component: HomeComponent }, { path: 'home', component: HomeComponent }, - { path: 'contacts', component: ContactComponent }, - { path: 'symptômes', component: SymptomeComponent }, - { path: 'blog', component: BlogComponent }, + { path: 'symptoms', component: SymptomsComponent }, + { path: 'blogs', component: BlogsComponent }, + { path: 'contact', component: ContactComponent }, ]; @NgModule({ diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 70b0e22..45ea6c1 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -4,29 +4,52 @@ import { BrowserModule } from '@angular/platform-browser'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { NavBarComponent } from './nav-bar/nav-bar.component'; -import { HomeComponent } from './home/home.component'; -import { FooterComponent } from './footer/footer.component'; -import { SymptomeComponent } from './symptome/symptome.component'; -import { ContactComponent } from './contact/contact.component'; -import { BlogComponent } from './blog/blog.component'; +import { HttpClientModule } from '@angular/common/http'; + +/* Essential */ +import { NavBarComponent } from './component/essential/nav-bar/nav-bar.component'; +import { FooterComponent } from './component/essential/footer/footer.component'; + +/* Home */ +import { HomeComponent } from './component/home/home.component'; +import { HomeActuComponent } from './component/home/all/home-actu/home-actu.component'; +import { HomeAccueilComponent } from './component/home/all/home-accueil/home-accueil.component'; +import { HomeSymptomsComponent } from './component/home/all/home-symptoms/home-symptoms.component'; + +/* Symptoms */ +import { SymptomsComponent } from './component/symptoms/symptoms.component'; + +/* Blogs */ +import { BlogsComponent } from './component/blogs/blogs.component'; + +/* Contact */ +import { ContactComponent } from './component/contact/contact.component'; @NgModule({ declarations: [ AppComponent, + /* Essential */ NavBarComponent, - HomeComponent, FooterComponent, - SymptomeComponent, - ContactComponent, - BlogComponent + /* Home */ + HomeComponent, + HomeActuComponent, + HomeAccueilComponent, + HomeSymptomsComponent, + /* Symptoms */ + SymptomsComponent, + /* Blogs */ + BlogsComponent, + /* Contact */ + ContactComponent ], imports: [ BrowserModule, AppRoutingModule, FormsModule, - ReactiveFormsModule + ReactiveFormsModule, + HttpClientModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/blog/blog.component.html b/src/app/blog/blog.component.html deleted file mode 100644 index ff0c151..0000000 --- a/src/app/blog/blog.component.html +++ /dev/null @@ -1 +0,0 @@ -

blog works!

diff --git a/src/app/blog/blog.component.ts b/src/app/blog/blog.component.ts deleted file mode 100644 index 65310b0..0000000 --- a/src/app/blog/blog.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-blog', - standalone: false, - templateUrl: './blog.component.html', - styleUrl: './blog.component.css' -}) -export class BlogComponent { - -} diff --git a/src/app/component/blogs/blogs.component.css b/src/app/component/blogs/blogs.component.css new file mode 100644 index 0000000..eefda9f --- /dev/null +++ b/src/app/component/blogs/blogs.component.css @@ -0,0 +1,58 @@ +/* Card Image */ +.card-img-top { + height: 200px; + object-fit: cover; + width: 100%; + } + + /* Assurer une taille uniforme pour les cards */ + .card { + display: flex; + flex-direction: column; + height: 100%; + } + + /* Body de la card pour avoir une hauteur fixe et uniforme */ + .card-body { + display: flex; + flex-direction: column; + justify-content: space-between; + padding: 1.25rem; + height: 100%; + } + + /* Titre de la card (limiter la taille du texte si trop long) */ + .card-title { + font-size: 1.2rem; + font-weight: bold; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + max-height: 2.5em; /* Limite la hauteur du titre */ + margin-bottom: 1rem; + } + + /* Description de la card (maximiser l'espace disponible pour la description) */ + .card-text { + font-size: 0.9rem; + color: #6c757d; + flex-grow: 1; /* Permet à la description de prendre l'espace restant */ + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + margin-bottom: 1.5rem; /* Espacement entre la description et le bouton */ + } + + /* Bouton */ + .btn-primary { + background-color: #007bff; + border-color: #007bff; + text-align: center; + } + + .btn-primary:hover { + background-color: #0056b3; + border-color: #0056b3; + } + \ No newline at end of file diff --git a/src/app/component/blogs/blogs.component.html b/src/app/component/blogs/blogs.component.html new file mode 100644 index 0000000..626840e --- /dev/null +++ b/src/app/component/blogs/blogs.component.html @@ -0,0 +1,16 @@ +
+
+
+ Article image +
+
{{ article.title }}
+

{{ article.description }}

+ Lire l'article +
+
+
+
+ + \ No newline at end of file diff --git a/src/app/blog/blog.component.spec.ts b/src/app/component/blogs/blogs.component.spec.ts similarity index 55% rename from src/app/blog/blog.component.spec.ts rename to src/app/component/blogs/blogs.component.spec.ts index ac14310..86eb3a5 100644 --- a/src/app/blog/blog.component.spec.ts +++ b/src/app/component/blogs/blogs.component.spec.ts @@ -1,18 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { BlogComponent } from './blog.component'; +import { BlogsComponent } from './blogs.component'; -describe('BlogComponent', () => { - let component: BlogComponent; - let fixture: ComponentFixture; +describe('BlogsComponent', () => { + let component: BlogsComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [BlogComponent] + declarations: [BlogsComponent] }) .compileComponents(); - fixture = TestBed.createComponent(BlogComponent); + fixture = TestBed.createComponent(BlogsComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/component/blogs/blogs.component.ts b/src/app/component/blogs/blogs.component.ts new file mode 100644 index 0000000..27dc0f4 --- /dev/null +++ b/src/app/component/blogs/blogs.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit } from '@angular/core'; + +import { DataService } from '@services/data.service'; +import { Article } from '@interface/news'; + +@Component({ + selector: 'app-blogs', + standalone: false, + templateUrl: './blogs.component.html', + styleUrl: './blogs.component.css' +}) +export class BlogsComponent implements OnInit { + articles: Article[] = []; + + constructor(private dataService: DataService) {} + + ngOnInit(): void { + this.dataService.getNews().subscribe((response) => { + this.articles = response.articles; + }); + } +} diff --git a/src/app/component/contact/contact.component.css b/src/app/component/contact/contact.component.css new file mode 100644 index 0000000..ea16378 --- /dev/null +++ b/src/app/component/contact/contact.component.css @@ -0,0 +1,32 @@ +/* Amélioration du formulaire */ +.custom-input { + border: 1px solid #ced4da; + border-radius: 8px; + padding: 10px; + transition: border-color 0.3s ease-in-out, box-shadow 0.2s ease-in-out; +} + +.custom-input:focus { + border-color: #007bff; + box-shadow: 0 0 5px rgba(0, 123, 255, 0.2); + outline: none; +} + +/* Bouton amélioré */ +.btn-primary { + background-color: #007bff; + border: none; + font-weight: 500; + transition: background 0.3s ease, transform 0.2s ease-in-out; +} + +.btn-primary:hover { + background-color: #0056b3; + transform: scale(1.02); +} + +/* Liste des centres */ +.contact-card { + background: #f8f9fa; + border-radius: 10px; +} diff --git a/src/app/component/contact/contact.component.html b/src/app/component/contact/contact.component.html new file mode 100644 index 0000000..4b2fb60 --- /dev/null +++ b/src/app/component/contact/contact.component.html @@ -0,0 +1,70 @@ +
+
+

Contactez-nous

+

Vous avez une question ? Contactez-nous via le formulaire ou rendez-vous dans l'un de nos centres.

+
+ +
+ +
+
+
+

Nos Centres

+
    +
  • + +
    +
    {{ address.title }}
    +

    Type : {{ address.type }}

    +

    Adresse : {{ address.address }}

    +
    +
  • +
+
+
+
+ + +
+
+
+

Laissez-nous un message

+
+
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ + +
+ + +
+
+
+
+
+
diff --git a/src/app/contact/contact.component.spec.ts b/src/app/component/contact/contact.component.spec.ts similarity index 100% rename from src/app/contact/contact.component.spec.ts rename to src/app/component/contact/contact.component.spec.ts diff --git a/src/app/contact/contact.component.ts b/src/app/component/contact/contact.component.ts similarity index 56% rename from src/app/contact/contact.component.ts rename to src/app/component/contact/contact.component.ts index 4a8c27e..13a545d 100644 --- a/src/app/contact/contact.component.ts +++ b/src/app/component/contact/contact.component.ts @@ -1,5 +1,7 @@ import { Component } from '@angular/core'; +import { DataService } from '@services/data.service'; + @Component({ selector: 'app-contact', standalone: false, @@ -7,5 +9,9 @@ import { Component } from '@angular/core'; styleUrl: './contact.component.css' }) export class ContactComponent { - + constructor(private dataService: DataService) {} + + get addresses() { + return this.dataService.getAddresses(); + } } diff --git a/src/app/footer/footer.component.css b/src/app/component/essential/footer/footer.component.css similarity index 100% rename from src/app/footer/footer.component.css rename to src/app/component/essential/footer/footer.component.css diff --git a/src/app/footer/footer.component.html b/src/app/component/essential/footer/footer.component.html similarity index 92% rename from src/app/footer/footer.component.html rename to src/app/component/essential/footer/footer.component.html index 8f79ba5..8853338 100644 --- a/src/app/footer/footer.component.html +++ b/src/app/component/essential/footer/footer.component.html @@ -19,8 +19,8 @@ Mentions légales Cookies Accessibilité - Nous contacter - Presse + Nous contacter + Presse diff --git a/src/app/footer/footer.component.spec.ts b/src/app/component/essential/footer/footer.component.spec.ts similarity index 100% rename from src/app/footer/footer.component.spec.ts rename to src/app/component/essential/footer/footer.component.spec.ts diff --git a/src/app/footer/footer.component.ts b/src/app/component/essential/footer/footer.component.ts similarity index 100% rename from src/app/footer/footer.component.ts rename to src/app/component/essential/footer/footer.component.ts diff --git a/src/app/nav-bar/nav-bar.component.css b/src/app/component/essential/nav-bar/nav-bar.component.css similarity index 100% rename from src/app/nav-bar/nav-bar.component.css rename to src/app/component/essential/nav-bar/nav-bar.component.css diff --git a/src/app/nav-bar/nav-bar.component.html b/src/app/component/essential/nav-bar/nav-bar.component.html similarity index 53% rename from src/app/nav-bar/nav-bar.component.html rename to src/app/component/essential/nav-bar/nav-bar.component.html index b0488a8..08409f1 100644 --- a/src/app/nav-bar/nav-bar.component.html +++ b/src/app/component/essential/nav-bar/nav-bar.component.html @@ -8,23 +8,22 @@ diff --git a/src/app/nav-bar/nav-bar.component.spec.ts b/src/app/component/essential/nav-bar/nav-bar.component.spec.ts similarity index 100% rename from src/app/nav-bar/nav-bar.component.spec.ts rename to src/app/component/essential/nav-bar/nav-bar.component.spec.ts diff --git a/src/app/nav-bar/nav-bar.component.ts b/src/app/component/essential/nav-bar/nav-bar.component.ts similarity index 99% rename from src/app/nav-bar/nav-bar.component.ts rename to src/app/component/essential/nav-bar/nav-bar.component.ts index a1e7892..b480d74 100644 --- a/src/app/nav-bar/nav-bar.component.ts +++ b/src/app/component/essential/nav-bar/nav-bar.component.ts @@ -13,7 +13,7 @@ export class NavBarComponent { isHomeActive(): boolean { return this.router.url === '/' || this.router.url === '/home'; } - + isHomeActiveBool(): boolean { if (this.router.url != '/home') { return true diff --git a/src/app/blog/blog.component.css b/src/app/component/home/all/home-accueil/home-accueil.component.css similarity index 100% rename from src/app/blog/blog.component.css rename to src/app/component/home/all/home-accueil/home-accueil.component.css diff --git a/src/app/component/home/all/home-accueil/home-accueil.component.html b/src/app/component/home/all/home-accueil/home-accueil.component.html new file mode 100644 index 0000000..bede297 --- /dev/null +++ b/src/app/component/home/all/home-accueil/home-accueil.component.html @@ -0,0 +1,10 @@ +
+
+

Ensemble. Luttons.

+

Lorem, ipsum dolor, sit amet consectetur adipisicing elit...

+ +
+
+ Illustration Covid +
+
\ No newline at end of file diff --git a/src/app/component/home/all/home-accueil/home-accueil.component.spec.ts b/src/app/component/home/all/home-accueil/home-accueil.component.spec.ts new file mode 100644 index 0000000..fd36295 --- /dev/null +++ b/src/app/component/home/all/home-accueil/home-accueil.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeAccueilComponent } from './home-accueil.component'; + +describe('HomeAccueilComponent', () => { + let component: HomeAccueilComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [HomeAccueilComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(HomeAccueilComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/component/home/all/home-accueil/home-accueil.component.ts b/src/app/component/home/all/home-accueil/home-accueil.component.ts new file mode 100644 index 0000000..64792e1 --- /dev/null +++ b/src/app/component/home/all/home-accueil/home-accueil.component.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-home-accueil', + standalone: false, + templateUrl: './home-accueil.component.html', + styleUrl: './home-accueil.component.css' +}) +export class HomeAccueilComponent { + +} diff --git a/src/app/component/home/all/home-actu/home-actu.component.css b/src/app/component/home/all/home-actu/home-actu.component.css new file mode 100644 index 0000000..4d0ecd9 --- /dev/null +++ b/src/app/component/home/all/home-actu/home-actu.component.css @@ -0,0 +1,54 @@ +#newsCarousel { + position: relative; + } + + .carousel-item img { + width: 100%; + height: 350px; /* Ajuste la hauteur de l'image pour avoir une vue cohérente */ + object-fit: cover; + border-radius: 10px; + } + + .carousel-caption { + position: absolute; + bottom: 20px; + background-color: rgba(13, 110, 253, 0.7); /* Légère transparence pour le fond */ + padding: 15px; + border-radius: 5px; + color: white; + } + + .carousel-caption h5 { + font-size: 1.5rem; + font-weight: bold; + } + + .carousel-caption p { + font-size: 1rem; + margin-top: 10px; + } + + .carousel-caption .btn { + margin-top: 10px; + } + + .carousel-control-prev, + .carousel-control-next { + background-color: transparent; /* Pas de fond sombre */ + border-radius: 50%; /* Forme ronde */ + border: none; /* Retirer la bordure */ + } + + .carousel-control-prev:hover, + .carousel-control-next:hover { + background-color: transparent; /* Pas de changement de fond au survol */ + } + + .carousel-control-next-icon-new svg { + transform: rotate(180deg); /* Rotation de 180° */ + } + + .carousel-control-prev-icon-new svg, + .carousel-control-next-icon-new svg { + fill: #0d95fd; /* Couleur de l'icône */ + } \ No newline at end of file diff --git a/src/app/component/home/all/home-actu/home-actu.component.html b/src/app/component/home/all/home-actu/home-actu.component.html new file mode 100644 index 0000000..745189e --- /dev/null +++ b/src/app/component/home/all/home-actu/home-actu.component.html @@ -0,0 +1,41 @@ + + \ No newline at end of file diff --git a/src/app/component/home/all/home-actu/home-actu.component.spec.ts b/src/app/component/home/all/home-actu/home-actu.component.spec.ts new file mode 100644 index 0000000..4097df3 --- /dev/null +++ b/src/app/component/home/all/home-actu/home-actu.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeActuComponent } from './home-actu.component'; + +describe('HomeActuComponent', () => { + let component: HomeActuComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [HomeActuComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(HomeActuComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/component/home/all/home-actu/home-actu.component.ts b/src/app/component/home/all/home-actu/home-actu.component.ts new file mode 100644 index 0000000..dea9ee0 --- /dev/null +++ b/src/app/component/home/all/home-actu/home-actu.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit } from '@angular/core'; + +import { DataService } from '@services/data.service'; +import { Article } from '@interface/news'; + +@Component({ + selector: 'app-home-actu', + standalone: false, + templateUrl: './home-actu.component.html', + styleUrls: ['./home-actu.component.css'] // Correction ici : styleUrls (pluriel) +}) +export class HomeActuComponent implements OnInit { + articles: Article[] = []; + + constructor(private dataService: DataService) {} + + ngOnInit(): void { + this.dataService.getNews().subscribe((response) => { + this.articles = response.articles.slice(0, 5); + }); + } +} diff --git a/src/app/contact/contact.component.css b/src/app/component/home/all/home-symptoms/home-symptoms.component.css similarity index 100% rename from src/app/contact/contact.component.css rename to src/app/component/home/all/home-symptoms/home-symptoms.component.css diff --git a/src/app/component/home/all/home-symptoms/home-symptoms.component.html b/src/app/component/home/all/home-symptoms/home-symptoms.component.html new file mode 100644 index 0000000..28830f8 --- /dev/null +++ b/src/app/component/home/all/home-symptoms/home-symptoms.component.html @@ -0,0 +1,18 @@ +
+

Symptôme du Coronavirus

+

Lorem, ipsum dolor sit amet consectetur...

+
+ +
+
+
+
+ +
+
{{ symptom.title }}
+

{{ symptom.description }}

+
+
+
+
+
\ No newline at end of file diff --git a/src/app/component/home/all/home-symptoms/home-symptoms.component.spec.ts b/src/app/component/home/all/home-symptoms/home-symptoms.component.spec.ts new file mode 100644 index 0000000..6171b5a --- /dev/null +++ b/src/app/component/home/all/home-symptoms/home-symptoms.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeSymptomsComponent } from './home-symptoms.component'; + +describe('HomeSymptomsComponent', () => { + let component: HomeSymptomsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [HomeSymptomsComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(HomeSymptomsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/component/home/all/home-symptoms/home-symptoms.component.ts b/src/app/component/home/all/home-symptoms/home-symptoms.component.ts new file mode 100644 index 0000000..e4b0871 --- /dev/null +++ b/src/app/component/home/all/home-symptoms/home-symptoms.component.ts @@ -0,0 +1,17 @@ +import { Component } from '@angular/core'; + +import { DataService } from '@services/data.service'; + +@Component({ + selector: 'app-home-symptoms', + standalone: false, + templateUrl: './home-symptoms.component.html', + styleUrl: './home-symptoms.component.css' +}) +export class HomeSymptomsComponent { + constructor(private dataService: DataService) {} + + get symptoms() { + return this.dataService.getSymptoms(); + } +} diff --git a/src/app/home/home.component.css b/src/app/component/home/home.component.css similarity index 100% rename from src/app/home/home.component.css rename to src/app/component/home/home.component.css diff --git a/src/app/component/home/home.component.html b/src/app/component/home/home.component.html new file mode 100644 index 0000000..bb4d98d --- /dev/null +++ b/src/app/component/home/home.component.html @@ -0,0 +1,5 @@ +
+ + + +
\ No newline at end of file diff --git a/src/app/home/home.component.spec.ts b/src/app/component/home/home.component.spec.ts similarity index 100% rename from src/app/home/home.component.spec.ts rename to src/app/component/home/home.component.spec.ts diff --git a/src/app/home/home.component.ts b/src/app/component/home/home.component.ts similarity index 100% rename from src/app/home/home.component.ts rename to src/app/component/home/home.component.ts diff --git a/src/app/symptome/symptome.component.css b/src/app/component/symptoms/symptoms.component.css similarity index 100% rename from src/app/symptome/symptome.component.css rename to src/app/component/symptoms/symptoms.component.css diff --git a/src/app/component/symptoms/symptoms.component.html b/src/app/component/symptoms/symptoms.component.html new file mode 100644 index 0000000..70cc473 --- /dev/null +++ b/src/app/component/symptoms/symptoms.component.html @@ -0,0 +1,18 @@ +
+

Symptôme du Coronavirus

+

Lorem, ipsum dolor sit amet consectetur...

+
+ +
+
+
+
+ +
+
{{ symptom.title }}
+

{{ symptom.description }}

+
+
+
+
+
\ No newline at end of file diff --git a/src/app/symptome/symptome.component.spec.ts b/src/app/component/symptoms/symptoms.component.spec.ts similarity index 53% rename from src/app/symptome/symptome.component.spec.ts rename to src/app/component/symptoms/symptoms.component.spec.ts index d1e0d3e..8c0faa0 100644 --- a/src/app/symptome/symptome.component.spec.ts +++ b/src/app/component/symptoms/symptoms.component.spec.ts @@ -1,18 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { SymptomeComponent } from './symptome.component'; +import { SymptomsComponent } from './symptoms.component'; -describe('SymptomeComponent', () => { - let component: SymptomeComponent; - let fixture: ComponentFixture; +describe('SymptomsComponent', () => { + let component: SymptomsComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [SymptomeComponent] + declarations: [SymptomsComponent] }) .compileComponents(); - fixture = TestBed.createComponent(SymptomeComponent); + fixture = TestBed.createComponent(SymptomsComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/component/symptoms/symptoms.component.ts b/src/app/component/symptoms/symptoms.component.ts new file mode 100644 index 0000000..bfcd0f1 --- /dev/null +++ b/src/app/component/symptoms/symptoms.component.ts @@ -0,0 +1,17 @@ +import { Component } from '@angular/core'; + +import { DataService } from '@services/data.service'; + +@Component({ + selector: 'app-symptoms', + standalone: false, + templateUrl: './symptoms.component.html', + styleUrl: './symptoms.component.css' +}) +export class SymptomsComponent { + constructor(private dataService: DataService) {} + + get symptoms() { + return this.dataService.getSymptoms(); + } +} diff --git a/src/app/contact/contact.component.html b/src/app/contact/contact.component.html deleted file mode 100644 index 9cae746..0000000 --- a/src/app/contact/contact.component.html +++ /dev/null @@ -1 +0,0 @@ -

contact works!

diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html deleted file mode 100644 index 559963e..0000000 --- a/src/app/home/home.component.html +++ /dev/null @@ -1,63 +0,0 @@ -
-
-
-

Ensemble. Luttons.

-

Lorem, ipsum dolor, sit amet consectetur adipisicing elit...

- -
-
- Illustration Covid -
-
- -
-

Symptôme du Coronavirus

-

Lorem, ipsum dolor sit amet consectetur...

-
- -
-
-
-
- Forte fièvre -
-
Forte fièvre
-

Lorem ipsum dolor sit amet...

-
-
-
-
-
-
-
- Toux -
-
Toux
-

Lorem ipsum dolor sit amet...

-
-
-
-
-
-
-
- Gorge irritée -
-
Gorge irritée
-

Lorem ipsum dolor sit amet...

-
-
-
-
-
-
-
- Migraine -
-
Migraine
-

Lorem ipsum dolor sit amet...

-
-
-
-
-
\ No newline at end of file diff --git a/src/app/interface/news.ts b/src/app/interface/news.ts new file mode 100644 index 0000000..faf1ef8 --- /dev/null +++ b/src/app/interface/news.ts @@ -0,0 +1,21 @@ +export interface Source { + id: string | null; + name: string; +} + +export interface Article { + source: Source; + author: string; + title: string; + description: string; + url: string; + urlToImage: string; + publishedAt: string; + content: string; +} + +export interface NewsResponse { + status: string; + totalResults: number; + articles: Article[]; +} \ No newline at end of file diff --git a/src/app/service/all/address/address.service.spec.ts b/src/app/service/all/address/address.service.spec.ts new file mode 100644 index 0000000..f0cd890 --- /dev/null +++ b/src/app/service/all/address/address.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { AddressService } from './address.service'; + +describe('AddressService', () => { + let service: AddressService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(AddressService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/service/all/address/address.service.ts b/src/app/service/all/address/address.service.ts new file mode 100644 index 0000000..f0c77d9 --- /dev/null +++ b/src/app/service/all/address/address.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class AddressService { + constructor() { } + + private addresses = [ + { title: "Centre de Dépistage - Laboratoire Biomédical", type: "Dépistage", address: "15 Rue de la Colombette, 31000 Toulouse" }, + { title: "Centre de Vaccination Municipal Toulouse La Daurade", type: "Vaccination", address: "17 Place de la Daurade, 31000 Toulouse" }, + { title: "Pharmacie des Pyrénées", type: "Dépistage", address: "77 Boulevard de Strasbourg, 31000 Toulouse" }, + { title: "Centre de Vaccination - CHU Toulouse Purpan", type: "Dépistage & Vaccination", address: "1 Place du Docteur Joseph Baylac, 31300 Toulouse" } + ]; + + getAddresses() { + return this.addresses; + } +} diff --git a/src/app/service/all/blog/blog.service.spec.ts b/src/app/service/all/blog/blog.service.spec.ts new file mode 100644 index 0000000..64866b7 --- /dev/null +++ b/src/app/service/all/blog/blog.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { BlogService } from './blog.service'; + +describe('BlogService', () => { + let service: BlogService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(BlogService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/service/all/blog/blog.service.ts b/src/app/service/all/blog/blog.service.ts new file mode 100644 index 0000000..961ab60 --- /dev/null +++ b/src/app/service/all/blog/blog.service.ts @@ -0,0 +1,35 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class BlogService { + constructor() { } + + private blogs = [ + { + title: "Déclaration de la pandémie par l'OMS", + date: "2020-03-11", + text: "L'Organisation mondiale de la santé (OMS) a déclaré le COVID-19 comme une pandémie mondiale, soulignant la gravité et la rapidité de la propagation du virus." + }, + { + title: "Premier confinement en France", + date: "2020-03-17", + text: "La France a instauré un confinement national strict pour limiter la propagation du virus, entraînant la fermeture des écoles, des commerces non essentiels et des restrictions de déplacement." + }, + { + title: "Début de la campagne de vaccination en France", + date: "2020-12-27", + text: "La France a lancé sa campagne de vaccination contre le COVID-19, en commençant par les populations les plus vulnérables." + }, + { + title: "Levée progressive des restrictions sanitaires", + date: "2021-06-09", + text: "La France a entamé une levée progressive des restrictions, avec la réouverture des restaurants, des lieux culturels et l'assouplissement du couvre-feu." + } + ]; + + getBlogs() { + return this.blogs; + } +} diff --git a/src/app/service/all/news/news.service.spec.ts b/src/app/service/all/news/news.service.spec.ts new file mode 100644 index 0000000..d129c15 --- /dev/null +++ b/src/app/service/all/news/news.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { NewsService } from './news.service'; + +describe('NewsService', () => { + let service: NewsService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(NewsService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/service/all/news/news.service.ts b/src/app/service/all/news/news.service.ts new file mode 100644 index 0000000..a666e80 --- /dev/null +++ b/src/app/service/all/news/news.service.ts @@ -0,0 +1,44 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { NewsResponse } from '@interface/news'; // Assure-toi que le chemin est correct +import { tap } from 'rxjs/operators'; + +@Injectable({ + providedIn: 'root' +}) +export class NewsService { + private apiKey: string = 'e9bb2770d3374edea421bcadbecdca5c'; + private apiUrl: string = `https://newsapi.org/v2/everything?q=covid&language=fr&apiKey=${this.apiKey}`; + private storageKey: string = 'newsData'; // Clé utilisée pour le localStorage + private lastUpdateKey: string = 'lastUpdate'; // Clé pour stocker la date de la dernière mise à jour + private cacheDuration: number = 60 * 60 * 1000; // Durée en millisecondes (par exemple, 1 heure) + + constructor(private http: HttpClient) {} + + // Méthode pour récupérer les articles de l'API ou du localStorage + getNews(): Observable { + const storedData = localStorage.getItem(this.storageKey); + const lastUpdate = localStorage.getItem(this.lastUpdateKey); + + // Vérifie si les données existent et si elles sont encore valides + const currentTime = new Date().getTime(); + + if (storedData && lastUpdate && (currentTime - Number(lastUpdate)) < this.cacheDuration) { + // Si les données sont présentes et récentes (moins de 1 heure par exemple), on les retourne + return new Observable(observer => { + observer.next(JSON.parse(storedData)); // On envoie les données stockées + observer.complete(); + }); + } else { + // Sinon, on effectue la requête à l'API + return this.http.get(this.apiUrl).pipe( + tap(response => { + // On stocke la réponse dans le localStorage et la date de mise à jour + localStorage.setItem(this.storageKey, JSON.stringify(response)); + localStorage.setItem(this.lastUpdateKey, currentTime.toString()); // On enregistre l'heure de la mise à jour + }) + ); + } + } +} \ No newline at end of file diff --git a/src/app/service/all/symptom/symptom.service.spec.ts b/src/app/service/all/symptom/symptom.service.spec.ts new file mode 100644 index 0000000..ea676e9 --- /dev/null +++ b/src/app/service/all/symptom/symptom.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { SymptomService } from './symptom.service'; + +describe('SymptomService', () => { + let service: SymptomService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(SymptomService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/service/all/symptom/symptom.service.ts b/src/app/service/all/symptom/symptom.service.ts new file mode 100644 index 0000000..3fa1656 --- /dev/null +++ b/src/app/service/all/symptom/symptom.service.ts @@ -0,0 +1,55 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class SymptomService { + constructor() { } + + private symptoms = [ + { + title: "Toux", + imageName: "/assets/toux.png", + description: "Une toux sèche et persistante est l'un des premiers symptômes du COVID-19. Elle peut être accompagnée de difficultés respiratoires." + }, + { + title: "Fièvre", + imageName: "/assets/fievre.png", + description: "Une fièvre supérieure à 38°C est un symptôme courant du COVID-19, indiquant que le corps combat une infection." + }, + { + title: "Fatigue", + imageName: "/assets/what.avif", + description: "Un état de fatigue intense, même sans activité physique, est fréquemment observé chez les personnes atteintes du virus." + }, + { + title: "Perte du goût et de l'odorat", + imageName: "/assets/what.avif", + description: "L'anosmie (perte de l'odorat) et l'agueusie (perte du goût) sont des symptômes spécifiques souvent signalés par les patients atteints du COVID-19." + }, + { + title: "Difficultés respiratoires", + imageName: "/assets/what.avif", + description: "Une sensation d'essoufflement ou une difficulté à respirer peut indiquer une forme plus grave de l'infection nécessitant une prise en charge médicale." + }, + { + title: "Maux de gorge", + imageName: "/assets/gorge.png", + description: "Un mal de gorge accompagné d'une sensation de brûlure ou de picotements peut être un signe d'infection par le virus." + }, + { + title: "Maux de tête", + imageName: "/assets/migraine.png", + description: "Des céphalées intenses et persistantes sont rapportées par de nombreux patients atteints du COVID-19." + }, + { + title: "Douleurs musculaires", + imageName: "/assets/what.avif", + description: "Des douleurs musculaires généralisées peuvent accompagner l'infection, similaires à celles observées lors d'une grippe." + } + ]; + + getSymptoms() { + return this.symptoms; + } +} diff --git a/src/app/service/data.service.spec.ts b/src/app/service/data.service.spec.ts new file mode 100644 index 0000000..38e8d9e --- /dev/null +++ b/src/app/service/data.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { DataService } from './data.service'; + +describe('DataService', () => { + let service: DataService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(DataService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/service/data.service.ts b/src/app/service/data.service.ts new file mode 100644 index 0000000..3ff8296 --- /dev/null +++ b/src/app/service/data.service.ts @@ -0,0 +1,35 @@ +import { Injectable } from '@angular/core'; + +import { SymptomService } from './all/symptom/symptom.service'; +import { BlogService } from './all/blog/blog.service'; +import { AddressService } from './all/address/address.service'; +import { NewsService } from './all/news/news.service'; + +@Injectable({ + providedIn: 'root' +}) +export class DataService { + + constructor( + private symptomService: SymptomService, + private blogService: BlogService, + private addressService: AddressService, + private newsService: NewsService + ) {} + + getSymptoms() { + return this.symptomService.getSymptoms(); + } + + getBlogs() { + return this.blogService.getBlogs(); + } + + getAddresses() { + return this.addressService.getAddresses(); + } + + getNews() { + return this.newsService.getNews(); + } +} diff --git a/src/app/symptome/symptome.component.html b/src/app/symptome/symptome.component.html deleted file mode 100644 index 1e0558d..0000000 --- a/src/app/symptome/symptome.component.html +++ /dev/null @@ -1 +0,0 @@ -

symptome works!

diff --git a/src/app/symptome/symptome.component.ts b/src/app/symptome/symptome.component.ts deleted file mode 100644 index c8e9850..0000000 --- a/src/app/symptome/symptome.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-symptome', - standalone: false, - templateUrl: './symptome.component.html', - styleUrl: './symptome.component.css' -}) -export class SymptomeComponent { - -} diff --git a/src/assets/what.avif b/src/assets/what.avif new file mode 100644 index 0000000..703664a Binary files /dev/null and b/src/assets/what.avif differ diff --git a/tsconfig.json b/tsconfig.json index 5525117..8fdd6ae 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,12 @@ "moduleResolution": "bundler", "importHelpers": true, "target": "ES2022", - "module": "ES2022" + "module": "ES2022", + "baseUrl": "./src", + "paths": { + "@services/*": ["app/service/*"], + "@interface/*": ["app/interface/*"] + } }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false,