diff --git a/angular.json b/angular.json
index d254c77..dd51ccc 100644
--- a/angular.json
+++ b/angular.json
@@ -44,7 +44,13 @@
"development": {
"optimization": false,
"extractLicenses": false,
- "sourceMap": true
+ "sourceMap": true,
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.development.ts"
+ }
+ ]
}
},
"defaultConfiguration": "production"
diff --git a/src/app/app.config.ts b/src/app/app.config.ts
index 2e06ce8..a0ddd34 100644
--- a/src/app/app.config.ts
+++ b/src/app/app.config.ts
@@ -2,11 +2,13 @@ import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZonelessC
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
+import { provideHttpClient } from '@angular/common/http';
export const appConfig: ApplicationConfig = {
providers: [
provideBrowserGlobalErrorListeners(),
provideZonelessChangeDetection(),
- provideRouter(routes)
+ provideRouter(routes),
+ provideHttpClient()
]
};
diff --git a/src/app/app.css b/src/app/app.css
index 2b28a8f..84936b0 100644
--- a/src/app/app.css
+++ b/src/app/app.css
@@ -1,6 +1,5 @@
-
-
main {
+ width: 100%;
margin: 2rem;
display: flex;
}
diff --git a/src/app/app.html b/src/app/app.html
index 8937551..2da69d3 100644
--- a/src/app/app.html
+++ b/src/app/app.html
@@ -1,22 +1,5 @@
-
-
-
-
-
- Open drawer
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts
index 3aa7c95..b0cf5c2 100644
--- a/src/app/app.routes.ts
+++ b/src/app/app.routes.ts
@@ -6,6 +6,9 @@ export const routes: Routes = [
{path: 'home', loadComponent: ()=> import("./pages/home/home").then(m =>m.Home)},
{path: 'login', loadComponent: ()=> import("./pages/login/login").then(m =>m.Login)},
{path: 'register', loadComponent: ()=> import("./pages/register/register").then(m =>m.Register)},
+ {path: 'login', loadComponent: ()=> import("./pages/login/login").then(m =>m.Login)},
+ {path: 'potd', loadComponent: ()=> import("./pages/potd/potd").then(m =>m.POTD)},
+ {path: 'search', loadComponent: ()=> import("./pages/search/search").then(m =>m.Search)},
{path: 'admin',canActivate: [adminGuard], loadChildren: () => import('./pages/admin/admin').then(m => m.Admin), data: { role: 'ADMIN' } },
//version si besoin de multiplier les routes admin
// {path: 'admin',canActivate: [adminGuard], loadChildren: () => import('./pages/admin/admin.routes').then(m => m.ADMIN_ROUTES), data: { role: 'ADMIN' } },
diff --git a/src/app/interfaces/color.ts b/src/app/interfaces/color.ts
new file mode 100644
index 0000000..96dd8a8
--- /dev/null
+++ b/src/app/interfaces/color.ts
@@ -0,0 +1,33 @@
+export type ColorApi = Color[]
+
+export interface Color {
+ id: number
+ title: string
+ userName: string
+ numViews: number
+ numVotes: number
+ numComments: number
+ numHearts: number
+ rank: number
+ dateCreated: string
+ hex: string
+ rgb: Rgb
+ hsv: Hsv
+ description: string
+ url: string
+ imageUrl: string
+ badgeUrl: string
+ apiUrl: string
+}
+
+export interface Rgb {
+ red: number
+ green: number
+ blue: number
+}
+
+export interface Hsv {
+ hue: number
+ saturation: number
+ value: number
+}
diff --git a/src/app/interfaces/nasa-api.ts b/src/app/interfaces/nasa-api.ts
new file mode 100644
index 0000000..5b278ba
--- /dev/null
+++ b/src/app/interfaces/nasa-api.ts
@@ -0,0 +1,52 @@
+export interface NasaApi {
+ collection: Collection
+ }
+
+ export interface Collection {
+ version: string
+ href: string
+ items: Item[]
+ metadata: Metadata
+ links: Link2[]
+ }
+
+ export interface Item {
+ href: string
+ data: Daum[]
+ links: Link[]
+ }
+
+ export interface Daum {
+ center: string
+ date_created: string
+ description?: string
+ keywords?: string[]
+ media_type: string
+ nasa_id: string
+ title: string
+ description_508?: string
+ album?: string[]
+ location?: string
+ secondary_creator?: string
+ photographer?: string
+ }
+
+ export interface Link {
+ href: string
+ rel: string
+ render?: string
+ width?: number
+ size?: number
+ height?: number
+ }
+
+ export interface Metadata {
+ total_hits: number
+ }
+
+ export interface Link2 {
+ rel: string
+ prompt: string
+ href: string
+ }
+
\ No newline at end of file
diff --git a/src/app/interfaces/picture.ts b/src/app/interfaces/picture.ts
new file mode 100644
index 0000000..d8e4f21
--- /dev/null
+++ b/src/app/interfaces/picture.ts
@@ -0,0 +1,11 @@
+export interface Picture {
+ copyright: string
+ date: string
+ explanation: string
+ hdurl: string
+ media_type: string
+ service_version: string
+ title: string
+ url: string
+ }
+
\ No newline at end of file
diff --git a/src/app/pages/video/video.css b/src/app/pages/potd/potd.css
similarity index 100%
rename from src/app/pages/video/video.css
rename to src/app/pages/potd/potd.css
diff --git a/src/app/pages/potd/potd.html b/src/app/pages/potd/potd.html
new file mode 100644
index 0000000..d9aaa80
--- /dev/null
+++ b/src/app/pages/potd/potd.html
@@ -0,0 +1,11 @@
+
+
+
{{nasaPOTD()?.title}}
+
{{nasaPOTD()?.explanation}}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/pages/video/video.spec.ts b/src/app/pages/potd/potd.spec.ts
similarity index 63%
rename from src/app/pages/video/video.spec.ts
rename to src/app/pages/potd/potd.spec.ts
index a67a7dc..49caaab 100644
--- a/src/app/pages/video/video.spec.ts
+++ b/src/app/pages/potd/potd.spec.ts
@@ -1,18 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { Video } from './video';
+import { POTD } from './potd';
-describe('Video', () => {
- let component: Video;
- let fixture: ComponentFixture;
+describe('POTD', () => {
+ let component: POTD;
+ let fixture: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- imports: [Video]
+ imports: [POTD]
})
.compileComponents();
- fixture = TestBed.createComponent(Video);
+ fixture = TestBed.createComponent(POTD);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/src/app/pages/potd/potd.ts b/src/app/pages/potd/potd.ts
new file mode 100644
index 0000000..39afd14
--- /dev/null
+++ b/src/app/pages/potd/potd.ts
@@ -0,0 +1,29 @@
+import { Component, inject, signal } from '@angular/core';
+import { NAPOD } from '../../services/napod';
+import { Picture } from '../../interfaces/picture';
+
+@Component({
+ selector: 'app-potd',
+ imports: [],
+ templateUrl: './potd.html',
+ styleUrl: './potd.css'
+})
+export class POTD {
+
+ private nasaApi = inject(NAPOD)
+ nasaPOTD = signal< Picture | null >(null)
+
+ constructor(){
+ this.nasaApi.getPicOfToday().subscribe({
+ next: (data)=>{
+ console.log(data)
+ this.nasaPOTD.set(data)
+ },
+ error: error =>{
+ console.log(error);
+ }
+ }
+ )
+ }
+
+}
diff --git a/src/app/pages/search/search.css b/src/app/pages/search/search.css
index e69de29..7682f99 100644
--- a/src/app/pages/search/search.css
+++ b/src/app/pages/search/search.css
@@ -0,0 +1,7 @@
+.searchcontainer {
+ width:100vw;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+}
\ No newline at end of file
diff --git a/src/app/pages/search/search.html b/src/app/pages/search/search.html
index c99423e..8f1ce90 100644
--- a/src/app/pages/search/search.html
+++ b/src/app/pages/search/search.html
@@ -1 +1,48 @@
-search works!
+
+
+
+
+
+ Results
+
+
+
+
+
Dio Lupa
+
Remaining Reason
+
+
+ "Remaining Reason" became an instant hit, praised for its haunting sound and emotional depth. A viral performance brought it widespread recognition, making it one of Dio Lupa’s most iconic tracks.
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/pages/search/search.ts b/src/app/pages/search/search.ts
index 255e0ab..8b2d329 100644
--- a/src/app/pages/search/search.ts
+++ b/src/app/pages/search/search.ts
@@ -1,4 +1,6 @@
-import { Component } from '@angular/core';
+import { Component, inject, signal } from '@angular/core';
+import { NAPOD } from '../../services/napod';
+import { NasaApi } from '../../interfaces/nasa-api';
@Component({
selector: 'app-search',
@@ -7,5 +9,6 @@ import { Component } from '@angular/core';
styleUrl: './search.css'
})
export class Search {
-
+ private nasaApi = inject(NAPOD)
+ searchResults = signal(null)
}
diff --git a/src/app/pages/video/video.html b/src/app/pages/video/video.html
deleted file mode 100644
index fd4e26b..0000000
--- a/src/app/pages/video/video.html
+++ /dev/null
@@ -1 +0,0 @@
-video works!
diff --git a/src/app/pages/video/video.ts b/src/app/pages/video/video.ts
deleted file mode 100644
index 91e2414..0000000
--- a/src/app/pages/video/video.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Component } from '@angular/core';
-
-@Component({
- selector: 'app-video',
- imports: [],
- templateUrl: './video.html',
- styleUrl: './video.css'
-})
-export class Video {
-
-}
diff --git a/src/app/services/napod.spec.ts b/src/app/services/napod.spec.ts
new file mode 100644
index 0000000..45d069d
--- /dev/null
+++ b/src/app/services/napod.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { NAPOD } from './napod';
+
+describe('NAPOD', () => {
+ let service: NAPOD;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(NAPOD);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/services/napod.ts b/src/app/services/napod.ts
new file mode 100644
index 0000000..187820c
--- /dev/null
+++ b/src/app/services/napod.ts
@@ -0,0 +1,29 @@
+import { inject, Injectable } from '@angular/core';
+import { Observable } from 'rxjs';
+import { Picture } from '../interfaces/picture';
+import { environment } from '../../environments/environment.development';
+import { HttpClient } from '@angular/common/http';
+import { NasaApi } from '../interfaces/nasa-api';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class NAPOD {
+
+ private readonly http = inject(HttpClient);
+
+ getPicOfToday(): Observable {
+ return this.http.get(`${environment.NASA_API_BASE_URL}/planetary/apod?api_key=${environment.NASA_API_KEY}`)
+ }
+
+ searchForVideos(query: string){
+ return this.http.get(`${environment.NASA_API_IMAGE_BASE_URL}/search?q=${query}`)
+ }
+
+ getAssetDetail(nasaId: string){
+ return this.http.get(`${environment.NASA_API_IMAGE_BASE_URL}/search?q=${query}`)
+ // https://images-api.nasa.gov/asset/GSFC_20120420_SDO_m10966_Year2
+ }
+
+
+}
diff --git a/src/app/shared/header/header.html b/src/app/shared/header/header.html
index 90f52d8..aae3336 100644
--- a/src/app/shared/header/header.html
+++ b/src/app/shared/header/header.html
@@ -1,5 +1,7 @@
-
+
+
+
@if(isLoggedIn()){
}
diff --git a/src/environments/environment.development.ts b/src/environments/environment.development.ts
new file mode 100644
index 0000000..bbfccad
--- /dev/null
+++ b/src/environments/environment.development.ts
@@ -0,0 +1,7 @@
+export const environment = {
+ production: false,
+ BASE_COLOR_API_URL: 'https://www.colourlovers.com/api/',
+ NASA_API_BASE_URL : "https://api.nasa.gov",
+ NASA_API_KEY: '3azuPabFKF5HNbHpZuQ1rGzIPO6i2DbOLQ6hYuGl',
+ NASA_API_IMAGE_BASE_URL:'https://images-api.nasa.gov'
+};
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
new file mode 100644
index 0000000..5d08331
--- /dev/null
+++ b/src/environments/environment.ts
@@ -0,0 +1,3 @@
+export const environment = {
+ production: true
+};
diff --git a/src/styles.css b/src/styles.css
index cd155af..fba71cc 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -3,5 +3,5 @@
html {
background: #000000;
- background: linear-gradient(90deg,rgba(0, 0, 0, 1) 0%, rgba(130, 21, 21, 1) 66%, rgb(223, 47, 38) 100%);
+ /* background: linear-gradient(90deg,rgba(0, 0, 0, 1) 0%, rgba(130, 21, 21, 1) 66%, rgb(223, 47, 38) 100%); */
}
\ No newline at end of file