Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Bruno Predot
/
tmdb_test
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Bruno Predot
2025-04-24 21:46:03 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bfc2a3a5e9246f3dcaa062b396be9fbde3aa2cba
bfc2a3a5
1 parent
5acf9333
Ajout d'une section si la recherche est sans résultat.
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
components/MoviesList.vue
components/MoviesList.vue
View file @
bfc2a3a
...
...
@@ -4,7 +4,7 @@ import SearchBar from "~/components/SearchBar.vue";
import { onBeforeUnmount, ref } from "vue";
import { useTMDB } from "~/composables/tMDB";
import { Movie } from "~/models/movie";
import { FilmIcon } from "lucide-vue-next";
import { FilmIcon
, SearchXIcon
} from "lucide-vue-next";
import type { MovieInterface } from "~/interfaces/movie";
import { useDateFormat } from "@vueuse/core";
//#endregion
...
...
@@ -119,6 +119,7 @@ function handleSearchEvent(event: string) {
function handleClearSearchEvent() {
searchQuery.value = '';
currentPage.value = 1;
// Fetch popular movies after clear.
fetchMovies(1);
}
...
...
@@ -127,7 +128,7 @@ function handleClearSearchEvent() {
//#region --Global event--.
onMounted(() => {
//
Chargement des premiers films
.
//
First loading
.
fetchMovies(1);
// Création et stockage dans la ref de l'instance IntersectionObserver.
observer.value = createIntersectionObserver();
...
...
@@ -142,7 +143,7 @@ onMounted(() => {
});
onBeforeUnmount(() => {
// Disconnect the observer when the component is unmounted
// Disconnect the observer when the component is unmounted
.
if (observer.value) {
observer.value.disconnect();
}
...
...
@@ -192,6 +193,13 @@ onBeforeUnmount(() => {
</div>
</div>
<!-- Message si aucun film trouvé -->
<section v-else-if="searchQuery && !movies.length" class="text-center py-12">
<SearchXIcon :size="64" class="mx-auto mb-4 text-gray-600" />
<h3 class="text-xl font-bold mb-2">Aucun film trouvé</h3>
<p class="text-gray-400">Essayez avec un autre terme de recherche</p>
</section>
<!-- Élément observé pour le défilement infini -->
<div ref="loadMoreTrigger" class="h-10 mt-4" />
</section>
...
...
Please
register
or
login
to post a comment