new tickets

This commit is contained in:
2025-10-24 14:15:59 +02:00
parent 702e989128
commit 8356b04eb2
10 changed files with 113 additions and 32 deletions
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useMemo, useState } from "react";
import { Pressable, ScrollView, Text, View } from "react-native";
import MoreMenu from "../../../components/MoreMenu";
import ProfilePicture from "../../../components/ProfilePicture";
@@ -70,8 +70,20 @@ const SearchResultsList = ({
onResultSelected?.();
};
const musicItems = useMemo(() => {
if (!Array.isArray(musics)) {
return [];
}
if (selected === "Musiques") {
return musics;
}
return musics.filter((project) => project?.hasPlayback !== true);
}, [musics, selected]);
const shouldShowMusics =
(!selected && (musics.length > 0 || musicsLoading)) ||
(!selected && (musicItems.length > 0 || musicsLoading)) ||
selected === "Musiques";
const shouldShowPlaybacks =
@@ -89,10 +101,10 @@ const SearchResultsList = ({
>
{shouldShowMusics && (
<View style={{ gap: 10 }}>
{musics.length > 0 && (
{musicItems.length > 0 && (
<>
{Array.isArray(musics) &&
musics.slice(0, 6).map((project) => (
{Array.isArray(musicItems) &&
musicItems.slice(0, 6).map((project) => (
<MusicCard
key={project.id}
title={project?.title || "Sans titre"}
@@ -126,7 +138,7 @@ const SearchResultsList = ({
)}
</>
)}
{musics.length === 0 && !musicsLoading && (
{musicItems.length === 0 && !musicsLoading && (
<EmptyText text={"Aucune musique trouvée"} />
)}
</View>