Compare commits
5 Commits
main
...
KAN-5-feat
| Author | SHA1 | Date |
|---|---|---|
|
|
15bb813a7b | |
|
|
812e9d182f | |
|
|
13f05006fc | |
|
|
5c174ed7f3 | |
|
|
9b29d7fe5f |
|
|
@ -0,0 +1,6 @@
|
|||
main {
|
||||
width: 100%;
|
||||
margin: 2rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
<input id="my-drawer-4" type="checkbox" class="drawer-toggle" />
|
||||
|
||||
<!-- Contenu principal de la page (router-outlet) -->
|
||||
<div class="drawer-content max-w-full overflow-hidden flex flex-col">
|
||||
<main class="flex-grow m-0 p-4">
|
||||
<div class="drawer-content flex flex-col">
|
||||
<main class="flex-grow p-4">
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
</div>
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<!-- Sidebar -->
|
||||
<div class="drawer-side is-drawer-close:overflow-visible">
|
||||
<label for="my-drawer-4" aria-label="close sidebar" class="drawer-overlay"></label>
|
||||
<div class="flex min-h-full flex-col items-start bg-base-200 is-drawer-close:w-14 is-drawer-open:w-64 mt-16 lg:mt-0">
|
||||
<div class="flex min-h-full flex-col items-start bg-base-200 is-drawer-close:w-14 is-drawer-open:w-64">
|
||||
<app-sidebar [userEmail]="connectedUserEmail()" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
@if(isLoading()){
|
||||
<div class="spinner">
|
||||
<span class="loading loading-spinner loading-xl"></span>
|
||||
<p>Chargement ...</p>
|
||||
</div>
|
||||
}
|
||||
@if(!isLoading() && nasaPOTD()){
|
||||
@if(nasaPOTD()?.media_type=="image"){
|
||||
<div class="hero bg-base-200 min-h-screen">
|
||||
<div class="hero-content flex-col lg:flex-col">
|
||||
<img src={{nasaPOTD()?.url}} class="max-w-mid rounded-lg shadow-2xl" alt="{{nasaPOTD()?.explanation}}" />
|
||||
<img
|
||||
src={{nasaPOTD()?.url}}
|
||||
class="max-w-mid rounded-lg shadow-2xl"
|
||||
alt="{{nasaPOTD()?.explanation}}"
|
||||
/>
|
||||
<div>
|
||||
<h1 class="text-5xl font-bold">{{nasaPOTD()?.title}}</h1>
|
||||
<p class="text-2x2 font-semibold">{{nasaPOTD()?.copyright}}</p>
|
||||
|
|
@ -18,16 +14,3 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if(nasaPOTD()?.media_type==="video"){
|
||||
<div class="videocontainer flex justify-center w-full mt-20">
|
||||
<video class="rounded-md" controls>
|
||||
<source src="{{nasaPOTD()!.url}}" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
@if(!isLoading() && !nasaPOTD()){
|
||||
<p>Impossible de charger la vidéo.</p>
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit, inject, signal } from '@angular/core';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { NAPOD } from '../../services/napod';
|
||||
import { Picture } from '../../interfaces/picture';
|
||||
|
||||
|
|
@ -8,22 +8,19 @@ import { Picture } from '../../interfaces/picture';
|
|||
templateUrl: './potd.html',
|
||||
styleUrl: './potd.css'
|
||||
})
|
||||
export class POTD implements OnInit{
|
||||
export class POTD {
|
||||
|
||||
private readonly nasaApi = inject(NAPOD)
|
||||
nasaPOTD = signal< Picture | null >(null)
|
||||
isLoading = signal<boolean>(true);
|
||||
|
||||
ngOnInit(){
|
||||
constructor(){
|
||||
this.nasaApi.getPicOfToday().subscribe({
|
||||
next: (data)=>{
|
||||
console.log(data)
|
||||
this.nasaPOTD.set(data)
|
||||
this.isLoading.set(false);
|
||||
},
|
||||
error: error =>{
|
||||
console.log(error);
|
||||
this.isLoading.set(false);
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import { Component, inject } from '@angular/core';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { NAPOD } from '../../../services/napod';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { Search } from '../../../services/search';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchform',
|
||||
imports: [FormsModule, RouterLink],
|
||||
imports: [FormsModule],
|
||||
templateUrl: './searchform.html',
|
||||
styleUrl: './searchform.css',
|
||||
})
|
||||
|
|
@ -15,14 +14,9 @@ export class Searchform {
|
|||
private readonly searchService = inject(Search);
|
||||
searchString = this.searchService.searchString;
|
||||
|
||||
constructor(private readonly router: Router){
|
||||
|
||||
}
|
||||
|
||||
onSubmit(event: Event) {
|
||||
event.preventDefault(); // <-- Empêche le rechargement
|
||||
console.log("onSubmit appelé !"); // <-- Devrait s'afficher
|
||||
this.router.navigate(["/home"])
|
||||
this.nasaApi.searchForVideos(this.searchService.searchString()).subscribe({
|
||||
next: (data)=>{this.searchService.searchResults.set(data);
|
||||
console.log(data.collection);
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@
|
|||
}
|
||||
|
||||
@if(searchResults()!==null && searchResults()!.collection.items.length!==0){
|
||||
<div class="flex justify-center resultsContainer w-full">
|
||||
<ul class="flex max-w-6xl list bg-base-100 rounded-box shadow-md">
|
||||
<div class="resultsContainer">
|
||||
<ul class="list bg-base-100 rounded-box shadow-md">
|
||||
|
||||
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Results</li>
|
||||
@for(el of searchResults()!.collection.items; track el.data[0].nasa_id){
|
||||
<li class="list-row">
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
</button>
|
||||
</li>
|
||||
}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit, inject, signal } from '@angular/core';
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Collection } from '../../interfaces/nasa-api';
|
||||
import { NAPOD } from '../../services/napod';
|
||||
|
|
@ -11,7 +11,7 @@ import { NAPOD } from '../../services/napod';
|
|||
templateUrl: './video.html',
|
||||
styleUrl: './video.css'
|
||||
})
|
||||
export class Video implements OnInit {
|
||||
export class Video {
|
||||
private readonly route = inject(ActivatedRoute)
|
||||
asset=signal<Collection|null>(null);
|
||||
//TODO: nom nul pour le service a changer
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, computed, input } from '@angular/core';
|
||||
import { Component, computed, input, signal, Signal } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { Auth } from '../../services/auth';
|
||||
import { Searchform } from "../../pages/search/searchform/searchform";
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
<!--
|
||||
<div class="menu bg-base-100 shadow-sm" >
|
||||
<div><a class="btn btn-ghost text-xl" routerLink="/home">Home</a></div>
|
||||
<div><a class="btn btn-ghost text-xl" routerLink="/potd">Picture of the day</a></div>
|
||||
<div><a class="btn btn-ghost text-xl" routerLink="/search">Search</a></div>
|
||||
@if(isLoggedIn()){
|
||||
<div><a class="btn btn-ghost text-xl" (click)="logout()">Logout</a></div>
|
||||
}
|
||||
@if(!isLoggedIn()){
|
||||
<div ><a class="btn btn-ghost text-xl" routerLink="/login">Login</a></div>
|
||||
<div ><a class="btn btn-ghost text-xl" routerLink="/register">Register</a></div>
|
||||
}
|
||||
</div>
|
||||
-->
|
||||
<ul class="menu w-full grow">
|
||||
<li>
|
||||
<a routerLink="/" class="is-drawer-close:tooltip is-drawer-close:tooltip-right" data-tip="Homepage">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
export const environment = {
|
||||
production: false,
|
||||
NASA_API_BASE_URL : "",
|
||||
NASA_API_KEY: '',
|
||||
NASA_API_IMAGE_BASE_URL:'https://images-api.nasa.gov',
|
||||
AUTH_API_BASE:''
|
||||
production: true
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue