chargement corrigé sur la page vidéo
This commit is contained in:
parent
5baad06dc8
commit
5dda6c87fe
|
|
@ -87,5 +87,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"cli": {
|
||||||
|
"analytics": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,5 @@ main {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 2rem;
|
margin: 2rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="card bg-base-100 w-96 shadow-sm">
|
<!-- <div class="card bg-base-100 w-96 shadow-sm">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h2 class="card-title">{{nasaPOTD()?.title}}</h2>
|
<h2 class="card-title">{{nasaPOTD()?.title}}</h2>
|
||||||
<p>{{nasaPOTD()?.explanation}}</p>
|
<p>{{nasaPOTD()?.explanation}}</p>
|
||||||
|
|
@ -8,4 +8,22 @@
|
||||||
src={{nasaPOTD()?.url}}
|
src={{nasaPOTD()?.url}}
|
||||||
alt="Nasa picture of the day" />
|
alt="Nasa picture of the day" />
|
||||||
</figure>
|
</figure>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<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"
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
<h1 class="text-5xl font-bold">{{nasaPOTD()?.title}}</h1>
|
||||||
|
<p class="text-2x2 font-semibold">Copyright: {{nasaPOTD()?.copyright}}</p>
|
||||||
|
<p class="py-6">
|
||||||
|
{{nasaPOTD()?.explanation}}
|
||||||
|
</p>
|
||||||
|
<!-- TODO: button to erase or find a usage -->
|
||||||
|
<!-- <button class="btn btn-primary">Get Started</button> -->
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
.searchcontainer {
|
.searchcontainer {
|
||||||
width:100vw;
|
width:80vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -9,4 +9,6 @@
|
||||||
|
|
||||||
.inputSearch {
|
.inputSearch {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
@ -24,26 +24,30 @@
|
||||||
<button class="btn">Submit</button>
|
<button class="btn">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@if(searchResults()!==null && searchResults()!.collection.items.length==0){
|
||||||
|
<div class="resultsContainer">
|
||||||
|
<p>No results for this search</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if(searchResults()!==null && searchResults()!.collection.items.length!==0){
|
||||||
|
|
||||||
<div class="resultsContainer">
|
<div class="resultsContainer">
|
||||||
<ul class="list bg-base-100 rounded-box shadow-md">
|
<ul class="list bg-base-100 rounded-box shadow-md">
|
||||||
|
|
||||||
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Results</li>
|
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Results</li>
|
||||||
<!-- TODO why the fuck is nasaData an array?-->
|
<!-- TODO why the fuck is nasaData an array?-->
|
||||||
@if(searchResults()!==null){
|
|
||||||
@for(el of searchResults()!.collection.items; track el.data[0].nasa_id){
|
@for(el of searchResults()!.collection.items; track el.data[0].nasa_id){
|
||||||
<li class="list-row">
|
<li class="list-row">
|
||||||
<!-- 2 for small image -->
|
<!-- 2 for small image -->
|
||||||
<div><img class="size-10 rounded-box" src="{{el.links[1].href}}"/></div>
|
<div><a><img class="size-25 rounded-box" src="{{el.links[1].href}}"/></a></div>
|
||||||
<div>
|
<div>
|
||||||
<div>{{el.data[0].title}}</div>
|
<div>{{el.data[0].title}}</div>
|
||||||
<div class="text-xs uppercase font-semibold opacity-60">Photographer: {{el.data[0].photographer}}</div>
|
<div class="text-xs uppercase font-semibold opacity-60">Photographer: {{el.data[0].photographer}}</div>
|
||||||
</div>
|
|
||||||
<p class="list-col-wrap text-xs">
|
<p class="list-col-wrap text-xs">
|
||||||
{{el.data[0].description}}
|
{{el.data[0].description}}
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
<button class="btn btn-square btn-ghost" (click)="onClick(el.data[0].nasa_id)">
|
<button class="btn btn-square btn-ghost" (click)="onClick(el.data[0].nasa_id)">
|
||||||
<svg class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
|
<svg class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -52,8 +56,8 @@
|
||||||
</button> -->
|
</button> -->
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,18 @@
|
||||||
<p></p>
|
@if(isLoading()){
|
||||||
<video width="320" height="240" controls>
|
<div class="spinner">
|
||||||
|
<span class="loading loading-spinner loading-xl"></span>
|
||||||
|
<p>Chargement de la vidéo...</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if(!isLoading() && asset()){
|
||||||
|
<div class="videocontainer">
|
||||||
|
<video width="320" height="240" controls>
|
||||||
<source src="{{asset()!.items[3].href}}" type="video/mp4">
|
<source src="{{asset()!.items[3].href}}" type="video/mp4">
|
||||||
Your browser does not support the video tag.
|
Your browser does not support the video tag.
|
||||||
</video>
|
</video>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if(!isLoading() && !asset()){
|
||||||
|
<p>Impossible de charger la vidéo.</p>
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,7 @@ export class Video {
|
||||||
asset=signal<Collection|null>(null);
|
asset=signal<Collection|null>(null);
|
||||||
//TODO: nom de merde pour le service a changer
|
//TODO: nom de merde pour le service a changer
|
||||||
private nasaApi: NAPOD = inject(NAPOD)
|
private nasaApi: NAPOD = inject(NAPOD)
|
||||||
|
isLoading = signal<boolean>(true);
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
const nasaId=this.route.snapshot.params['id'];
|
const nasaId=this.route.snapshot.params['id'];
|
||||||
|
|
@ -21,15 +22,14 @@ export class Video {
|
||||||
this.nasaApi.getAssetDetail(nasaId).subscribe({
|
this.nasaApi.getAssetDetail(nasaId).subscribe({
|
||||||
next: (data)=>{
|
next: (data)=>{
|
||||||
this.asset.set(data.collection);
|
this.asset.set(data.collection);
|
||||||
|
this.isLoading.set(false);
|
||||||
console.log(this.asset());
|
console.log(this.asset());
|
||||||
|
|
||||||
},
|
},
|
||||||
error: error =>{
|
error: error =>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
this.isLoading.set(false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue